LXC unprivileged container mapping for gpu passtrough

Crabe919

New Member
May 10, 2023
7
0
1
I'm trying g to map the following pieces for pcie coral passtrough from the pve host to the lxc container:

Pve host:
Video = 44 Render = 104 apex = 1000

Lxc:
Video =44 Render =108 apex = 1000

In the host : etc/subgid i've added :
root:100000:65536 root:44:1 root:104:1 root:1000:1

In the host and lxc : etc/subuid i've added :
root:100000:65535

This is my Lxc conf file:
lxc.cgroup2.devices.allow: c 226:* rwm lxc.mount.entry: /dev/dri/card0 dev/dri/card0 none bind,optional,create=file,mode=0666 lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file lxc.mount.entry: /dev/apex_0 dev/apex_0 none bind,optional,create=file lxc.idmap: u 0 100000 65536 lxc.idmap: g 0 100000 44 lxc.idmap: g 44 44 1 lxc.idmap: g 45 100045 63 lxc.idmap: g 108 104 1 lxc.idmap: g 109 100109 891 lxc.idmap: g 1000 1000 1 lxc.idmap: g 1001 101001 64535

this is the error i receive:
lxc_map_ids: 3701 newgidmap failed to write mapping "newgidmap: gid range [108-109) -> [104-105) not allowed": newgidmap 19090 0 100000 44 44 44 1 45 100045 63 108 104 1 109 100109 891 1000 1000 1 1001 101001 64535 lxc_spawn: 1788 Failed to set up id mapping. __lxc_start: 2107 Failed to spawn container "106" TASK ERROR: startup for container '106' failed


If i only try the following config, the lxc starts and shows nobody video 226 0:
lxc.cgroup2.devices.allow: c 226:* rwm lxc.mount.entry: /dev/dri/card0 dev/dri/card0 none bind,optional,create=file,mode=0666 lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file lxc.mount.entry: /dev/apex_0 dev/apex_0 none bind,optional,create=file lxc.idmap: u 0 100000 65536 lxc.idmap: g 0 100000 44 lxc.idmap: g 44 44 1 lxc.idmap: g 45 100045 63

Screenshot 2023-10-03 at 10.03.37.png

if i change and try to swap the 108 - 104 -> container does not start
lxc.idmap: u 0 100000 65536 lxc.idmap: g 0 100000 108 lxc.idmap: g 108 104 1 lxc.idmap: g 109 100109 65427

if i change and try to swap the 1000 - 1000 -> container does not start
lxc.idmap: u 0 100000 65536 lxc.idmap: g 0 100000 108 lxc.idmap: g 1000 1000 1 lxc.idmap: g 1001 101001 64535

I'm at it for a couple of days, ready to pull my hair out.
Read and deciphered as much as i can, but it' won't work.
Why is this so difficult? Anybody has some other tips things i need to check?

Thanks in advance!
 
Last edited:
Thanks, but if i’m correct the first number is the container, the second one should be the host.

I’ve already tried it the other way but still the same issue.
 
You are right, my bad.

I noticed something else though:
In the host : etc/subgid i've added :
root:100000:65536 root:44:1 root:104:1 root:1000:1
You are allowing root to map gid 1000 instead of gid 100
lxc.idmap: g 1000 1000 1
And you are mapping host gid 1000 instead of 100
 
Last edited:
Made a typo in my opening post, should be 1000. Apex_0 for the coral pci is on 1000.

Thanks for looking at it!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!