mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5035] gamemoderun doesn't work with firejail #2860
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2860
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ademlabs on GitHub (Mar 11, 2022).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5035
With reference to the firejail and gamemoderun discussion, I tried running gamemoderun on glxgears instead of supertuxkart for testing.
I'm on EndeavourOS (Arch-based) running firejail version 0.9.68
In my
~/.config/firejail/supertuxcart.localfile I have added glxgears to the private-bin:Then I ran the command
Which produced the following output:
In a separate terminal window I checked
gamemoded -sbut it always gives meRunning
gamemoderun /usr/bin/glxgearswill work as expected though and I'll seegamemode is active.I'm not sure what next to check it seems this should just work with those config. Maybe dbus communication is not working as expected?
@rusty-snake commented on GitHub (Mar 11, 2022):
Typo in comment or in real filename?
@ademlabs commented on GitHub (Mar 11, 2022):
Yes, sorry there is a typo in comment, the file on disk is properly named
supertuxkart.local. In the output from firejail, it does load the correct file:@rusty-snake commented on GitHub (Mar 11, 2022):
Does it work if you comment
@ademlabs commented on GitHub (Mar 11, 2022):
No, I have the same result when commenting those lines.
I tried looking at the running processes.
glxgearsis currently running with PID 422074:I also checked for any
gamemodedlogs withjournalctl -n 5 _COMM=gamemoded:Seems gamemoded is not able to register the PID process, so I tried with a manual request as well:
And journalctl shows the same error again:
I'm not sure where the permission error is coming from, I'm running everything with the same user here.
@rusty-snake commented on GitHub (Mar 11, 2022):
If this is caused by the pid namespace, you can give up.
Does
firejail --noprofile gamemoderun …work?@ademlabs commented on GitHub (Mar 11, 2022):
Yes, it works with the
--noprofileoption.@rusty-snake commented on GitHub (Mar 11, 2022):
Can you confirm that
ignore norootworks.@ademlabs commented on GitHub (Mar 11, 2022):
Indeed, passing the --ignore=noroot option allows gamemode to run
Also, I noticed that whenever gamemode works correctly (with or without firejail), I have this line in my system logs for the
gamemodedservice:Not sure if this is related.
@ademlabs commented on GitHub (Mar 15, 2022):
Is there a way to debug this? I'm trying to understand why it doesn't work then
norootis specified.@rusty-snake commented on GitHub (Mar 19, 2022):
Does
unshare --map-current-user gamemoderun /usr/bin/glxgearswork?@ademlabs commented on GitHub (Mar 19, 2022):
Yes it works, gamemode is active when running
unshare --map-current-user ...@rusty-snake commented on GitHub (Mar 19, 2022):
Ok, so it's not caused by userns in general but instead by firejail's implementation. When I run
firejail --noprofile [--noroot] sleep 1mand comparels -l /proc/<PID of sleep>the difference is that the targets of thecwd,exeandrootsymlinks are only accessible for root but not for a regular user.Is this something we can change? @smitsohu
That's also the cause for flatpak/xdg-desktop-portal#737.
@smitsohu commented on GitHub (Mar 20, 2022):
Related: #3727 and possibly more.
What could be done on our end is creating the user namespace with user privileges where possible, falling back to root only if that fails.
@smitsohu commented on GitHub (Mar 20, 2022):
EDIT: This is broken because
@smitsohu commented on GitHub (Mar 20, 2022):
Also related: #4623
@inittux111 commented on GitHub (Mar 20, 2024):
I'm also running into this, except I am having this with the Steam profile. Once a solution has been made for this, will this also be applicable for using firejail with steam and gamemoderun, so that when you launch a game through Steam gamemode will be active when being used with firejail?
@ghost commented on GitHub (Mar 20, 2024):
@Hydranet
Hard to answer what will happen in the future. For now - almost two years later - the referenced issues haven't seen any progress. Have you tested/tried the suggested workaround yet? If not, here's an updated example for gamemoderun and steam with Firejail
0.9.72:After creating the above file, try running
firejail --profile=steam gamemoderun /usr/bin/steam.HTH
@inittux111 commented on GitHub (Mar 22, 2024):
@glitsj16 Thanks for your response!
I did try that when I do that I get the following error message.
Steam on Linux now requires the ability to create new user namespaces.
When I check those values on my system I get these.
@ghost commented on GitHub (Mar 22, 2024):
Not sure if that's really a 'new' requirement. I'd try to pin-point the offending line(s) in the steam profile to see what else it needs. Some 'possible candidates' are
noroot,nonewprivsandseccomp. The latter has a somewhat cryptic comment in the profile:3f4d6df041/etc/profile-m-z/steam.profile (L165-L169)You'll have to experiment a bit here.
@inittux111 commented on GitHub (Mar 22, 2024):
Thanks, I'll try experimenting with that and report back here if I get it to work.
@inittux111 commented on GitHub (Mar 22, 2024):
@glitsj16 I got it to work with
ignore noroot. I still hard the same errors when running this.firejail --profile=steam gamemoderun /usr/bin/steamHowever I figured this doesn't make sense because firejail launches Steam and then when Steam is started and you launch a game, Steam launch options launch gamemoderun. Then I tried
noroot,nonewprivsandseccomp. Seems only the first one is needed to get gamemoderun to work when launching a game from Steam. Thanks for your help! I'll remember to read the comments in the profiles if I run into something again and use and try overriding different settings with ignore in my local file if I run into something again. Thanks for your help!Just one question, since
ignore norootfixes it what doesnorootactually do with the sandbox so that I can maybe undestand why ignore that allows gamemoderun to be used by Steam when launching a game?@ghost commented on GitHub (Mar 22, 2024):
@Hydranet
Nice!
The
norootoption creates a user namespace containing only your current (unprivileged) user, so without the 'root' user. Most of the time that doesn't create any problems for the application being sandboxed and therefore is considered a 'plus' to enable in firejail profiles. In your Steam and gamemoderun combo though, the 'root' user needs to exist so Steam can actually handle the namespace switching. Now that might sound bad - root historically has 'danger' attached to it all over. But steam.profile still protects the sandbox via options likenogroupsand especiallynonewprivs+ seccomp filtering. The end result being an 'acceptable' balance between security and usability... Hope this helps clearing up some of the cryptics of the interaction between all the possible sandbox options firejail offers.In general it's a good thing to look at the content of the profiles. Agreed, it can take some time and effort to familiarize oneself with their syntax, structure etc. But after a while you'll be in a much better position to make the kind of
informed decisionson how to protect the system. Your comments suggest you're on the right track :-)Happy sandboxing!
@inittux111 commented on GitHub (Mar 22, 2024):
@glitsj16
Thanks for the explanation!
Thanks again for your help and thanks for Firejail!