[GUIDE] How to hibernate to a swap file in Linux Mint 19.x
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
I followed the above instructions and sometimes hibernate doesn't work really well. Most of the times I use hibernate I have to try 2-3 times to work because it tries to lock/wait for some processes. I lost the "Sleep" button. How I can reverse the changes and just use the sleep option?
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
That's curious, but if all you did was follow the guide then this will undo that:
Code: Select all
sudo rm -v /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
-
- Level 2
- Posts: 71
- Joined: Tue Mar 29, 2016 8:41 am
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
It worked! Thanks a lot. My previous laptop battery completely stopped working because I was always using suspend. Hopefully the next one will last me more than a year with hibernation because this one only lasted 231 days.
Operating System: Linux Mint 19.3
Kernel: Linux 5.0.0-32-generic
Architecture: x86-64
Operating System: Linux Mint 19.3
Kernel: Linux 5.0.0-32-generic
Architecture: x86-64
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
Really annoying that a desktop-oriented O.S. like Mint has made it so difficult to enable the hibernation feature!
This feature was in Mint 17 and 18, yesterday I installed 19 on my wife's netbook and it is missing.
Suspend to RAM isn't the same, it still consumes battery and for an old laptop it can make a difference. Especially because Linux "suspend to RAM" is not a hybrid suspension, which can restore the state from disk if the battery meanwhile has died.
I know that hibernation has always been problematic in Linux, but from my experience it is getting better with time. I think this is a step behind for Mint: if the problem is that it sometimes doesn't work reliably, a "disclaimer" would be a better choice to make the user informed and let him/her try (and hopefully use) all the same.
This feature was in Mint 17 and 18, yesterday I installed 19 on my wife's netbook and it is missing.
Suspend to RAM isn't the same, it still consumes battery and for an old laptop it can make a difference. Especially because Linux "suspend to RAM" is not a hybrid suspension, which can restore the state from disk if the battery meanwhile has died.
I know that hibernation has always been problematic in Linux, but from my experience it is getting better with time. I think this is a step behind for Mint: if the problem is that it sometimes doesn't work reliably, a "disclaimer" would be a better choice to make the user informed and let him/her try (and hopefully use) all the same.
- lonely_llama
- Level 3
- Posts: 128
- Joined: Mon Jul 22, 2019 12:08 am
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
After updating to kernel 4.15.0.91, and increasing my RAM from 4 to 12 GB, hibernation has stopped working. I use a BTRFS partition and had no problems until now.
I recreated the swap file exactly as instructed in this post (as I originally successfully had), with a size of 12 GB but after every reboot it fails to mount with the error that the swapfile has holes.
I have already tried creating the swapfile with fallocate as opposed to dd but it makes no difference. Is this a problem with the kernel, given that it does show that hibernation is supported?
I recreated the swap file exactly as instructed in this post (as I originally successfully had), with a size of 12 GB but after every reboot it fails to mount with the error that the swapfile has holes.
I have already tried creating the swapfile with fallocate as opposed to dd but it makes no difference. Is this a problem with the kernel, given that it does show that hibernation is supported?
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
Most complete and clear guide for hibernation. Worked flawlessly (for my Mint 19.3). Thank you so much!
-
- Level 4
- Posts: 359
- Joined: Thu Jun 24, 2010 2:22 pm
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
How do I disable this and revert hibernation back to using s2disk?
I made it work, thanks for the tutorial, but now I've realized I'd prefer to go back to hibernate to a partition.
Reason is, when I backup I don't have to store that huge file, and since I have 2 OSs in the computer I can use the swap partition on both of them (with the limitation of only being able to hibernate one OS at the time).
I've reverted most of the changes but it's still not 100% functional. The system can hibernate using s2disk on the terminal but when I choose the Hibernate button on the GUI the screen goes black for a second and then the system is back instead of initiating hibernation.
So...
- The swap partition is activated on /etc/fstab
- /etc/default/grub has been modified to use a partition instead of a file
- /etc/uswsusp.conf has been updated
- sudo update-grub has been ran
- sudo update-initramfs -u has been ran
- The system hibernates and resumes using s2disk on the terminal
So how can I reassign the Hibernate button to go back to s2ram? (my favorite Linux command)
Any hints? Thanks!
I made it work, thanks for the tutorial, but now I've realized I'd prefer to go back to hibernate to a partition.
Reason is, when I backup I don't have to store that huge file, and since I have 2 OSs in the computer I can use the swap partition on both of them (with the limitation of only being able to hibernate one OS at the time).
I've reverted most of the changes but it's still not 100% functional. The system can hibernate using s2disk on the terminal but when I choose the Hibernate button on the GUI the screen goes black for a second and then the system is back instead of initiating hibernation.
So...
- The swap partition is activated on /etc/fstab
- /etc/default/grub has been modified to use a partition instead of a file
- /etc/uswsusp.conf has been updated
- sudo update-grub has been ran
- sudo update-initramfs -u has been ran
- The system hibernates and resumes using s2disk on the terminal
So how can I reassign the Hibernate button to go back to s2ram? (my favorite Linux command)
Any hints? Thanks!
Bye for now,
Bruno
(Always backup before you screw up :)
Bruno
(Always backup before you screw up :)
- lonely_llama
- Level 3
- Posts: 128
- Joined: Mon Jul 22, 2019 12:08 am
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
Of course, hibernation is not advisable on SSD drives since it reduces the life span of the drives with the extra writings.
-
- Level 16
- Posts: 6054
- Joined: Mon Aug 27, 2012 10:17 pm
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
If you say so!Kadaitcha Man wrote: ⤴Tue Jun 23, 2020 5:38 amOf course, that's an old, outdated idea that no longer applies.
https://easylinuxtipsproject.blogspot.c ... .html#ID15Do NOT enable hibernation
15. Hibernation (suspend-to-disk) causes a huge amount of write actions, which is bad for an SSD. In Linux Mint and Ubuntu, it's disabled by default. Don't enable it! (item 10).
-
- Level 16
- Posts: 6054
- Joined: Mon Aug 27, 2012 10:17 pm
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
I do say so.asinoro wrote: ⤴Tue Jun 23, 2020 5:43 amIf you say so!Kadaitcha Man wrote: ⤴Tue Jun 23, 2020 5:38 amOf course, that's an old, outdated idea that no longer applies.
That's just some dude's opinion, and just because some dude said it on the internet it doesn't make it true.https://easylinuxtipsproject.blogspot.c ... .html#ID15Do NOT enable hibernation
15. Hibernation (suspend-to-disk) causes a huge amount of write actions, which is bad for an SSD. In Linux Mint and Ubuntu, it's disabled by default. Don't enable it! (item 10).
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
Let's see what a company advice and not just some dude!Kadaitcha Man wrote: ⤴Tue Jun 23, 2020 6:17 amI do say so.asinoro wrote: ⤴Tue Jun 23, 2020 5:43 amIf you say so!Kadaitcha Man wrote: ⤴Tue Jun 23, 2020 5:38 am
Of course, that's an old, outdated idea that no longer applies.
That's just some dude's opinion, and just because some dude said it on the internet it doesn't make it true.https://easylinuxtipsproject.blogspot.c ... .html#ID15Do NOT enable hibernation
15. Hibernation (suspend-to-disk) causes a huge amount of write actions, which is bad for an SSD. In Linux Mint and Ubuntu, it's disabled by default. Don't enable it! (item 10).
https://www.diskpart.com/ssd-management ... -0528.html
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
LMDE4 is not a desktop environment but Linux Mint based on Debian and not like the "mainstream" one based on Ubuntu. My question could then be rephrased to if this method works on Debian.lonely_llama wrote: ⤴Tue Jun 23, 2020 5:24 amIt doesn't matter what desktop environment you use since this has nothing to do with that.
- lonely_llama
- Level 3
- Posts: 128
- Joined: Mon Jul 22, 2019 12:08 am
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
I perfectly agree with you. Have been hibernating on a SSD for years on my desktop PC at work with neither problems nor any noticeable shortening of disk lifespan at all. These preconceptions coming from the first SSDs of dozen years ago are hard to eradicate.Kadaitcha Man wrote: ⤴Tue Jun 23, 2020 5:38 am Of course, that's an old, outdated idea that no longer applies.
Re: [GUIDE] How to hibernate to a swap file in Linux Mint 19.x
am a newbie but thanks so much for this guide
I am using linux to make an HP Stream 11 useful and have tried various distribiutions, I found Mint to be terrific but with a laptop being able to either hibernate or suspend is very useful. So after a week of trying to do that with Mint I gave up, and tried Linuxlite.... then I found your instructions and applied them in LL and they work so might head back to Mint
the main use for the stream 11 is to learn to use linux, as a test bed,
Anyway much kudos to you for your instructions!
I am using linux to make an HP Stream 11 useful and have tried various distribiutions, I found Mint to be terrific but with a laptop being able to either hibernate or suspend is very useful. So after a week of trying to do that with Mint I gave up, and tried Linuxlite.... then I found your instructions and applied them in LL and they work so might head back to Mint
the main use for the stream 11 is to learn to use linux, as a test bed,
Anyway much kudos to you for your instructions!