Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I recently installed the new Fedora 18, LXDE spin on a workstation (not a laptop).

I want to disable the hibernate and suspend functions, and remove them from the "Logout" menu in the UI.

In F17 and earlier, this was easily done by adding a file /etc/polkit-1/localauthority/50-local.d/50-disable-suspend.pkla with the contents:

[Disable Suspend]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate;org.freedesktop.upower.suspend
ResultAny=no
ResultInactive=no
ResultActive=no

Doing so would remove the menu entries, leaving Logout, Reboot, Shutdown and Cancel.

I also found instructions to modify the file /usr/share/polkit-1/actions/org.freedesktop.upower.policy, changing two values to:

<allow_active>no</allow_active>

Neither works for F-18.

The problem with the latter approach for F17 and earlier was that the file might be overwritten when upower is updated, but even that would be acceptable.

Removing pm-utils also seemed ideal, but I can't remove pm-utils because libvirt indirectly depends on it.

Has anyone figured this out?

share|improve this question
add comment

2 Answers

According to the man page:

The polkit Local Authority no longer exists. Existing configuration files are honored; see pkla-admin-identities(8) and pkla-check-authorization(8) for description of the configuration format.

I'm pretty sure "existing configuration files are honored" is a lie.

The Arch Linux wiki page for Polkit shows a new way:

The following rule disables suspend and hibernate for all users.

/etc/polkit-1/rules.d/10-disable-suspend.rules

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.suspend" ||
        action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
        action.id == "org.freedesktop.login1.hibernate" ||
        action.id == "org.freedesktop.login1.hibernate-multiple-sessions") {
        return polkit.Result.NO;
    }
});

That rule works for me on Fedora 19.

share|improve this answer
add comment

The problem with the latter approach for F17 and earlier was that the file might be overwritten when upower is updated, but even that would be acceptable.

U can protect those files from overwriting by setting 'i' attribute (chattr +i /path/to/file), doing this as root of course.

share|improve this answer
    
If editing that file achieved the desired end for F18, this would be an option. Alas, it does not work. –  Matthew Lundberg Jan 20 '13 at 21:57
    
Ok, if you don't need hiberbate and susnend - just remove "pm-utils" from system, and those items will be gone. –  Sloan Jan 20 '13 at 23:54
    
I considered that. libvirt depends on it (via libvirt-client) so that is a no-go. It also wants to remove lxde-common which doesn't look very helpful. I'll edit the question to indicate this. –  Matthew Lundberg Jan 21 '13 at 0:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.