[SOLVED] Running pkexec in terminal works but not in Alt-F2
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
[SOLVED] Running pkexec in terminal works but not in Alt-F2
Hi guys,
I open terminal, type "pkexec synaptic", I am prompted to enter password, then synaptic opens. No problem.
I press Alt-F2, type "pkexec synaptic", nothing happens.
I press Alt-F2, type "synaptic", Synaptic opens but without administrative privileges.
My system:
Kernel: 4.15.0-20-generic x86_64 bits: 64
Desktop: Cinnamon 3.8.8 Distro: Linux Mint 19 Tara
1. gksu is no longer supported in all versions, correct? Pkexec is the replacement? Is it the only alternative to the discontinued gksu?
2. Any solution to my problem of not being able to execute pkexec via Alt-F2 ?
Thank you very much!
I open terminal, type "pkexec synaptic", I am prompted to enter password, then synaptic opens. No problem.
I press Alt-F2, type "pkexec synaptic", nothing happens.
I press Alt-F2, type "synaptic", Synaptic opens but without administrative privileges.
My system:
Kernel: 4.15.0-20-generic x86_64 bits: 64
Desktop: Cinnamon 3.8.8 Distro: Linux Mint 19 Tara
1. gksu is no longer supported in all versions, correct? Pkexec is the replacement? Is it the only alternative to the discontinued gksu?
2. Any solution to my problem of not being able to execute pkexec via Alt-F2 ?
Thank you very much!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Running pkexec in terminal works but not in Alt-F2
Press Alt-F2 then type "synaptic-pkexec" instead.I press Alt-F2, type "pkexec synaptic", nothing happens.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Re: Running pkexec in terminal works but not in Alt-F2
That worked, thank you. But how come it does not work with nemo?
Alt-F2 -> nemo-pkexec results in:
Failed to execute child process "nemo-pkexec"
pkexec nemo does not work either, but no error message. Alt_F2 window just disappears.
Thank you.
Alt-F2 -> nemo-pkexec results in:
Failed to execute child process "nemo-pkexec"
pkexec nemo does not work either, but no error message. Alt_F2 window just disappears.
Thank you.
Re: Running pkexec in terminal works but not in Alt-F2
Welcome to the wacky world of Linux on the Desktop.
You just can't willy nilly run pkexec as if it were a replacement for gksu. That would make far too much sense. Instead for every application that you want to use pkexec it's inventor imagined that a Policykit "policy" be created that allows the end user to use it. In the case of synaptic the rule is here:
One wasn't created for nemo. The only desktop Linux I personally know of that made the effort to make it usable for it's default file manager ( Thunar ) and text editor ( mousepad ) is Xubuntu.
You can create your own "policy" for nemo if you wish or you can run it this way:
Or you can follow this thread for 516 other ways to do it: viewtopic.php?f=61&t=268140
You just can't willy nilly run pkexec as if it were a replacement for gksu. That would make far too much sense. Instead for every application that you want to use pkexec it's inventor imagined that a Policykit "policy" be created that allows the end user to use it. In the case of synaptic the rule is here:
/usr/share/polkit-1/actions/com.ubuntu.pkexec.synaptic.policy
One wasn't created for nemo. The only desktop Linux I personally know of that made the effort to make it usable for it's default file manager ( Thunar ) and text editor ( mousepad ) is Xubuntu.
You can create your own "policy" for nemo if you wish or you can run it this way:
Code: Select all
nemo admin:///
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Re: Running pkexec in terminal works but not in Alt-F2
@altair4 what?
@OP: Don't worry about the policy stuff mentioned above, it's not relevant. I tried what you described in a Cinnamon live environment and seems this is a bug with Cinnamon. Somebody should check in the LM19.1 Cinnamon beta and if it's still broken it needs a bug report. In the meantime just use a terminal window. Or another desktop environment, works fine in MATE.
You can also create your own gksudo:
Reload Cinnamon or relog, then you can prefix that instead of pkexec. Interestingly that one works, wonder what they did that pkexec doesn't.
@OP: Don't worry about the policy stuff mentioned above, it's not relevant. I tried what you described in a Cinnamon live environment and seems this is a bug with Cinnamon. Somebody should check in the LM19.1 Cinnamon beta and if it's still broken it needs a bug report. In the meantime just use a terminal window. Or another desktop environment, works fine in MATE.
You can also create your own gksudo:
Code: Select all
mkdir -p ~/.local/bin
echo -e '#!/bin/sh\n/usr/bin/pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY HOME=$HOME "$@"' > ~/.local/bin/gksudo
chmod u+x ~/.local/bin/gksudo
Re: Running pkexec in terminal works but not in Alt-F2
Please note: This is a thought experiment that got totally out of control. I'm not recommending that you or anyone else do this. I just wanted to see if it worked.
Had another look at this and I was thinking that synaptic had the same disease that nemo has but they went to a Doctor so I:
Copied the synaptic-pkexec bin to a nemo-pkexec bin:
Code: Select all
sudo cp -a /usr/bin/synaptic-pkexec /usr/bin/nemo-pkexec
Code: Select all
sudo nano /usr/bin/nemo-pkexec
To this:pkexec "/usr/sbin/synaptic" "$@"
Code: Select all
pkexec "/usr/bin/nemo" "$@"
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Re: Running pkexec in terminal works but not in Alt-F2
Sure that works, it's basically the same as my (more flexible)
gksudo
replacement suggestion above. I don't know why Cinnamon fails with a direct pkexec command line, maybe they even block it intentionally.Re: Running pkexec in terminal works but not in Alt-F2
if you ended up here because 19.1 broke all your launchers that used gksu then this answer provided above and repeated here was the best/simpliest solution (for me). The new launcher flags gksu and doesn't allow you to preface any command with it. But this `gksudo` or whatever you want to call it is accepted and will get the familiar behavior (launcher that launches the app as root). This was critical for launching things like gnome-disks. I probably post this under a new title so it can be found easier.
Reload Cinnamon or relog, then you can prefix that instead of pkexec. Interestingly that one works, wonder what they did that pkexec doesn't.
Code: Select all
mkdir -p ~/.local/bin
echo -e '#!/bin/sh\n/usr/bin/pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY HOME=$HOME "$@"' > ~/.local/bin/gksudo
chmod u+x ~/.local/bin/gksudo
Re: Running pkexec in terminal works but not in Alt-F2
The three lines of code to create gksudo works.
Thanks very much guys.
I'll label the title as solved.
Thanks very much guys.
I'll label the title as solved.
Re: Running pkexec in terminal works but not in Alt-F2
You are welcome. It's still just a workaround. The Alt+F2 issue will be properly fixed in the upcoming LM19.1 point-release.
Re: Running pkexec in terminal works but not in Alt-F2
It will make pkexec work like you originally tried, yes. The usual limitations with pkexec remain.
The "real" gksudo is gone and won't be coming back, but if you're referring to my workaround above, that will still work.
-
- Level 3
- Posts: 187
- Joined: Wed Aug 14, 2019 1:23 pm
Re: [SOLVED] Running pkexec in terminal works but not in Alt-F2
Is anyone finding that, since some recent updates, alt-2 `pkexec timeshift` (for example) produces an authentication box but does not actually run the program?
I've reverted sudo and dbus - both of which got upgrades recently - but it doesn't seem to have fixed the problem.
I've reverted sudo and dbus - both of which got upgrades recently - but it doesn't seem to have fixed the problem.
- smurphos
- Level 18
- Posts: 8498
- Joined: Fri Sep 05, 2014 12:18 am
- Location: Irish Brit in Portugal
- Contact:
Re: [SOLVED] Running pkexec in terminal works but not in Alt-F2
Wrong command - for timeshift GUI you should be running the below which is working fine.BeyondLies_MintForum wrote: ⤴Mon Feb 03, 2020 10:53 pm Is anyone finding that, since some recent updates, alt-2 `pkexec timeshift` (for example) produces an authentication box but does not actually run the program?
I've reverted sudo and dbus - both of which got upgrades recently - but it doesn't seem to have fixed the problem.
Code: Select all
pkexec timeshift-gtk
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
-
- Level 3
- Posts: 187
- Joined: Wed Aug 14, 2019 1:23 pm
Re: [SOLVED] Running pkexec in terminal works but not in Alt-F2
> Wrong command
Ah yes. Apologies. However, on one of my Mint machines, `pkexec timeshift-gtk` works in the terminal but not in the alt-F2 prompt. And the same for `pkexec synaptic`. However, on another Mint machine, all is as it should be. Perhaps I have messed up a file permission somewhere.
EDIT: Actually, everything works, on both machines, when I use the default alt-F2 program (I had changed it, because of bugs with the default program) and when I do not use Ulauncher. On one machine, but not another, using Ulauncher (to run e.g. `pkexec timeshift-gtk` or `pkexec mintsources`) has no result and on the other machine, it works. SOLVED: in fstab, I had added - as a security precaution - `noexec` - to tmpfs. Removing that fixed the problem.
Ah yes. Apologies. However, on one of my Mint machines, `pkexec timeshift-gtk` works in the terminal but not in the alt-F2 prompt. And the same for `pkexec synaptic`. However, on another Mint machine, all is as it should be. Perhaps I have messed up a file permission somewhere.
EDIT: Actually, everything works, on both machines, when I use the default alt-F2 program (I had changed it, because of bugs with the default program) and when I do not use Ulauncher. On one machine, but not another, using Ulauncher (to run e.g. `pkexec timeshift-gtk` or `pkexec mintsources`) has no result and on the other machine, it works. SOLVED: in fstab, I had added - as a security precaution - `noexec` - to tmpfs. Removing that fixed the problem.