Enabling hibernation in Linux Mint 20.2

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
gabbo
Level 1
Level 1
Posts: 25
Joined: Tue Oct 04, 2016 4:50 pm

Enabling hibernation in Linux Mint 20.2

Post by gabbo »

Hi,
I'm trying to configure my new PC with Linux Mint 20.2.
I'd like to enable hibernation (as I had in my previous Linux Mint PC). I have tried to run sudo pm-hibernate as a test, but it restarted afterwards normally and without the few programs I had open, even though it did a bit of flickering before shutting down (as the old pc would do).
I currently have 16 Gb of RAM and a 17.8 Gb swap partition in order to allocate all the RAM.
How could I make it work?
Thanks!
Adam_Halverson
Level 1
Level 1
Posts: 4
Joined: Sat Aug 28, 2021 11:37 am

Re: Enabling hibernation in Linux Mint 20.2

Post by Adam_Halverson »

gabbo wrote: Sun Sep 26, 2021 8:35 am Hi,
I'm trying to configure my new PC with Linux Mint 20.2.
I'd like to enable hibernation (as I had in my previous Linux Mint PC). I have tried to run sudo pm-hibernate as a test, but it restarted afterwards normally and without the few programs I had open, even though it did a bit of flickering before shutting down (as the old pc would do).
I currently have 16 Gb of RAM and a 17.8 Gb swap partition in order to allocate all the RAM.
How could I make it work?
Thanks!
I was just looking for the solution to this problem myself, and just discovered the solution.

First of all, you will want to resize the swap partition to double the size of your RAM (in this case, 32 GB or 34,359,738,368 bytes), so that hibernation can safely suspend to RAM.

Second, make sure Secure Boot is disabled in your BIOS settings.

Third, open the command line (terminal), and type in the following:

sudo -i

(Type in your password)

Code: Select all

echo -e "[Enable hibernate in upower]\nIdentity=unix-user:*\nAction=org.freedesktop.upower.hibernate\nResultActive=yes\n\n[Enable hibernate in logind]\nIdentity=unix-user:*\nAction=org.freedesktop.login1.hibernate\nResultActive=yes" >> /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pkla
Next, close that terminal window, and open up a new terminal window. Type in the following:

inxi -u

Copy the 'uuid' value of your swap partition to somewhere - you're going to need that later on.

Next:

sudo -i

(Type in your password)

xed /etc/default/grub

This will open up the text editor for the 'grub' file.

Look for the line of text that says
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Now, you're going to need to paste the 'uuid' value from earlier. Change that line of text within the 'grub' file to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=PASTE THE UUID VALUE HERE"
Save the 'grub' file, and close the text editor.

Finally, in a new terminal window, type in the following:

sudo update-grub

(Type in your password)

After that, restart your computer, and then make sure hibernate works properly thereafter.
Last edited by SMG on Thu Oct 21, 2021 9:18 pm, edited 1 time in total.
Reason: c tags are for short code snippets. It is better to put long lines of code in code tags.
User avatar
7rocks
Level 1
Level 1
Posts: 23
Joined: Fri Mar 30, 2018 5:13 am
Contact:

Re: Enabling hibernation in Linux Mint 20.2

Post by 7rocks »

This worked fantastically.
I had tried using a swapfile on the same partition which failed.
The separate swap partition worked straight away.

Thank you.

Added this howto to:
https://7rocks.com/downloads/manual_tos ... ge_X30L_J/
---------------
Dion
andreamoro
Level 1
Level 1
Posts: 15
Joined: Sat Oct 16, 2021 1:44 pm

Re: Enabling hibernation in Linux Mint 20.2

Post by andreamoro »

Just curious ... what does that long line starting with the echo?
It seems it is writing to a file, but that is not the /etc/systemd/logind.conf where I would expect this sort of configuration to take place?
gabbo
Level 1
Level 1
Posts: 25
Joined: Tue Oct 04, 2016 4:50 pm

Re: Enabling hibernation in Linux Mint 20.2

Post by gabbo »

Adam_Halverson wrote: Mon Sep 27, 2021 8:00 am
gabbo wrote: Sun Sep 26, 2021 8:35 am Hi,
I'm trying to configure my new PC with Linux Mint 20.2.
I'd like to enable hibernation (as I had in my previous Linux Mint PC). I have tried to run sudo pm-hibernate as a test, but it restarted afterwards normally and without the few programs I had open, even though it did a bit of flickering before shutting down (as the old pc would do).
I currently have 16 Gb of RAM and a 17.8 Gb swap partition in order to allocate all the RAM.
How could I make it work?
Thanks!
I was just looking for the solution to this problem myself, and just discovered the solution.

First of all, you will want to resize the swap partition to double the size of your RAM (in this case, 32 GB or 34,359,738,368 bytes), so that hibernation can safely suspend to RAM.

Second, make sure Secure Boot is disabled in your BIOS settings.

Third, open the command line (terminal), and type in the following:

sudo -i

(Type in your password)

echo -e "[Enable hibernate in upower]\nIdentity=unix-user:*\nAction=org.freedesktop.upower.hibernate\nResultActive=yes\n\n[Enable hibernate in logind]\nIdentity=unix-user:*\nAction=org.freedesktop.login1.hibernate\nResultActive=yes" >> /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pkla

Next, close that terminal window, and open up a new terminal window. Type in the following:

inxi -u

Copy the 'uuid' value of your swap partition to somewhere - you're going to need that later on.

Next:

sudo -i

(Type in your password)

xed /etc/default/grub

This will open up the text editor for the 'grub' file.

Look for the line of text that says
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Now, you're going to need to paste the 'uuid' value from earlier. Change that line of text within the 'grub' file to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=PASTE THE UUID VALUE HERE"
Save the 'grub' file, and close the text editor.

Finally, in a new terminal window, type in the following:

sudo update-grub

(Type in your password)

After that, restart your computer, and then make sure hibernate works properly thereafter.
Hi,
Sorry but I managed to try this only now. I've followed the instructions and the "Hibernate" button appeared in the interface, but when using it the system still did not restart with the hibernated session, even down at shutdown the screen flickered in the way I was used to with the previous PC.
Should I upload any logs to see what's the issue?
Thanks you!
User avatar
SMG
Level 25
Level 25
Posts: 31792
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Enabling hibernation in Linux Mint 20.2

Post by SMG »

gabbo wrote: Thu Oct 21, 2021 8:25 am Hi,
Sorry but I managed to try this only now. I've followed the instructions and the "Hibernate" button appeared in the interface, but when using it the system still did not restart with the hibernated session, even down at shutdown the screen flickered in the way I was used to with the previous PC.
Should I upload any logs to see what's the issue?
Thanks you!
It appears you were given information for hibernating to a swap partition. These instructions How to enable hibernation with swap partition on Linux Mint 19 have also worked for others using LM20. You can compare the steps you took to it to help troubleshoot your issue.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
SMG
Level 25
Level 25
Posts: 31792
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Enabling hibernation in Linux Mint 20.2

Post by SMG »

Moderator note: kjbinst suggestion for changing the product has been moved to a new topic Enabling hibernation in Linux Mint in the Suggestions & Feedback section of the forum.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
firestomper41
Level 1
Level 1
Posts: 40
Joined: Thu Jan 06, 2011 7:41 am

Re: Enabling hibernation in Linux Mint 20.2

Post by firestomper41 »

Hi, when i try this procdure i get as far as the command inxi -u and it just gives me this error Error 10: Unsupported value: missing required option(s) -j, -o, -p, -P for option: -l/-u
Check -h for correct parameters.

What do i need to do to proceed?
User avatar
SMG
Level 25
Level 25
Posts: 31792
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Enabling hibernation in Linux Mint 20.2

Post by SMG »

firestomper41 wrote: Sun Oct 16, 2022 2:16 amWhat do i need to do to proceed?
Please create a new topic for your issue. The tutorials for hibernation (which also work on LM20 version) are:
How to enable hibernation with swap partition on Linux Mint 19

[GUIDE] How to hibernate to a swap file in Linux Mint 19.x

Locking this old topic.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
Locked

Return to “Hardware Support”