Apparently, the order of /bin and /usr/bin in PATH matters! I was getting failures for multiple apps started from LinuxMint's Menu: mintsources, lightdm-settings, etc. Eventually I tracked it down to the fact that I had /bin:/usr/bin in my PATH (created by my shell profile) rather than /usr/bin:/bin. Once I modified my shell profile, and switched the order of those components in my PATH, and rebooted, the GUI apps started working.
Desired behaviour
Both command lines (see below) should work identically and successfully. Currently, the order of /usr/bin:/bin in PATH is required for apps to work and the order of /bin:/usr/bin causes them to fail. The order shouldn't matter.
For other OSes (where mintsources is not available), you can reproduce with any GUI app requiring use of pkexec and configured in a location like /usr/share/polkit-1/actions/, with an annotation like:
(Note: /usr/bin/mintsources, rather than /bin/mintsources)
It looks like this is a bug with pkexec and/or the polkit mechanism: pkexec doesn't fully resolve (canonicalize) the path to the executable, a la readlink -f /bin/mintsources, before matching it against the path in the policy. The pkexec documentation says full path of the program where I think it should say canonical full path of the program.
Reproducer
$ ls -ld /bin
lrwxrwxrwx 1 root root 7 Jun 28 2022 /bin -> usr/bin
$ pkexec /usr/bin/mintsources
...GUI prompt for password, then GUI app appears and works...
$ pkexec /bin/mintsources
...GUI prompt for password, then...
(mintSources.py:3926): Gtk-CRITICAL **: 08:24:53.938: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
(mintSources.py:3926): Gtk-CRITICAL **: 08:24:53.938: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
(mintSources.py:3926): Gtk-CRITICAL **: 08:24:53.938: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
...ABORTS (no GUI app appears)...
In GitLab by @jrw32982 on Mar 23, 2023, 19:58
Current behaviour, description of the problem
Apparently, the order of
/bin
and/usr/bin
inPATH
matters! I was getting failures for multiple apps started from LinuxMint's Menu: mintsources, lightdm-settings, etc. Eventually I tracked it down to the fact that I had/bin:/usr/bin
in myPATH
(created by my shell profile) rather than/usr/bin:/bin
. Once I modified my shell profile, and switched the order of those components in my PATH, and rebooted, the GUI apps started working.Desired behaviour
Both command lines (see below) should work identically and successfully. Currently, the order of
/usr/bin:/bin
inPATH
is required for apps to work and the order of/bin:/usr/bin
causes them to fail. The order shouldn't matter.For other OSes (where
mintsources
is not available), you can reproduce with any GUI app requiring use ofpkexec
and configured in a location like/usr/share/polkit-1/actions/
, with an annotation like:(Note:
/usr/bin/mintsources
, rather than/bin/mintsources
)It looks like this is a bug with
pkexec
and/or the polkit mechanism:pkexec
doesn't fully resolve (canonicalize) the path to the executable, a lareadlink -f /bin/mintsources
, before matching it against the path in the policy. Thepkexec
documentation saysfull path of the program
where I think it should saycanonical full path of the program
.Reproducer
Detailed description
polkit 0-105.33, pkexec 0-105-33, LinuxMint 21
See more discussion and bug confirmation at Github LinuxMint Cinnamon and LinuxMint forum