Seeking help with NVIDIA GPU passthrough to unprivileged LXC containers on Proxmox 9.0.6

Feb 21, 2023
42
0
11
Hi everyone,

I'm trying to set up GPU acceleration for my unprivileged LXC containers (Ollama, Plex, Whisper) on a Proxmox 9.0.6 host with a GTX 1080.

I've followed the standard guides for shared GPU support, including enabling nesting and configuring the device mounts and cgroups in the LXC config file.

Here is my LXC configuration (/etc/pve/lxc/115.conf):
Code:
arch: amd64
cores: 4
features: keyctl=1,nesting=1
hostname: Ollama
memory: 32768
net0: name=eth0,bridge=vmbr0,hwaddr=BC:24:11:F7:41:60,ip=dhcp,type=veth
onboot: 1
ostype: ubuntu
rootfs: M2-2:vm-115-disk-1,size=200G
swap: 512
tags: ubuntu
unprivileged: 0
lxc.apparmor.profile: unconfined
lxc.cgroup2.devices.allow: c 195:* rwm
lxc.cgroup2.devices.allow: c 226:* 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/nvidia-modeset dev/nvidia-modeset none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
lxc.mount.entry: /lib/x86_64-linux-gnu/libcuda.so.1 usr/lib/x86_64-linux-gnu/libcuda.so.1 none bind,optional,create=file
lxc.mount.entry: /lib/x86_64-linux-gnu/libnvidia-ml.so.1 usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 none bind,optional,create=file
lxc.mount.entry: /lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.1 usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.1 none bind,optional,create=file

When I run nvidia-smi inside the LXC, it reports that the command is not found. When I try to install the NVIDIA drivers directly in the LXC with apt, it fails with unable to make backup link of... Invalid cross-device link.

The host itself has the NVIDIA drivers installed, and nvidia-smi works fine there.

I suspect the issue is related to the unprivileged LXC environment, but I'm not sure what a working configuration should look like.

Has anyone successfully configured this setup on Proxmox 9.0 or a similar version? What am I missing to get the drivers properly mounted and working inside the container?

Any advice would be greatly appreciated. Thanks!