Hibernating openSUSE 13.2 (Harlequin)

openSUSE 13.2

I had some trouble to get hibernate (suspend to disk with power off) to work properly on openSUSE 13.2. You can find the problems that I ran into and how I solved them below.

Getting a Boot Menu

Since a while, Linux systems try to hide the fact that they’re Linux. You switch the PC on and after a few seconds, you see a desktop. I hate that. So the first step is to get the boot menu back. Edit /etc/default/grub and look for GRUB_TIMEOUT. It’s 0 now, set it 8:

...
GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT=8
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=8
...

Note: You can’t use YaST for this. YaST can only modify GRUB_HIDDEN_TIMEOUT which is not very useful IMO.

After making these changes, run grub2-mkconfig as explained at the top of /etc/default/grub to update Grub 2’s configuration.

See also: GRUB Manual 2.00: Simple configuration

Authorize Hibernate

If you tend to get this dialog when you try to hibernate:

Legitimierung ist zum Aktivieren des Ruhezustands des Systems notwendig, während andere Benutzer angemeldet sind. – PolicyKit1-KDE_016

then someone else is logged in. In my case, I sometimes have a root shell lying around somewhere or an SSH session. There are two solutions to this problem:

  1. Hibernate. Wait. Realize that the system won’t hibernate. Log in again. Find the error dialog. Close it. Find the root shell. Log out root. Try again. Don’t forget to mumble curses all the time since it’s 2:00am and you want to go to bed instead of fighting a security policy.
  2. Tell polkit that if the user in front of the display wants to hibernate, then simply do it!

To do the second, edit the file /etc/polkit-default-privs.local and append this line:

org.freedesktop.login1.hibernate-multiple-sessions auth_self:auth_self:yes

After making the change, you need to run /sbin/set_polkit_default_privs to activate the changes; no reboot or relog necessary.

The first word in the line is the operation, the second one is the permissions. The default for *.hibernate-multiple-sessions is auth_admin:auth_admin:yes which means “ask for root privileges” which makes sense for a server or a shared PC where people connect remotely. auth_self means “Authentication by the owner of the session that the client originates from is required” which should be good enough for any standalone/private PC.

Related: Polkit man page

Hibernate KDE With a Single Click

Something that I’m missing since a long time is a way to hibernate a KDE desktop at the push of a button. Options from worst to best:

  1. Open the start menu. Try to navigate to the shutdown options without accidentally closing the menu. Wonder which of the options is the right one for the millionth time. Click and hope for the best.
  2. Open a root shell, keep it open at all times and run the command /usr/sbin/pm-hibernate
  3. Use KShutdown
  4. Allow yourself to execute the command /usr/sbin/pm-hibernate via sudo without asking for a password. Put sudo /usr/sbin/pm-hibernate into a script and wrap the script with an icon on the desktop.
  5. Issue the hibernate command via shell script and wrap the script with an icon on the desktop.

Options #1 is too cumbersome. #2 wastes too many resources. #3 isn’t standard and I’ve found it increasingly difficult to find the binary for my system. #4 doesn’t lock your screen so anyone able to turn on your computer can mess with it.

So here is how to do #5. First, we need a shell script$HOME/bin/hibernate with this content:

#!/bin/bash
dbus-send \
  --session \
  --dest=org.freedesktop.PowerManagement \
  --type=method_call \
  /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Hibernate

How let’s create a button for the script:

  1. Make the script executable with chmod +x $HOME/bin/hibernate
  2. Right click on the desktop, add applet “Folder View” (German: “Ordner”).
  3. Create a new folder $HOME/Hibernate and select this new folder in the settings. That gives you a small window on the desktop that you can size and move – perfect to position our button.
  4. Right click in the new window and create a shortcut for a program.
  5. Enter “Hibernate” as name on the first tab.
  6. On the program tab, select the script.
  7. Click OK.
  8. Open the properties for the new shortcut.
  9. Click the icon to replace it.
  10. In the new dialog, select “Actions” and search for “hib” which should offer you “system-suspend-hibernate” Click the icon to select it.
  11. Click OK
  12. Size and move the folder view to have the button where you want it.

3 Responses to Hibernating openSUSE 13.2 (Harlequin)

  1. Zoidberg says:

    This fixed my hibernation problem, Thanks a lot

  2. David Perez says:

    Another easy solutuion is to go to the KDE control panel, and in the Keyboard Shortcuts section, go to Global section and set a keyboard shurtcut for Hibernate. That easy!

  3. Enno says:

    Thank you very much, I desperately looked for this setting to stop the waste of energy on a multi-user computer due to the inhibited hibernation.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.