How to Use a GPU-Connected Monitor for an LXC Container on Proxmox?

Basosa

Member
Apr 28, 2023
15
1
8
Hi everyone,

I'm trying to set up a dedicated desktop environment inside an LXC container and have it use a physical monitor connected directly to my server's GPU. I've spent a lot of time researching, but I'm getting stuck and could use some guidance.

My Goal:
To have an LXC container (running Ubuntu Desktop) take full control of a GPU so it can display its graphical session on a dedicated monitor, just like a normal desktop computer. My Proxmox host should run headless.

What I Understand So Far:

  1. The Conflict: By default, the Proxmox host uses the GPU to display its own console (vtconsole), which prevents anything else from using the display output.
  2. VM vs. LXC: I know that the method for a full VM (using IOMMU, vfio-pci, etc.) is not the correct way to do this for an LXC container, because containers share the host's kernel.
What I Have Tried:
Based on my research, I took the first steps to detach the GPU from the Proxmox host:

  1. Edited GRUB: I modified /etc/default/grub and added video=efifb:off nofb nomodeset to the GRUB_CMDLINE_LINUX_DEFAULT to stop the host console from grabbing the screen.
  2. Blacklisted Drivers: I created a file in /etc/modprobe.d/ to blacklist the nouveau, amdgpu, and nvidia drivers.
  3. Updated and Rebooted: I ran update-grub, update-initramfs -u, and rebooted the node.
However I still have proxmox using display its own console in the monitor.

Could anyone provide a clear, step-by-step process or point me to a reliable guide for this specific LXC scenario? Example configuration snippets would be incredibly helpful.

Thank you so much in advance
 
Hi,

  1. Edited GRUB: I modified /etc/default/grub and added video=efifb:off nofb nomodeset to the GRUB_CMDLINE_LINUX_DEFAULT to stop the host console from grabbing the screen.
  2. Blacklisted Drivers: I created a file in /etc/modprobe.d/ to blacklist the nouveau, amdgpu, and nvidia drivers.
  3. Updated and Rebooted: I ran update-grub, update-initramfs -u, and rebooted the node.
This is only for a gpu passthrough and should be contra productive.

Here is a how to do use the gpu in an unprivileged container https://github.com/JamesTurland/JimsGarage/tree/main/LXC/Jellyfin (https://www.youtube.com/watch?v=0ZDr5h52OOE)
on reddit I found this one: https://www.reddit.com/r/Proxmox/comments/oj6ai5/guide_lxc_gpu_accelerated_gaming_desktop_without/
EDIT: Figured it out. FB0 is not required, and LXC's tty needs to be mapped to tty's >= 10 on the host. Now that I think about it, you can probably run multiple desktops with multiple games simultaneously on a single CPU/GPU with this setup. I haven't tested it but if someone does, let me know.
I would really appreciate if you would update this thread and try these solutions.

Edit: removed copy/paste error
 
Last edited:
I took the first steps to detach the GPU from the Proxmox host
That is necessary for using it in an QEMU/KVM VM, but not in a LX(C) container. Containers share the kernel with the host, so the GPU has to be recognized by the host in order to pass the device driver files to the container. If it's not recognized, it can neither be used by the host nor by and LX(C) container, yet you can passthrough it to a VM.