v17 [Solved] Missing power off and reboot options from power menu
#1
Hello all,

Software setup:
Slackaware 64-Current (4.4.32 kernel)
Kodi 17.1 (compiled using slackbuilds script)
starting kodi as standalone with "xinit /usr/bin/kodi-standalone -- -nocursor :0"

Problem: No power off and reboot options in the shutdown menu if i run kodi as normal user

Tried:
-if run as root, the options are there
-added my user to power group
-added the path to reboot and shutdown (/sbin/) to my $PATH
-added my user to sudoers to allow halt, reboot and poweroff

None worked, this didn't happend on Kodi 16 on the same setup, i was able to power off or reboot from the menu with my regular user.

Anyone has any idea what should I try next?

Thanks.
Reply
#2
Hi. Try change polkit-1 policiies for shutdown, reboot, hibernate and poweroff in /usr/share/polkit-1/actions/org.freedesktop.login1.policy

Change
Code:
<allow_any>auth_admin_keep</allow_any>
to
Code:
<allow_any>yes</allow_any>
Then reboot.
MediaCenter: Fractal Design Node 605/ASUS Maximus VI Extreme/i3-4170/nVidia GT1030x3@Deepcool V4000 Mod (Passive)/DD Cine v.6.5/Arch Linux Multiseat/Leia x 3/HP Media IR remote/T3-M Remote/Sony PS3 BD remote/PulseEight USB-CEC(AnyNet+)/3 LCDTV over HDMI/SONY MDR-HW700DS ;)
Reply
#3
see the polkit overrides in http://forum.kodi.tv/showthread.php?tid=231955
Reply
#4
Unfortunately I don't have this file on my system. I found a version of this file online and put it there and modified it, but still didn't work.

In my /usr/share/polkit-1/actions I only have the following files:
Code:
com.hp.hplip.policy
com.slackware.pkexec.gparted.policy
org.blueman.policy
org.freedesktop.NetworkManager.policy
org.freedesktop.consolekit.policy
org.freedesktop.policykit.policy
org.freedesktop.policykit.policy~
org.freedesktop.udisks.policy
org.freedesktop.udisks2.policy
org.freedesktop.upower.policy
org.freedesktop.upower.qos.policy
org.gnome.gconf.defaults.policy
org.kde.baloo.filewatch.policy
org.kde.fontinst.policy
org.kde.kalarmrtcwake.policy
org.kde.kcontrol.k3bsetup.policy
org.kde.kcontrol.kcmclock.policy
org.kde.kcontrol.kcmkdm.policy
org.kde.kcontrol.kcmkwallet.policy
org.kde.kcontrol.kcmremotewidgets.policy
org.kde.ksysguard.processlisthelper.policy
org.kde.nepomuk.filewatch.policy
org.kde.polkitkde1.policy
org.kde.powerdevil.backlighthelper.policy
org.kde.wicdclient.scripts.policy
org.x.xf86-video-intel.backlight-helper.policy
org.xfce.power.policy
org.xfce.session.policy
org.xfce.thunar.policy
but only the org.xfce.sesion.policy contains the shutdown part (Authentication is required to shutdown, restart, suspend, or hibernate the system)

I also have a /usr/share/polkit-1/rules.d/ maybe I can try to create here a file that will override the policy?

I'm sure this is only related to my distro.

I also found these: /etc/polkit-1/rules.d/ which contains 3 .rules files

Tried to create one .rules files, but still didn't help
Code:
polkit.addRule(function(action, subject) {
  if (action.id.indexOf("org.freedesktop.login1.power-off") == 0) {
    return polkit.Result.YES;
  }
});

polkit.addRule(function(action, subject) {
  if (action.id.indexOf("org.freedesktop.login1.reboot") == 0) {
    return polkit.Result.YES;
  }
});
Reply
#5
Finally solved my issue, but meanwhile switched to Win10 because of this, yes, I know, I'm a newb Smile

Actually, my distro (slackware) is using org.freedesktop.consolekit.policy to control power options. The freedesktop.login1 is used by other linux distributions.

To fix it, like BytEvil suggested first, you can change the policy found in /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy (for my system) and add the <allow_any>yes</allow_any> under system.stop and system.restart.

Or maybe a better sollution, like wsnipex suggested, you can actually create a polkit override in /etc/polkit-1/rules.d/30-kodi-power-options.rules with the following code:
Code:
polkit.addRule(function(action, subject) {
 if (action.id.indexOf("org.freedesktop.consolekit.system") == 0 &&
     subject.user=="kodi") {
     return polkit.Result.YES;
 }
});

Of course, "kodi" will be your user under you run Kodi, or you can change this to subject.isInGroup("users") or whatever group your username is member of.

I had all my answers right here under my nose, but I didn't know where to look Smile
(btw if no one suspects, I'm a newbie with linux)

Thanks guys for the help.
Reply
#6
my solution is to edit the polkit file for kodi and disable the Subject.user check:
for Arch Linux Arm you edit this file: /usr/share/polkit-1/rules.d/10-kodi.rules
xml:

polkit.addRule(function(action, subject) {
//    if (subject.user == "kodi") {
        polkit.log("action=" + action);
        polkit.log("subject=" + subject);
        if (action.id.indexOf("org.freedesktop.login1.") == 0) {
            return polkit.Result.YES;
        }
        if (action.id.indexOf("org.freedesktop.udisks.") == 0) {
            return polkit.Result.YES;
        }
        if (action.id.indexOf("org.freedesktop.upower.") == 0) {
            return polkit.Result.YES;
        }
//    }
});
Reply

Logout Mark Read Team Forum Stats Members Help
[Solved] Missing power off and reboot options from power menu0