I’ve been messing around with it and I think I have somewhat of an understanding of what is going on (I’m not an expert, so make sure to do your own research (specifically the suid and bwrap)):
Bubblewrap is the main program that handles creating the environment that steam runs in. It ensures all files are symlinked in the right place and that games can be ran.
When you set capSysNice
to true, bwrap
(bubblewrap) gets wrapped with suid and gamescope
gets wrapped with capabilities = 'cap_sys_nice+pie'
.
So, launching steam sets the bwrap
process as root
, with the knowledge it’s running under your user. Launching gamescope from within steam requires launching it within bwrap
, which right now is root
. bwrap
by default strips capabilites and so gamescope can’t renice itself (failed to inherit capabilities:...
), so you have to add the argument --cap-add ALL
(ALL
is probably a bit much, but I didn’t spend time trying to figure out exactly which permissions it needs). The problem is bwrap
won’t let you do this because of suid bit (don’t want to be able to escalate permissions). We run into this error.
I was able to get steam-run gamescope
to launch correctly when I removed the suid from bwrap
and manually added --cap-add ALL
to the steam-run
script. I think you can do this with extending extraBwrapArgs
for the steam packages.
security.wrappers.bwrap.setuid = lib.mkForce false;
The problem is I now get this error (probably related?):
vkCreateDevice failed with a high-priority queue (general + compute). Falling back to regular priority (general).
vkCreateDevice failed with a high-priority queue (compute). Falling back to regular priority (all).
The other issue is that when doing the same process for steam
it fails to launch because of this error:
steam-runtime-check-requirements[1035377]: W: Child process exited with code 1: bwrap: Unexpected capabilities but not setuid, old file caps config?
Somehow capabilities would need to be cleared from within steam somewhere. I tried messing around a bit with launching the game like (and not modifying steam
):
bwrap --cap-add ALL --dev-bind / / gamescope -- %command%
But that didn’t work (Unexpected capabilities but not setuid, old file caps config?
).
Hope that this can help someone understand this stuff better or get a better grasp at what needs to be solved.
Further reading: