ValveSoftware / steam-runtime

A runtime environment for Steam applications
Other
1.17k stars 86 forks source link

cs2.sh no longer executes custom bash commands. #622

Closed DexyStorm closed 8 months ago

DexyStorm commented 9 months ago

Your system information

OS: Arch Linux Kernel: 6.5.5-zen1-1-zen Nvidia Drivers: nvidia-dkms-535.113.01-2 CPU: AMD Ryzen 5 5600x GPU: Nvidia 2070 Super RAM: 32gb 3200mhz Mobo: X570 Gaming Plus

Please describe your issue in as much detail as possible:

Describe what you expected should happen and what did happen. Please link any large pastes as a Github Gist. Back when I played CS:GO I made a custom monitor resolution in 4:3 with 1440x1080 in my csgo.sh https://gist.github.com/DexyStorm/2f12a87e9f9738c5aa9ab4cd4c83b8a7 (look at the gist, its in line 3) and at the end I had another command to reset my monitors resolution to its normal 16:9 1920x1080 (gist in line 102). But now when I do this in the cs2.sh it no longer executes the commands. In fact, it doesnt execute any commands. I have also tried it with sudo and I have also tried a simpler command like reboot.

Steps for reproducing this issue:

  1. Download CS2
  2. Add any bash command to your cs2.sh
  3. Launch CS2 and notice that the bash command did not get executed
kisak-valve commented 9 months ago

Hello @DexyStorm, Counter-Strike 2 is run in the Steam Linux Runtime 3.0 (Sniper) container environment, and that container does not have unlimited access to the host system's filesystem. It's likely that the script you're calling is not being mounted into the container.

Give #470 a read for a similar scenario.

DexyStorm commented 9 months ago

Hi @kisak-valve, thank you for your help, but I am very clueless about a lot of stuff so I was not able to fix the problem (i know that this is not a support website, but i dont know where else to ask because nobody else knows what to do and I am very sorry about that). I've tried adding these lines as launch argument (like you suggested in #470),

STEAM_COMPAT_MOUNTS=/ %command%
STEAM_COMPAT_MOUNTS=/bin %command%
STEAM_COMPAT_MOUNTS=/usr/bin %command% 
STEAM_COMPAT_MOUNTS=/usr/sbin %command% 
STEAM_COMPAT_MOUNTS=/sbin %command% 
STEAM_COMPAT_MOUNTS=/bin/bash %command%
STEAM_COMPAT_MOUNTS=/bin/nvidia-settings %command% 
STEAM_COMPAT_MOUNTS=/home/dexystorm/.local/share/Steam/steamapps/common/Counter-Strike Global Offensive/game/ %command%

but sometimes the game didnt even start at all and other times the game did start but the commands didnt execute just like in the problem that I described earlier depending on which launch command i chose.

Here is the output when I run the game: https://gist.github.com/DexyStorm/8cb95f92cf07fd86a66db35a75e33b84 I've found that in line 20 it says /home/dexystorm/.local/share/Steam/steamapps/common/Counter-Strike Global Offensive/game/cs2.sh: line 3: nvidia-settings: command not found and I dont know how I can make it find the command. You said that I need to add the STEAM_COMPAT_MOUNTS but I cant figure it out.

I should also maybe add that I have CS2 installed on the same drive as root and my home folder (/home/dexystorm) is not a seperate partition.

mabt commented 9 months ago

I'm facing the same problem trying to enable the game debuger :

cs2.sh : GAME_DEBUGGER="strace -f -o strace.log"

Launching the game : ...cs2.sh: line 112: strace: command not found

$ whereis strace strace: /usr/bin/strace

If anyone has a solution?

smcv commented 8 months ago

Add any bash command to your cs2.sh

Sorry, modifying any game file is not a supported thing to do.

nvidia-settings: command not found

nvidia-settings does not exist inside the container environment that is now used to run games like CS2.

However, there is a better way to do this: you can run commands before entering the container environment, and after leaving it.

For example, if you save this in $HOME/.local/share/my-cs2-wrapper.sh, and make it executable with chmod 0755 ~/.local/share/my-cs2-wrapper.sh:

#!/bin/sh
set -eu

xmessage "This command is run before CS2"

status=0
"$@" || status=$?

xmessage "This command is run after CS2 exited with status $status"

exit "$status"

and then set CS2's launch options to:

~/.local/share/my-cs2-wrapper.sh %command%

then the two xmessage commands will be run before and after CS2. Unlike cs2.sh, they will be run outside the container, with access to all the commands on your normal system, including nvidia-settings: so for instance you could replace the xmessage commands with a line that runs nvidia-settings.

Running custom commands like this is not a supportable thing to do, so you do this at your own risk, and you should remove those custom launch options before reporting bugs.

(Technical detail: the line that starts with "$@" will start the container, run the game, wait for the game to exit, and clean up the container, before returning control to your script. If you do something similar for a Proton game, it will also start up and shut down Proton inside the container.)