GPU/devices passthrough

Serge B

New Member
Dec 6, 2020
2
2
1
43
Hello!
I am a Proxmox newbee, and trying to create lxc container with X11 server.

I installed nvidia gpu drivers (nvidia-driver package from debian repo) on phoxmox host and got /dev/nvidia0 and /dev/nvidiactl nodes. Next, i created lxc container with debian-10-standard_10.5-1_amd64.tar.gz template and "Unprivileged" checkbox unchecked, and edit /etc/pve/nodes/proxmox/102.conf file to set device mapping.
##--Begin 102.conf
arch: amd64
cores: 2
features: mknod=1,nesting=1
hostname: zm.test
memory: 2048
net0: name=eth0,bridge=vmbr1,hwaddr=C6:B8:C4:60:3A:B8,ip=dhcp,tag=70,type=veth
ostype: debian
rootfs: containers:102/vm-102-disk-0.raw,size=20G
searchdomain: 172.16.7.1
swap: 2048
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: c 195:* rwm
lxc.cgroup.devices.allow: c 4:8 rwm
lxc.cgroup.devices.allow: c 4:0 rwm
lxc.cgroup.devices.allow: c 320:* rwm
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry: /dev/tty8 dev/tty8 none bind,optional,create=file
lxc.mount.entry: /dev/tty0 dev/tty0 none bind,optional,create=file
lxc.mount.entry: /dev/input dev/input none bind,optional,create=dir
##--end 102.conf

Next, i installed Nvidia drivers and X11 server packages at container.

Problem is, when i am trying to start x server (at container's proxmox console from root account), it terminates with error and message in Xorg.0.log:
##--------------
[142413.829] (II) LoadModule: "nvidia"
[142413.830] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[142413.830] (II) Module nvidia: vendor="NVIDIA Corporation"
[142413.830] compiled for 4.0.2, module version = 1.0.0
[142413.830] Module class: X.Org Video Driver

[142413.831] (II) NVIDIA dlloader X Driver 418.152.00 Tue Jun 2 00:37:06 UTC$
[142413.831] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[142413.832] xf86EnableIOPorts: failed to set IOPL for I/O (Operation not permitted)
[142413.832] (EE) No devices detected.
[142413.832] (EE)
Fatal server error:
[142413.832] (EE) no screens found(EE)

##------------------
Also, when i am tying to use evtest tool to explore devices in /dev/input/event* (evtest /dev/input/event6 for example) it also reports "Operation not permitted". ("ls -l /dev/input" output shows event0-event10 nodes).

Please, help me with proxmox/container configuration to get this to work.
 
Well, I solved this.

First, cgroup access rules must be like this:
lxc.cgroup.devices.allow: a 320:* rwm
(all device types).
This solved permission problems with /dev/input/event* devices.
Second, main problem was at xorg.conf. Thanks to this thread i regenerated xorg.conf, added evdev input devices, and it works now!

Maybe, this solution will be helpful to someone.
 
Well, I solved this.

First, cgroup access rules must be like this:
lxc.cgroup.devices.allow: a 320:* rwm
(all device types).
This solved permission problems with /dev/input/event* devices.
Second, main problem was at xorg.conf. Thanks to this thread i regenerated xorg.conf, added evdev input devices, and it works now!

Maybe, this solution will be helpful to someone.
HI

please can you help me ?

https://forum.proxmox.com/threads/lxc-with-output-audio-video.97270/

I make this thread and seems similar, can you see please?