Steam-Headless / docker-steam-headless

A Headless Steam Docker image supporting NVIDIA GPU and accessible via Web UI
GNU General Public License v2.0
734 stars 80 forks source link

Running the container on a desktop computer #99

Open daniel86 opened 8 months ago

daniel86 commented 8 months ago

Is your feature request related to a problem?

It might be that an issue I am facing is caused by running the container on a desktop where the graphics card is in use for a desktop environment with monitors attached (some other reports in the web indicated that to me),

The problem is that the x server keeps crashing in the container (even though running the privileged docker-compose file):

X.Org X Server 1.21.1.7
X Protocol Version 11, Revision 0
[ 36968.889] Current Operating System: Linux SteamHeadless 6.2.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct  6 10:23:26 UTC 2 x86_64
[ 36968.889] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-6.2.0-35-generic root=UUID=b65ed99c-c693-4f2c-9643-4edf2535a073 ro quiet splash nvidia-drm.modeset=1 vt.handoff=7
[ 36968.889] xorg-server 2:21.1.7-3 (https://www.debian.org/support) 
[ 36968.889] Current version of pixman: 0.42.2
[ 36968.889]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[ 36968.889] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 36968.889] (==) Log file: "/var/log/Xorg.55.log", Time: Sun Oct 22 20:33:33 2023
[ 36968.889] (==) Using config file: "/etc/X11/xorg.conf"
[ 36968.889] (==) Using config directory: "/etc/X11/xorg.conf.d"
[ 36968.889] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[ 36968.889] (==) ServerLayout "Layout0"
[ 36968.889] (**) |-->Screen "Screen0" (0)
[ 36968.889] (**) |   |-->Monitor "Monitor0"
[ 36968.889] (**) |   |-->Device "Device0"
[ 36968.889] (**) |-->Input Device "Keyboard0"
[ 36968.889] (**) |-->Input Device "Mouse0"
[ 36968.889] (**) Option "AutoAddGPU" "false"
[ 36968.889] (==) Automatically adding devices
[ 36968.889] (==) Automatically enabling devices
[ 36968.889] (**) Not automatically adding GPU devices
[ 36968.889] (==) Automatically binding GPU devices
[ 36968.889] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 36968.889] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[ 36968.889]    Entry deleted from font path.
[ 36968.889] (==) FontPath set to:
    /usr/share/fonts/X11/misc,
    /usr/share/fonts/X11/100dpi/:unscaled,
    /usr/share/fonts/X11/75dpi/:unscaled,
    /usr/share/fonts/X11/Type1,
    /usr/share/fonts/X11/100dpi,
    /usr/share/fonts/X11/75dpi,
    built-ins
[ 36968.889] (==) ModulePath set to "/usr/lib/xorg/modules"
[ 36968.889] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
[ 36968.889] (WW) Disabling Keyboard0
[ 36968.889] (WW) Disabling Mouse0
[ 36968.889] (II) Loader magic: 0x5562f8e9cf00
[ 36968.889] (II) Module ABI versions:
[ 36968.889]    X.Org ANSI C Emulation: 0.4
[ 36968.889]    X.Org Video Driver: 25.2
[ 36968.889]    X.Org XInput driver : 24.4
[ 36968.889]    X.Org Server Extension : 10.0
[ 36968.890] (++) using VT number 7

[ 36968.890] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[ 36968.891] (II) xfree86: Adding drm device (/dev/dri/card0)
[ 36968.891] (II) Platform probe for /sys/devices/pci0000:00/0000:00:03.1/0000:2b:00.0/drm/card0
[ 36968.894] (**) OutputClass "nvidia" ModulePath extended to "/usr/lib/x86_64-linux-gnu/nvidia/xorg,/usr/lib/xorg/modules"
[ 36968.894] (**) OutputClass "nvidia" setting /dev/dri/card0 as PrimaryGPU
[ 36968.896] (--) PCI:*(43@0:0:0) 10de:21c4:10de:21c4 rev 161, Mem @ 0xfb000000/16777216, 0xd0000000/268435456, 0xe0000000/33554432, I/O @ 0x0000f000/128, BIOS @ 0x????????/131072
[ 36968.896] (II) LoadModule: "glx"
[ 36968.897] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[ 36968.897] (II) Module glx: vendor="X.Org Foundation"
[ 36968.897]    compiled for 1.21.1.7, module version = 1.0.0
[ 36968.897]    ABI class: X.Org Server Extension, version 10.0
[ 36968.897] (II) LoadModule: "nvidia"
[ 36968.897] (II) Loading /usr/lib/x86_64-linux-gnu/nvidia/xorg/nvidia_drv.so
[ 36968.898] (II) Module nvidia: vendor="NVIDIA Corporation"
[ 36968.898]    compiled for 1.6.99.901, module version = 1.0.0
[ 36968.898]    Module class: X.Org Video Driver
[ 36968.898] (II) NVIDIA dlloader X Driver  535.113.01  Tue Sep 12 19:49:52 UTC 2023
[ 36968.898] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[ 36968.898] (II) Loading sub module "fb"
[ 36968.898] (II) LoadModule: "fb"
[ 36968.898] (II) Module "fb" already built-in
[ 36968.898] (II) Loading sub module "wfb"
[ 36968.898] (II) LoadModule: "wfb"
[ 36968.898] (II) Loading /usr/lib/xorg/modules/libwfb.so
[ 36968.898] (II) Module wfb: vendor="X.Org Foundation"
[ 36968.898]    compiled for 1.21.1.7, module version = 1.0.0
[ 36968.898]    ABI class: X.Org ANSI C Emulation, version 0.4
[ 36968.898] (**) NVIDIA(0): Depth 24, (--) framebuffer bpp 32
[ 36968.899] (==) NVIDIA(0): RGB weight 888
[ 36968.899] (==) NVIDIA(0): Default visual is TrueColor
[ 36968.899] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[ 36968.899] (II) Applying OutputClass "nvidia" options to /dev/dri/card0
[ 36968.899] (II) Applying OutputClass "nvidia" options to /dev/dri/card0
[ 36968.899] (**) NVIDIA(0): Option "ModeValidation" "NoMaxPClkCheck, NoEdidMaxPClkCheck, NoMaxSizeCheck, NoHorizSyncCheck, NoVertRefreshCheck, NoVirtualSizeCheck, NoTotalSizeCheck, NoDualLinkDVICheck, NoDisplayPortBandwidthCheck, AllowNon3DVisionModes, AllowNonHDMI3DModes, AllowNonEdidModes, NoEdidHDMI2Check, AllowDpInterlaced"
[ 36968.899] (**) NVIDIA(0): Option "ProbeAllGpus" "False"
[ 36968.899] (**) NVIDIA(0): Option "BaseMosaic" "False"
[ 36968.899] (**) NVIDIA(0): Option "AllowEmptyInitialConfiguration" "True"
[ 36968.899] (**) NVIDIA(0): Option "HardDPMS" "False"
[ 36968.899] (**) NVIDIA(0): Option "ConnectedMonitor" "DFP"
[ 36968.899] (**) NVIDIA(0): Enabling 2D acceleration
[ 36968.899] (**) NVIDIA(0): ConnectedMonitor string: "DFP"
[ 36968.899] (II) Loading sub module "glxserver_nvidia"
[ 36968.899] (II) LoadModule: "glxserver_nvidia"
[ 36968.899] (II) Loading /usr/lib/xorg/modules/extensions/libglxserver_nvidia.so
[ 36968.905] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[ 36968.905]    compiled for 1.6.99.901, module version = 1.0.0
[ 36968.905]    Module class: X.Org Server Extension
[ 36968.905] (II) NVIDIA GLX Module  535.113.01  Tue Sep 12 19:51:54 UTC 2023
[ 36968.905] (II) NVIDIA: The X server supports PRIME Render Offload.
[ 36968.906] (--) NVIDIA(0): Valid display device(s) on GPU-0 at PCI:43:0:0
[ 36968.906] (--) NVIDIA(0):     DFP-0
[ 36968.906] (--) NVIDIA(0):     DFP-1 (boot)
[ 36968.906] (--) NVIDIA(0):     DFP-2
[ 36968.906] (--) NVIDIA(0):     DFP-3
[ 36968.907] (**) NVIDIA(0): Using ConnectedMonitor string "DFP-0".
[ 36968.908] (II) NVIDIA(0): NVIDIA GPU NVIDIA GeForce GTX 1660 SUPER (TU116-B) at
[ 36968.908] (II) NVIDIA(0):     PCI:43:0:0 (GPU-0)
[ 36968.908] (--) NVIDIA(0): Memory: 6291456 kBytes
[ 36968.908] (--) NVIDIA(0): VideoBIOS: 90.16.4f.40.01
[ 36968.908] (II) NVIDIA(0): Detected PCI Express Link width: 16X
[ 36968.908] (EE) NVIDIA(GPU-0): Failed to acquire modesetting permission.
[ 36968.908] (EE) NVIDIA(0): Failing initialization of X screen
[ 36968.908] (II) UnloadModule: "nvidia"
[ 36968.908] (II) UnloadSubModule: "glxserver_nvidia"
[ 36968.908] (II) Unloading glxserver_nvidia
[ 36968.908] (II) UnloadSubModule: "wfb"
[ 36968.908] (EE) Screen(s) found, but none have a usable configuration.
[ 36968.908] (EE) 
Fatal server error:
[ 36968.908] (EE) no screens found(EE) 
[ 36968.908] (EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
[ 36968.908] (EE) Please also check the log file at "/var/log/Xorg.55.log" for additional information.
[ 36968.908] (EE) 
[ 36968.908] (EE) Server terminated with error (1). Closing log file.

What is your feature request?

I would like to run the steam-headless container on a desktop where the graphics card of the host is used for both the rendering of games in the container and the desktop environment with two physical monitors. Basically having a steam daemon on my desktop computer.

The reason I think this makes sense is that I sometimes would like to allow people to play games on my desktop while I do something else with the computer. Also I could let people play on my TV, leave the house without leaving my computer unlocked.

Another advantage is that the container can auto-start on bootup. so e.g. wake-on-lan would play nicely with such a setup without the need to unlock the desktop.

Are there any workarounds?

Kind of. I can run steam GUI on my host, then connect to it from my TV. But it blocks the desktop.

Additional Context

No response

Josh5 commented 8 months ago

This would not work as you are describing. Xorg needs a dedicated gpu. It also manages the keyboard and mouse inputs. Even if you had configured this correctly to make it work with your desktop (which you already can), you would not be able to use your desktop while a game is being played. The game in the container would react to all inputs from your host desktop, and your host desktop would react to all inputs from your container.

While i am exploring options for multi seat support, this simply is not yet possible with a single nvidia gpu at the moment.

daniel86 commented 8 months ago

ok that's a pity. I am not aware of how input is handled with the remote play in steam. To me it seems desirable to isolate host input, after all I only intend to use an input device which is attached to the client (a TV). but well seems for the moment I should rather start thinking about a multi gpu setup.

Thanks for the quick response!

groenator commented 3 months ago

What about when using a laptop with a hybrid GPU? In my laptop I set up the Intel GPU to be my main, and offload heavy apps, like games to my NVIDIA GPU.

Would I be able to configure it?