Can't launch games using gamescope

I feel like I’m dumb and can’t figure out how to get this working, and I also don’t see anyone complaining about it either, so if this has been answered then I apologize for asking this again, but I couldn’t find an answer to this.

I just can’t run games on steam using gamescope -- %command%

I’ve been trying to troubleshoot this with a somewhat simple script to give me a log of what’s happening, and I just get this error:

failed to inherit capabilities: Operation not permitted

I also have another simple script to start steam with gamescope and bigpicture, and that works just fine, but there are some issues which I think are more related to gamescope and Nvidia not playing nice, so I’d like to be able to launch games through steam using gamescope.

I have read some of the threads about various problems with Gamescope in NixOS, and I think I’ve tried everything, but so far nothing worked.

This is all the settings I’ve set for either steam or gamescope:

config
programs = {
	steam = {
		enable = true;
		remotePlay.openFirewall = true; 
		dedicatedServer.openFirewall = true; 
		localNetworkGameTransfers.openFirewall = true; 
	};

	gamescope = {
		enable = true;
		capSysNice = true;
	};
};

My question is: has this been solved ? or is it one of those problems that have no solutions ? or am I dumb ? cause that’s always an option too.

I’ve added the scripts down at the bottom so you guys can check it out

logging script
#!/usr/bin/env bash

log() {
	logger -t mygamescope "$*"
	echo "$*"
}

read_log() {
	while IFS= read -r line ; do 
		log "$line"
		echo "$line"
	done
	if [ -n "$line" ] ; then
		log "$line"
		echo "$line"
	fi
}

cleanup() {
	log "stopping"
}

trap cleanup EXIT

source "/home/cyberdruga/.local/bin/env"

log "starting"

log "arguments: " "$(printf '%q ' "$@")"


gamescope_args=(
	--backend wayland
	--expose-wayland
	--adaptive-sync
)

log "which gamescope: " "$(which gamescope)"

gamescope "${gamescope_args[@]}" -- "$@" |& read_log

Steam With Gamescope script
#!/usr/bin/env bash

NO_REBOOT=

while [[ -n "$1" ]] ; do
	case "$1" in
		--no-reboot)
			NO_REBOOT=true
			;;
	esac
	shift
done


pgrep -x steam && steam -shutdown

echo "killing Steam..."
while pgrep -x steam > /dev/null  ; do
	sleep .5 ;
done 

gamescope_args=(
	# --force-grab-cursor
	# --backend wayland
	--steam
	-b
	-h 1080
)

steam_args=(
	-tenfoot
	# -bigpicture
)

gamescope "${gamescope_args[@]}" -- steam "${steam_args[@]}"

[ -z "$NO_REBOOT" ] && steam > /dev/null &

disown

Yeah, this is a known issue (though it’s closed for some reason, it hasn’t actually been fixed): Gamescope cannot be used to launch Steam games · Issue #351516 · NixOS/nixpkgs · GitHub

Remove:

As an aside, you shouldn’t set any of these options either:

They are, respectively:

  • A firewall port for streaming games
    • Ok, maybe you actually use this feature
  • A firewall port for hosting dedicated CS2 servers
    • You definitely don’t do this
  • A firewall port for allowing other PCs in the network to download games from this machine instead of valve’s servers
    • You probably don’t do this
2 Likes

Yeah, I’ve disabled the capSysNice like you told me, and now I’m getting the same-ish errors as those guys in that github thread.

Hopefully this will get fixed one day.

Here’s the logs I’m getting now, in case it helps in any way:

Output Log Gamescope with no args
ERROR: ld.so: object '/home/cyberdruga/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/cyberdruga/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
[gamescope] [Info]  console: gamescope version 3.16.17 (gcc 14.3.0)
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
[gamescope] [Info]  scriptmgr: Loading scripts from: '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts'
[gamescope] [Info]  scriptmgr: Loading scripts from: '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope'
[gamescope] [Info]  scriptmgr: Loading scripts from: '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/common'
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/common/inspect.lua' (id: 0)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/common/modegen.lua' (id: 1)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/common/util.lua' (id: 2)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays'
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/asus.rogally.lcd.lua' (id: 3)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/deckhd.steamdeck.deckhd-lcd.lua' (id: 4)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/gpd.win4.lcd.lua' (id: 5)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/lenovo.legiongo.lcd.lua' (id: 6)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/lenovo.legiongos.lcd.lua' (id: 7)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/valve.steamdeck.lcd.lua' (id: 8)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/valve.steamdeck.oled.lua' (id: 9)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/etc/gamescope/scripts'
[gamescope] [Warn]  scriptmgr: Directory '/etc/gamescope/scripts' does not exist
[gamescope] [Info]  scriptmgr: Loading scripts from: '/home/cyberdruga/.config/gamescope/scripts'
[gamescope] [Warn]  scriptmgr: Directory '/home/cyberdruga/.config/gamescope/scripts' does not exist
wp_color_manager_v1#20: error 0: Windows scRGB is not supported
libdecor-gtk-WARNING: Could not get required globals
Failed to load plugin 'libdecor-gtk.so': failed to init
libdecor-cairo-WARNING: Could not get required globals
Failed to load plugin 'libdecor-cairo.so': failed to init
No plugins found, falling back on no decorations
Authorization required, but no authorization protocol specified

ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
[gamescope] [Info]  vulkan: selecting physical device 'Intel(R) Iris(R) Xe Graphics (ADL GT2)': queue family 0 (general queue family 0)
[gamescope] [Info]  vulkan: physical device supports DRM format modifiers
Fossilize INFO: Overriding serialization path: "/home/cyberdruga/.local/share/Steam/steamapps/shadercache/3489700/fozpipelinesv6/steamapprun_pipeline_cache".
[gamescope] [Info]  wlserver: [backend/headless/backend.c:67] Creating headless backend
[gamescope] [Error] xdg_backend: Couldn't create Wayland input objects.
[gamescope] [Error] xdg_backend: Failed to initialize input thread
terminate called without an active exception
Output Log gamescope --backend sdl
ERROR: ld.so: object '/home/cyberdruga/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/cyberdruga/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/cyberdruga/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
[gamescope] [Info]  console: gamescope version 3.16.17 (gcc 14.3.0)
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
[gamescope] [Info]  scriptmgr: Loading scripts from: '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts'
[gamescope] [Info]  scriptmgr: Loading scripts from: '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope'
[gamescope] [Info]  scriptmgr: Loading scripts from: '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/common'
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/common/inspect.lua' (id: 0)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/common/modegen.lua' (id: 1)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/common/util.lua' (id: 2)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays'
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/asus.rogally.lcd.lua' (id: 3)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/deckhd.steamdeck.deckhd-lcd.lua' (id: 4)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/gpd.win4.lcd.lua' (id: 5)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/lenovo.legiongo.lcd.lua' (id: 6)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/lenovo.legiongos.lcd.lua' (id: 7)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/valve.steamdeck.lcd.lua' (id: 8)
[gamescope] [Info]  scriptmgr: Running script file '/nix/store/lp9rjnlqp6pm3w8dnyb0f8wf95hbgdjf-gamescope-3.16.17/share/gamescope/scripts/00-gamescope/displays/valve.steamdeck.oled.lua' (id: 9)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/etc/gamescope/scripts'
[gamescope] [Warn]  scriptmgr: Directory '/etc/gamescope/scripts' does not exist
[gamescope] [Info]  scriptmgr: Loading scripts from: '/home/cyberdruga/.config/gamescope/scripts'
[gamescope] [Warn]  scriptmgr: Directory '/home/cyberdruga/.config/gamescope/scripts' does not exist
terminate called without an active exception

Nah, that looks more like gamescope is running “fine”, it just immediately exits. It should work perfectly fine with capSysNice disabled.

You should set at least the window resolution. Something like:

{
  programs = {
    steam.enable = true;

    gamescope = {
      enable = true;

      args = [
        "--output-width 1920"
        "--output-height 1080"
        "--fullscreen"

        # Without this, gamescope will automatically attempt to scale
        # windows that are rendered at lower resolutions.
        #
        # This is particularly annoying for launchers.
        "--max-scale 1"

        # Ensure that games continue rendering, albeit at a low
        # framerate, even when unfocused. This is required due to
        # xwayland bugs; many games will lose network connection and
        # such if they don't tick regularly.
        "--nested-unfocused-refresh 30"
      ];
    };
  };
}

I’m still getting the same output, so I guess it’s a steam + gamescope issue.

At least launching steam inside gamescope still works.