I`m unable to disable suspend and hibernate

Hi. This example from wiki doesnt work for me anymore.
https://wiki.archlinux.org/index.php/Polkit#Disable_suspend_and_hibernate

It was still working a monts or two ago. I know it was a working solution in july. But now i have freshly installed stable xfce edition (20.2) in my virtualbox, and this trick didnt work for me. I still can send my virtualbox to suspend.

Isn’t that a different functionality as the suspend functionality of an OS inside the VM?

1 Like

Thank you for you answer.

Well, it is possible - I`m unable to test it on real hardware now. But there was visible GUI changes in OS when this solution was working: there was no option to select system sleep mode in System tab of XFCE Power Mager. Now this solution doesnt work for me and I still can choose sleep mode type. So i doubt it is a VM related issue.

Can you check it on a real hardware? Its just one file and you can delete it after testing without any consequences.

Was just about to create that file until i noticed this:

/etc/polkit-1/rules.d/99-manjaro.rules
polkit.addRule(function(action, subject) {
    if (action.id.indexOf("org.freedesktop.udisks2.") == 0 && subject.isInGroup("wheel")) {
        return polkit.Result.YES;
    }
});

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.power-off" ||
        action.id == "org.freedesktop.login1.reboot" ||
        action.id == "org.freedesktop.login1.hibernate" ||
        action.id == "org.freedesktop.login1.suspend") {
        return polkit.Result.YES;
    }
});

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.upower.hibernate" ||
        action.id == "org.freedesktop.upower.suspend") {
        return polkit.Result.YES;
    }
});

/* Allow users of network group to use blueman feature requiring root without authentication */
polkit.addRule(function(action, subject) {
    if ((action.id == "org.blueman.network.setup" ||
         action.id == "org.blueman.dhcp.client" ||
         action.id == "org.blueman.rfkill.setstate" ||
         action.id == "org.blueman.pppd.pppconnect") &&
        subject.isInGroup("network")) {
        return polkit.Result.YES;
    }
});

The rules in there could be causing it, because they are applied later as that file.
(alphabetical sort order)

1 Like

Yes, I saw it too, but when i deleted all suspend and hibernation lines from rules - nothing changes for me eather.

BTW, does 99-manjaro.rules should have more priority than 10-disable-suspend.rules?

Oh. I see. I was thinking than 99 and 10 was a “priority”.

File like that with numbers in front are named like that to give a sequence number, so higher numbered ones will be used after the lower ones, so will override.

I will test in few, i need to reboot anyhow…

1 Like

Thank you =)

I didn’t even need to reboot, after i added that file with it’s contents, without editing the other file:
The options to suspend/hibernate disappeared from my “logout” GUI menu…
BRB after a reboot with this file active…


@kodirovshchik
Ok seems the option in the GUI is still missing after a reboot.
I had to completely reboot again after i removed that file for the change to take effect again.
So it’s IMHO just a config that will show/remove the option in the GUI’s, but not the functionality in the systemd units…
When you choose to suspend your VM, it must be issuing the suspend action via ACPI.
So i suggest to look into that part of your system :wink:

1 Like

OMG. Thank you for you help. I checked all my actions one more time it was totally my mistake.

I store all “tweaks” in my google keep. And this is how it was recorded in my notes:

##
##sudo nano /etc/polkit-1/rules.d/10-disable-all.rules
##
polkit.addRule(function(action, subject) { ...
});

And I was copy/paste all lines in a new file. First three “##” lines too. And it doesnt work when they are here. I just deleted “##” lines and all works fine =) Thank you for your time.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.