Turn off / Disable hibernate completely!

This is a wiki post! Anyone can edit this to improve the contents!

This tutorial is to ensure you correctly turn off hibernation completely. You need to do this in 3 places in that order:

1. systemd

Create the following files:

  • /etc/systemd/sleep.conf.d/no-hibernate.conf

    • Add:

      [Sleep]
      # disable hibernation
      # doc : https://archived.forum.manjaro.org/t/turn-off-disable-hibernate-completely/139939
      AllowHibernation=no
      AllowHybridSleep=no
      AllowSuspendThenHibernate=no
      
  • /etc/systemd/logind.conf.d/no-hibernate.conf

    • Add:

      [login]
      # disable hibernation
      HibernateKeyIgnoreInhibited=no
      
  • Save and exit all

  • Test:

    sudo systemctl hibernate
    

    should fail with:

    Failed to hibernate system via logind: Sleep verb "hibernate" not supported
    
    I'm a N00b! I don't know how to to this: give me more help!

    Don't worry! :slight_smile: Here is an example for the first file:

    1. Execute:

      sudo mkdir /etc/systemd/sleep.conf.d/
      sudo mkdir /etc/systemd/logind.conf.d/
      # If the above give: "mkdir: cannot create directory: File exists" that's OK!
      sudo nano --backup /etc/systemd/sleep.conf.d/no-hibernate.conf
      
    2. copy-paste the following text in there:

      [Sleep]
      # disable hibernation
      # doc : https://archived.forum.manjaro.org/t/turn-off-disable-hibernate-completely/139939
      AllowHibernation=no
      AllowHybridSleep=no
      AllowSuspendThenHibernate=no
      
    3. Ctrl+X, then Y and Enter to save.

    4. Repeat for each of the files in the section above.

2. Desktop Environment
  • In KDE:

    Details
    1. Go to System settings:
    2. Type hibernate
    3. Click Energy Saving: and remove any traces of Hibernate and change it to Sleep or Shutdown
      2020-05-02_14-37
      Do this for all 3 tabs!:
      • On AC Power
      • On Battery
      • On Low Battery
    4. Hibernation also happens when your battery reaches critical condition during sleep, so click Advanced settings:
      2020-05-02_14-16
      and change that to Shutdown as well.
  • In Gnome:

    Details

    Adapt your gnome-shell extension to remove hibernate from the options.

  • In XFCE:

    Details
    • Sorry! Not running XFCE myself:
      • Try the KDE section
      • takes notes while you do it on XFCE and come back and edit this post for the next XFCE user or leave a response below and I'll edit it in.
3. Kernel
  • Change the /etc/default/grub:GRUB_CMDLINE_LINUX_DEFAULT and remove the resume=UUID= parameter.

  • Remove the resume item from the HOOKS= line in /etc/mkinitcpio.conf and perform a sudo mkinitcpio --allpresets

    I'm a N00b! I don't know how to to this: give me more help!

    Don't worry! :slight_smile: /etc/default/grub:GRUB_CMDLINE_LINUX_DEFAULT just means there is a file /etc/default/grub which contains the word GRUB_CMDLINE_LINUX_DEFAULT and that you need to change it!

    1. Execute:

      sudo nano --backup /etc/default/grub
      
    2. Press Ctrl+W to start searching

    3. Type GRUB_CMDLINE_LINUX_DEFAULTEnter

    4. You'll now see:

      GRUB_CMDLINE_LINUX_DEFAULT=
      
    5. with a whole bunch of :poop: behind it all separated by spaces. :wink:

    6. You're looking for resume=UUID=SomeWeirdNumberCalledAGUID

    7. Before you do the next step, ensure there is at least one space left between the previous and next parameter.

    8. Remove resume=UUID=SomeWeirdNumberCalledAGUID and maximum one space!

    9. Verify again there is at least one space left before and after each parameter in that line or your computer will not boot any more! . If you're unsure at this stage, press Ctrl+X then press N and try again at step 1

    10. You're sure??? Well, then press Ctrl+X then press Y and Enter to save.

    11. Execute:

      sudo update-grub
      

    For mkinitcpio:

    1. sudo nano --backup /etc/mkinitcpio.conf

    2. Start the search functionality by pressing Ctrl+W (Meaning: Where is?) and type HOOKS= and Enter

    3. You will now see a line that has the word resume in it: remove that word and if you don't see that word, just exit without saving by pressing Ctrl+X

    4. If you did find and remove the word, save and exit by Ctrl+X Y Enter and execute:

      sudo mkinitcpio --allpresets
      

So you've done all the above in one session?

  • Reboot

  • Final test:

    sudo systemctl suspend
    

Which should still suspend your system but non hibernate it!

6 Likes

is not a good idea to modify /etc/systemd/*.conf in rolling : at each systemd update, we have to manage .pacnew

we can override our conf with only some keys and one file per job, for example :
/etc/systemd/sleep.conf.d/no-hibernate.conf

[Sleep]
# disable hibernation
# doc : https://archived.forum.manjaro.org/t/turn-off-disable-hibernate-completely/139939
AllowHibernation=no
AllowHybridSleep=no
AllowSuspendThenHibernate=no

/etc/systemd/logind.conf.d/no-hibernate.conf

[login]
# disable hibernation
HibernateKeyIgnoreInhibited=no

And it's good to comment! 2 years later it is impossible to know why we made this change :wink:

2 Likes

Thanks for the feed-back!

:hugs:

You mean like in the last edit?

Another excellent tutorial, well done!

There are some issues with the formatting. Please check your markdown.

1 Like

A suggestion:

Directories
/etc/systemd/sleep.conf.d
/etc/systemd/logind.conf.d
may not exist by default. Perhaps add sudo mkdir ... to the N00b section? :slight_smile:

Also, shouldn't login.conf be actually logind.conf? :thinking:

1 Like

Thank you for the in-depth proof-read...

It's a directory, so login.conf.d is a valid syntax, unless I missed something else???

:scream:

I think it needs to be logind instead of login.

/etc/systemd/logind.conf.d/no-hibernate.conf
                  ^

I could be mistaken, but that's how it is named on my system:

/etc/systemd🐸 ls                                                                         
logind.conf.d  system         journald.conf        logind.conf    resolved.conf  timesyncd.conf
network        user           journal-remote.conf  networkd.conf  sleep.conf     user.conf
sleep.conf.d   coredump.conf  journal-upload.conf  pstore.conf    system.conf

Also, there should probably be sudo update-grub step after editing /etc/default/grub.

2 Likes

update-grub only added to N00b section. :smiling_imp: :wink:

1 Like

@Fabby: Your procedure works great on my Manjaro GNOME system.

In the systemd section you might want to add the following test at the end:

$ sudo systemctl hibernate

If it fails with the following error message then you're good:

Failed to hibernate system via logind: Sleep verb "hibernate" not supported

Might also want to try

$ sudo systemctl suspend

to make sure suspend didn't get broken.

Vanilla GNOME doesn't have a hibernate option. People use gnome-shell extensions to add that functionality. I haven't installed one to see if it gets blocked.

Thank you for your tutorial, although reading through my journalctl logs and seeing how much has to happen flawlessly during a suspend/resume cycle was kind of frightening. :nerd_face:

1 Like

Thank you for the positive feed-back. All incorporated!

If you find a mistake, feel free to edit yourself as I'm:

:zzz: :bed: :first_quarter_moon_with_face:

Can you explain why you need ALL 3 methods and not only one of them, please?

:thinking:
You mean in the heading of the tutorial?

The only thing I did:

/etc/systemd/sleep.conf
AllowHibernation=no
AllowSuspendThenHibernate=no

REBOOT

and hibernation was gone (KDE here).

:arrow_up: Working.

Yes, that's the only important step. The other two are more of a "let's be thorough, just in case".

1 Like

Forum kindly sponsored by