Saturday, November 9, 2019

Ubuntu 19.10 & Kodi - How to remove shutdown/restart etc. from exit menu

I recently upgraded my HTPC to Ubuntu 19.10 and a bunch of stuff was broken. (typical).

I had to figure out how to remove the shutdown/restart etc. options from the exit menu of Kodi. I also had a problem that the power button on remote caused machine to shutdown and power off!

Disabling Shutdown, Restart etc. was accomplished by help of PolicyKit. We simply have to define policy file which disables these actions by users. (this obviously won't effect these operations being executed from shell)

Into /etc/polkit-1/localauthority/50-local.d/disable-shutdown.pkla file, added:

[Disable shutdown etc.]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=no
ResultInactive=no
ResultActive=no


You can restart it by issuing sudo systemctl restart polkit

Now, disabling the power button on remote is accomplished by editing /etc/systemd/logind.conf and adding the following line HandlePowerKey=ignore. Then you should restart systemd-logind by issuing sudo systemctl restart systemd-logind

Hopefully this would have resolved the issue for you also. Good luck!

No comments:

Post a Comment