games-on-whales / wolf

Stream virtual desktops and games running in Docker
https://games-on-whales.github.io/wolf/stable/
MIT License
292 stars 20 forks source link

Steam-Related Problems Encountered While Using Wolf #39

Closed Riebeck-one closed 10 months ago

Riebeck-one commented 10 months ago

After my first attempt to use Wolf on my main PC, I decided to give it another try on a different PC with different specs. The goal was to figure out why I can't use Steam with Wolf. I installed Archlinux on the second PC and after setting things up, I tested Wolf again. Unfortunately, I encountered the exact same problems as with my other PC. Just as a reminder, the issues I'm facing on both PCs are:

Here's my configuration:

$ sudo lshw -short
Chemin matériel  Périphérique  Classe         Description
============================================================
                                  system         GL502VMZ
/0                                bus            GL502VMZ
/0/0                              memory         64KiB BIOS
/0/8                              memory         8GiB Mémoire Système
/0/8/0                            memory         8GiB SODIMM DDR4 Synchrone 2400 MHz (0,4 ns)
/0/8/1                            memory         Project-Id-Version: @(#) $Id: fr.po 2151 2010-03-15 20:26:20Z lyone
/0/8/2                            memory         Project-Id-Version: @(#) $Id: fr.po 2151 2010-03-15 20:26:20Z lyone
/0/8/3                            memory         Project-Id-Version: @(#) $Id: fr.po 2151 2010-03-15 20:26:20Z lyone
/0/e                              memory         256KiB L1 cache
/0/f                              memory         1MiB L2 cache
/0/10                             memory         6MiB L3 cache
/0/11                             processor      Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
/0/100                            bridge         Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers
/0/100/1                          bridge         6th-10th Gen Core Processor PCIe Controller (x16)
/0/100/1/0                        display        GP106M [GeForce GTX 1060 Mobile]
/0/100/1/0.1      card1           multimedia     GP106 High Definition Audio Controller
/0/100/1/0.1/0    input16         input          HDA NVidia HDMI/DP,pcm=3
/0/100/1/0.1/1    input17         input          HDA NVidia HDMI/DP,pcm=7
/0/100/1/0.1/2    input18         input          HDA NVidia HDMI/DP,pcm=8
/0/100/1/0.1/3    input19         input          HDA NVidia HDMI/DP,pcm=9
/0/100/4                          generic        Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem
/0/100/14                         bus            100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller
/0/100/14/0       usb1            bus            xHCI Host Controller
/0/100/14/0/4                     multimedia     USB2.0 HD UVC WebCam
/0/100/14/0/8     input6          input          Asus Keyboard
/0/100/14/0/9                     communication  Bluetooth wireless interface
/0/100/14/1       usb2            bus            xHCI Host Controller
/0/100/14.2                       generic        100 Series/C230 Series Chipset Family Thermal Subsystem
/0/100/15                         generic        100 Series/C230 Series Chipset Family Serial IO I2C Controller #0
/0/100/15.1                       generic        100 Series/C230 Series Chipset Family Serial IO I2C Controller #1
/0/100/16                         communication  100 Series/C230 Series Chipset Family MEI Controller #1
/0/100/17                         storage        HM170/QM170 Chipset SATA Controller [AHCI Mode]
/0/100/1c                         bridge         100 Series/C230 Series Chipset Family PCI Express Root Port #1
/0/100/1c.2                       bridge         100 Series/C230 Series Chipset Family PCI Express Root Port #3
/0/100/1c.2/0     wlan0           network        Wireless 8260
/0/100/1c.3                       bridge         100 Series/C230 Series Chipset Family PCI Express Root Port #4
/0/100/1c.3/0     enp4s0          network        RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
/0/100/1d                         bridge         100 Series/C230 Series Chipset Family PCI Express Root Port #9
/0/100/1d/0       /dev/nvme0      storage        BT58SSD13E
/0/100/1d/0/0     hwmon3          disk           NVMe disk
/0/100/1d/0/2     /dev/ng0n1      disk           NVMe disk
/0/100/1d/0/1     /dev/nvme0n1    disk           1TB NVMe disk
/0/100/1d/0/1/1   /dev/nvme0n1p1  volume         511MiB Windows FAT volume
/0/100/1d/0/1/2   /dev/nvme0n1p2  volume         931GiB EFI partition
/0/100/1f                         bridge         HM175 Chipset LPC/eSPI Controller
/0/100/1f/0                       system         Motherboard registers
/0/100/1f/1                       system         Motherboard registers
/0/100/1f/2                       system         AT Real-Time Clock
/0/100/1f/3                       generic        PnP device INT3f0d
/0/100/1f/4                       generic        PnP device ATK3001
/0/100/1f/5                       system         Motherboard registers
/0/100/1f/6                       system         Motherboard registers
/0/100/1f/7                       system         Motherboard registers
/0/100/1f/8                       system         Motherboard registers
/0/100/1f.2                       memory         Memory controller
/0/100/1f.3       card0           multimedia     CM238 HD Audio Controller
/0/100/1f.3/0     input20         input          HDA Intel PCH Headphone
/0/100/1f.4                       bus            100 Series/C230 Series Chipset Family SMBus
/1                /dev/fb0        display        EFI VGA
/2                input0          input          Lid Switch
/3                input1          input          Sleep Button
/4                input10         input          PC Speaker
/5                input11         input          Asus WMI hotkeys
/6                input14         input          ELAN1200:00 04F3:3049 Mouse
/7                input15         input          ELAN1200:00 04F3:3049 Touchpad
/8                input2          input          Power Button
/9                input3          input          Power Button
/a                input35         input          Wolf mouse virtual device
/b                input36         input          Wolf touchpad virtual device
/c                input37         input          Wolf keyboard virtual device
/d                input38         input          Wolf X-Box One (virtual) pad
/e                input39         input          Wolf X-Box One (virtual) pad
/f                input4          input          Video Bus
/10               input40         input          Wolf X-Box One (virtual) pad
/11               input41         input          Wolf X-Box One (virtual) pad
/12               input5          input          AT Translated Set 2 keyboard
/13               input9          input          Asus Wireless Radio Control
$ nvidia-smi
Wed Aug 23 13:26:17 2023       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.98                 Driver Version: 535.98       CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce GTX 1060        Off | 00000000:01:00.0  On |                  N/A |
| N/A   56C    P8               8W /  78W |    382MiB /  6144MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

Here are the steps I took to install Wolf:

I began by using Pacman to install the following packages:

Next, I enabled Docker using the command:

sudo systemctl enable docker.service

To prevent permission issues with Docker, I added myself to the Docker group:

sudo usermod -aG docker ${USER}

After that, I rebooted the system.

Following the Nvidia section of the Wolf wiki's quickstart guide, I did the following:

curl https://raw.githubusercontent.com/games-on-whales/gow/master/images/nvidia-driver/Dockerfile | docker build -t gow/nvidia-driver:latest -f - --build-arg NV_VERSION=$(cat /sys/module/nvidia/version)

docker run --name nvidia-driver-container --rm --mount source=nvidia-driver-vol,destination=/usr/nvidia gow/nvidia-driver:latest sh

I verified everything was in order by executing the following commands:

$ docker volume ls | grep nvidia-driver
local     nvidia-driver-vol

$ sudo cat /sys/module/nvidia_drm/parameters/modeset
[sudo] Password for david:
Y

I also ran the script to start nvidia_uvm devices:

$ #!/bin/bash
## Script to initialize nvidia device nodes.
## https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile-verifications

/sbin/modprobe nvidia
if [ "$?" -eq 0 ]; then
  # Count the number of NVIDIA controllers found.
  NVDEVS=`lspci | grep -i NVIDIA`
  N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
  NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`
  N=`expr $N3D + $NVGA - 1`
  for i in `seq 0 $N`; do
    mknod -m 666 /dev/nvidia$i c 195 $i
  done
  mknod -m 666 /dev/nvidiactl c 195 255
else
  exit 1
fi

/sbin/modprobe nvidia-uvm
if [ "$?" -eq 0 ]; then
  # Find out the major device number used by the nvidia-uvm driver
  D=`grep nvidia-uvm /proc/devices | awk '{print $1}'`
  mknod -m 666 /dev/nvidia-uvm c $D 0
  mknod -m 666 /dev/nvidia-uvm-tools c $D 0
fiexit 1
mknod: /dev/nvidia0: Le fichier existe
mknod: /dev/nvidiactl: Le fichier existe
mknod: /dev/nvidia-uvm: Le fichier existe
mknod: /dev/nvidia-uvm-tools: Le fichier existe

For those not speaking french, the last 4 lines say "The file exists"

I also followed the steps to utilize uinput by executing the following two commands:

$ ls -la /dev/uinput
crw-rw----+ 1 root input 10, 223 Aug 23 13:06 /dev/uinput

sudo usermod -a -G input $USER

Subsequently, I created the file 85-wolf-virtual-inputs.rules in the directory /etc/udev/rules.d/ and included the following lines in it:

KERNEL=="uinput", SUBSYSTEM=="misc", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput"
SUBSYSTEMS=="input", ATTRS{id/vendor}=="ab00", MODE="0660", GROUP="input", ENV{ID_SEAT}="seat9"
SUBSYSTEMS=="input", ATTRS{id/vendor}=="045e", ATTRS{id/product}=="02d1", ATTRS{id/version}=="ab00", MODE="0660", GROUP="input"

After completing these steps, I proceeded to start Wolf:

docker run \
    --name wolf \
    --network=host \
    -e XDG_RUNTIME_DIR=/tmp/sockets \
    -v /tmp/sockets:/tmp/sockets:rw \
    -e NVIDIA_DRIVER_VOLUME_NAME=nvidia-driver-vol \
    -v nvidia-driver-vol:/usr/nvidia:rw \
    -e HOST_APPS_STATE_FOLDER=/etc/wolf \
    -v /etc/wolf/wolf:/wolf/cfg \
    -v /var/run/docker.sock:/var/run/docker.sock:rw \
    --device-cgroup-rule "c 13:* rmw" \
    --device /dev/nvidia-uvm \
    --device /dev/nvidia-uvm-tools \
    --device /dev/dri/ \
    --device /dev/nvidia-caps/nvidia-cap1 \
    --device /dev/nvidia-caps/nvidia-cap2 \
    --device /dev/nvidiactl \
    --device /dev/nvidia0 \
    --device /dev/nvidia-modeset \
    --device /dev/uinput \
    -v /dev/shm:/dev/shm:rw \
    -v /dev/input:/dev/input:rw \
    -v /run/udev:/run/udev:rw \
    ghcr.io/games-on-whales/wolf:stable

Subsequently, I encountered an issue where Wolf wouldn't start properly, and I quickly received the following error:

ERRO[0000] error waiting for container:
Error response from daemon: error gathering device information while adding custom device "/dev/nvidia-caps/nvidia-cap1": no such file or directory

To resolve this, I discovered that running the following command before launching the container helped:

sudo nvidia-container-cli --load-kmods info

With this command in place, I can successfully start the Wolf container without any issues, but this workaround is necessary after each computer restart. Upon restart, I need to execute the aforementioned command (the one with nvidia-container-cli) again.

To initiate the Wolf container after its initial installation, I utilize the following command:

docker start wolf -a

As detailed here: [https://github.com/games-on-whales/wolf/issues/38](), I also made modifications to /etc/wolf/wolf/config.toml to configure it for the initial launch like this:

[[apps]]
title = "Steam"
start_virtual_compositor = true

[apps.runner]
type = "docker"
name = "WolfSteam"
image = "ghcr.io/games-on-whales/steam:edge"
mounts = ["/run/udev:/run/udev:ro"]
env = [
"STEAM_STARTUP_FLAGS=-nogamepadui","PROTON_LOG=1","RUN_GAMESCOPE=true","GOW_REQUIRED_DEVICES=/dev/uinput /dev/input/event* /dev/dri/* /dev/nvidia*",
]
devices = []
ports = []
base_create_json = """
{
  "HostConfig": {
    "IpcMode": "host",
    "CapAdd": ["SYS_ADMIN", "SYS_NICE"],
    "Privileged": true
  }
}
\
"""

After successfully logging in, I only removed the "STEAM_STARTUP_FLAGS=-nogamepadui" from the file.

Now that the setup is operational, I'm able to connect to Wolf using Moonlight. Most applications work relatively well, although I haven't extensively explored them. The one application I'm particularly interested in is Steam, and that's where I encountered the issues I initially mentioned in this message.

I would also like to provide some logs, but I'm unsure where they might exist and where to locate them.

ABeltramo commented 10 months ago

Thanks to @Drakulix we should have fixed the issues with the Steam container, you can try it out by updating the steam container

docker pull ghcr.io/games-on-whales/steam:edge

and restarting Wolf.
There's no need for the Privileged: true flag and you should be able to see the new steam deck UI and even stream it to multiple clients.

Feel free to reopen this if it's not working for you.

Riebeck-one commented 10 months ago

Thank you very much! I'll try it tomorrow.

numfin commented 5 months ago

@Maxinova thank you.

@ABeltramo could you add this to documentation please? sudo nvidia-container-cli --load-kmods info