The default settings for Raspbian seem to prevent Kodi from accessing the power-related functions it requires to shut down or reboot the system, causing its power menu to display only the ‘Exit’ option. This is particularly frustrating, as the default setup of Kodi is generally to run as the primary service on the system, so exiting Kodi merely causes it to restart, making powering off the system very difficult. Thankfully, there is a simple, albeit hard to find, solution.

## The solution

Kodi makes use of a number of different systems to control system power, autodetecting which one provides the most functionality on a given device. These systems are logind, UPower and ConsoleKit.

To enable access to these systems, create the /etc/polkit-1/localauthority/50-local.d/all_users_shutdown_reboot.pkla file as root with the following contents:

[Allow all users to shutdown and reboot]
Identity=unix-user:*
ResultActive=yes
ResultAny=yes
ResultInactive=yes


Then reboot, and hopefully, Kodi should now display the power down and reboot options in the power menu.

Note that this will allow all users to execute all logind, UPower and ConsoleKit system commands. For more fine-grained control, you could edit the Identity line to restrict this access to the user Kodi runs under, e.g. Identity=unix-user:kodi, and/or the Action line to specify which actions specifically are permitted. These actions are enumerated in the .policy files in /usr/share/polkit-1/actions.