Doesn't show pkexec window when called from a keyboard shortcut

I’ve got a script that does pkexec some-other-script that does some edits in the systemd unit files and calls systemctl daemon-reload; systemctl restart docker.

The password prompt of pkexec doesn’t show up when I set the script to run from a keyboard shortcut. Works fine when running from terminal.

I need pkexec to get rid of double password prompt because of the daemon-reload.

Wouldn’t mind to not have a prompt at all, but it seems that the suid bit is broken too (that on is probably intentionally).

Can you just konsole --noclose -e pkexec some-other-script?

There have been some still fairly recent changes to the way polkit works, which allows the polkit authentication helper to run without the SUID bit set. However, this will not work with kernels older than 6.12 LTS.

Ok, the bug is that’s not possible to edit the command after the addition: you change the command, press “Save”, close the settings and the shortcut calls the old one. Reopen the settings, see the gibberish you’ve entered when changing the command.

That’s not a bug in pkexec; it’s a bug in your script.

Anything run via pkexec operates in an entirely different environment, with elevated privileges. So you need to account for that in your script by calling the “systemctl daemon-reload” command from within the environment with the elevated privileges.