Hello,
I've followed a guide (wont link because I dont want to be seen as advertising) that exposes an NVIDIA GPU to an unprivileged container.
Essentially, the following has been added to my LXC config
This exposes the component device nodes and lets "nvidia-smi" run correctly and detects the hardware etc. I also know this works because I am able to use ffpmeg nvenc codecs and I see the process listed on the host running on the GPU.
I'm looking to run an X server inside the container though but running into a few issues with it. Using the Nvidia installer, its generated the following xorg.conf file for me
But when I try to run X it complains about a missing tty0
Ideally I'd want the X11 server to run in the container - I dont need it to output to the GPU, but I am looking to run GUI apps in there and have them make use of the gpu to render/draw the apps themselves and make them available via VNC. I can run X with a bunch of dummy devices but that just means its using the CPU to render (and is hatefully resource expensive, as you can imagine)
I'd like X to be separate from the host and run in a container but im not sure if this is possible? Has anyone done it before?
I've followed a guide (wont link because I dont want to be seen as advertising) that exposes an NVIDIA GPU to an unprivileged container.
Essentially, the following has been added to my LXC config
Code:
lxc.cgroup.devices.allow: c 195:* rwm
lxc.cgroup.devices.allow: c 508:* 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-uvm dev/nvidia-uvm 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-tools dev/nvidia-uvm-tools none bind,optional,create=file
I'm looking to run an X server inside the container though but running into a few issues with it. Using the Nvidia installer, its generated the following xorg.conf file for me
Code:
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 515.57
# This xorg configuration file is meant to be used
# to start a dummy X11 server.
# For details, please see:
# https://www.xpra.org/xorg.conf
# Here we setup a Virtual Display of 1920x1080 pixels
Section "ServerFlags"
Option "DontVTSwitch" "True"
EndSection
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/mouse"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
HorizSync 5.0 - 1000.0
VertRefresh 5.0 - 200.0
ModeLine "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
EndSection
Section "Device"
#VideoRam 4096000
#VideoRam 16384
Identifier "Configured Video Device"
Driver "nvidia"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Configured Video Device"
Monitor "Configured Monitor"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Virtual 1920 1080
Depth 24
EndSubSection
EndSection
But when I try to run X it complains about a missing tty0
Code:
# startx
X.Org X Server 1.19.6
Release Date: 2017-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 5.4.0-121-generic x86_64 Ubuntu
Current Operating System: Linux rtmp 5.15.53-1-pve #1 SMP PVE 5.15.53-1 (Fri, 26 Aug 2022 16:53:52 +0200) x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-5.15.53-1-pve root=ZFS=rpool/ROOT/pve-1 ro root=ZFS=rpool/ROOT/pve-1 boot=zfs
Build Date: 07 July 2022 05:11:20PM
xorg-server 2:1.19.6-1ubuntu4.11 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.34.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Sun Sep 25 19:00:55 2022
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)
(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
Ideally I'd want the X11 server to run in the container - I dont need it to output to the GPU, but I am looking to run GUI apps in there and have them make use of the gpu to render/draw the apps themselves and make them available via VNC. I can run X with a bunch of dummy devices but that just means its using the CPU to render (and is hatefully resource expensive, as you can imagine)
I'd like X to be separate from the host and run in a container but im not sure if this is possible? Has anyone done it before?