LXC guidance and Intel Arc passthrough

crembz

Member
May 8, 2023
43
6
8
Hi everyone,

I've recently been interested in moving my docker containers over to LXC for no real reason other than to learn something new.

I am trying to understand exactly how an LXC works with hardware passthrough.

My understanding is that the LXC runs the same kernel as the host, which would limit hardware compatibility ... is that correct? Where I get confused is whether or not the LXC would require drivers installed, or should it be using the host's drivers?

For a specific example:

Running Emby or Jellyfin on an ubuntu lxc, if I run uname -a I get the same kernel as the host. I'm running the LXCs as privileged until I get my head around how everything is supposed to work. All good.

using ubuntu 22.04 I seem to be able to pass through the GPU just fine. I've also tried the proxmox helper scripts to accelerate some of this experimentation.

However using ubuntu 24.04 I seem to be unable to access the GPU, emby seems to be unable to get a list of codecs and jellyfin bombs out.

Interestingly, it seems 22.04 does not load drivers in the LXC whereas 24.04 does. vainfo fails in 22.04 but works in 24.04.

When running either as a VM, I had the total opposite experience, 22.04 would not work without some manipulation, but the 24.04 non-free drivers worked flawlessly.

In Summary:

Ubuntu 22.04 Emby works with the Arc A310
Ubuntu 24.04 Emby cannot seem to access the GPU (/dev/dri/* present) and vainfo inside the LXC returns the codecs

What is the reason for this?
 
sadly i can't really help for the specific example as i don't have an arc 310 gpu here to test, but in general there are two drivers involved in linux

1. the kernel part driver (i.e. i915/xe for the intel arc)
2. the userland driver (mesa)

the kernel driver is baked into the kernel (most of the time) so here the host (kernel) determines which versions and which hardware is supported
but the userland driver must be installed in the container otherwise the userland programs don't know how to properly talk to the kernel

most of the time you don't need specific driver versions of mesa/kernel to match, but sometimes it can happen that e.g. a newer mesa would need a newer kernel or vice versa to function properly

so for some question that might help fix the issue:

what is your pve version (pveversion -v) and how does your lxc config look like?
there is a new 'dev' config part which makes it much easier to passthrough the /dev/* devices to containers

excerpt from 'man pct.conf'
Code:
dev[n]: [[path=]<Path>] [,deny-write=<1|0>] [,gid=<integer>] [,mode=<Octal access mode>] [,uid=<integer>]
    Device to pass through to the container                                                             
                                                                                                        
    deny-write=<boolean> (default = 0)                                                                  
        Deny the container to write to the device                                                       
                                                                                                        
    gid=<integer> (0 - N)                                                                               
        Group ID to be assigned to the device node                                                      
                                                                                                        
    mode=<Octal access mode>                                                                            
        Access mode to be set on the device node                                                        
                                                                                                        
    path=<Path>                                                                                         
        Path to the device to pass through to the container                                             
                                                                                                        
    uid=<integer> (0 - N)                                                                               
        User ID to be assigned to the device node
 

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!