mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3758] library libgtk3-nocsd cannot be preloaded #2369
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#2369
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 @ghost on GitHub (Nov 17, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3758
Bug and expected behavior
I am trying to use https://github.com/PCMan/gtk3-nocsd to launch GTK3 applications. The library /usr/lib/libgtk3-nocsd.so.0 is added to LD_PRELOAD. It seems that there are problems with this library and firejail.
Out of firejail
It works. For example:
gtk3-nocsd nautilusgtk3-nocsd evincegtk3-nocsd remminaFirejail without a profile
Even without a profile, some applications fail.
firejail --noprofile gtk3-nocsd nautilus: it works.firejail --noprofile gtk3-nocsd evince: It fails.ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.firejail --noprofile gtk3-nocsd remmina: It fails.ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.Environment
lsb_release -a,screenfetchorcat /etc/os-release)firejail --version) exclusive or used git commit (git rev-parse HEAD)@ghost commented on GitHub (Nov 18, 2020):
@chrpinedo Hi, I have installed gtk3-nocsd from the AUR to see if I can reproduce.
(1) Do you use the gtk3-nocsd package from the AUR or do you build it from https://github.com/PCMan/gtk3-nocsd? I ask because the AUR package uses a forked git repo. Just so we can establish some baseline for communication/testing things in this context, I would recommend installing gtk3-nocsd from the AUR if you haven't.
(2) I cannot reproduce your
--noprofileobservations and I have in fact been succesful in using a firejailed evince with gtk3-nocsd (see below). Commands to test stuff with --noprofile better use full paths, to avoid potential clashes with symlinks in /usr/local/bin (put there byfirecfgfor example). So, can you redo these commands and report back please:private-bin,private-etcandprivate-libare to be accounted for in .local overrides. LD_PRELOAD and gtk3-nocsd (a shell script using specific commands) depend on having access to things that might not be available in the default firejail profiles.Let me provide an example for
evinceto clarify all this. /usr/bin/gtk3-nocsd is ashellscript. To work as expected it needs access to your shell and to any other command it references (basename, grep, readlink and which). The evince.profile has options in this regard that will need attention:For me running
firejail --profile=evince gtk3-nocsd /usr/bin/evinceworks with the below evince.local:Can you test on your side if any of this improves your attempt to use gtk3-nocsd please? There are other things you could do (like adding env GTK_CSD=0 to your globals.local instead of per affected profile), but let's start as simply as possible for now.
@ghost commented on GitHub (Nov 18, 2020):
@glitsj16 you got a great improvement! :-)
In fact, I was able to run the following commands with the idea of not using the "gtk3-nocsd" command:
I prefer this approach, because the idea would be to use the application and depending on the environment variables to be able to have window decorators or not. In fact, the AUR packages comes with
/etc/X11/xinit/xinitrc.d/30-gtk3-nocsd.shscript, which creates GTK_CSD and LD_PRELOAD env variables only if GNOME desktop environment is not in use.I don't know, if it would be possible to "whitelist" GTK_CSD and LD_PRELOAD environment variables so that firejail could get it from parent process instead of setting them statically in the profile.
firejail --profile=evince gtk3-nocsd /usr/bin/evinceI would prefer to executefirejail evinceby getting GTK_CSD and LD_PRELOAD variables preferably from parent process and including a profile of whilested bins/libs...The
~/.config/firejail/evince.profileseems to be no sufficient becausefirejail evinceis launched with CSD and I get the errorERROR: ld.so: object '/usr/bin/libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored..@ghost commented on GitHub (Nov 19, 2020):
For the above 'logic' to work you need to have that profile named ~/.config/firejail/evince.
local, NOT ~/.config/firejail/evince.profile.Okay, I did some more testing and came up with a slightly different approach. It involves creating a 'non-GNOME' firejail profile and a shell script that needs to be in your $PATH before /usr/local/bin and /usr/bin, e.g. in ~/bin.
$ cat ~/.config/firejail/evince-non-gnome.profile
$ cat ~/bin/evince
After creating both files you can launch evince from the CLI by running
evinceand it will automagically run sandboxed and with/without window decorators depending on the env vars you pointed to. For testing you can set the _sbox_mode var toverboseso you can see exactly which profiles firejail is loading.Just to avoid confusion, for
remminayou will have to create a specific ~/.config/firejail/remmina-non-gnome.profile.@ghost commented on GitHub (Nov 21, 2020):
Just only to know, why is so different to put the file in my ~/.config/firejail directory from /etc/firejail/*.local. I normally use the first one, because I think is more clear: they are my customizations I want for my linux user.
This solution is quite smart! I modified your script to be used as a wrapper by all the "non-gnome" applications I want to configure without CSD:
$ cat ~/bin/firejail-gtk3-nocsdSo, now to add a new application without CSD for my i3wm desktop I have to do (an example with shortwave GTK3 application):
shortwave-non-gnome.profileln -s ~/bin/firejail-gtk3-nocsd ~/bin/shortwaveI am quite happy for this solution! Thanks glitsj16, I couldn't have gotten to this solution without your help.
Regards!
@ghost commented on GitHub (Nov 21, 2020):
Nice script. Good to hear you have a working solution. I'll close this, but feel free to reopen if you have more questions. Take care!
@rusty-snake commented on GitHub (Nov 21, 2020):
@glitsj16 was talking about to use a *.local instead of *.profile and not about using /etc/firejail instead of ~/.config/firejail.
@ssokolow commented on GitHub (Mar 26, 2022):
For anyone who wanders in off a search engine looking to fix this on a machine where GNOME isn't even installed (and thus, being conditional isn't a concern), here's what I tossed into
/etc/firejail/evince.localto restore Evince to the behaviour I get without Firejail: