How can I hibernate on Ubuntu 16.04?

Clash Royale CLAN TAG#URR8PPP up vote
59
down vote
favorite
How should I successfully hibernate Ubuntu 16.04?
I've tried almost every solution on the web but non of them was actually helpful.
I found my problem almost completely similar to this one
16.04 hibernate
 |Â
show 2 more comments
up vote
59
down vote
favorite
How should I successfully hibernate Ubuntu 16.04?
I've tried almost every solution on the web but non of them was actually helpful.
I found my problem almost completely similar to this one
16.04 hibernate
2
Possible duplicate of How to enable hibernation?
â DJCrashdummy
Jul 31 '16 at 16:20
Doessudo pm-hibernatework?
â Pilot6
Aug 1 '16 at 9:01
2
hasn't the situation changed with systemd? now we are meant to usesystemctl hibernateso perhaps not a dupe... or at least updated answer may be required to make the old question valid to dupe
â Zanna
Aug 1 '16 at 21:03
What kernel version are you running? Typeuname -rin the terminal (apologies if you already knew this).
â WinEunuuchs2Unix
Sep 2 '16 at 1:47
please edit your question and add the output offreeso we can determine if you have enough swap setup to successfully hibernate.
â Elder Geek
Sep 4 '16 at 18:15
 |Â
show 2 more comments
up vote
59
down vote
favorite
up vote
59
down vote
favorite
How should I successfully hibernate Ubuntu 16.04?
I've tried almost every solution on the web but non of them was actually helpful.
I found my problem almost completely similar to this one
16.04 hibernate
How should I successfully hibernate Ubuntu 16.04?
I've tried almost every solution on the web but non of them was actually helpful.
I found my problem almost completely similar to this one
16.04 hibernate
16.04 hibernate
edited Apr 13 '17 at 12:24
Communityâ¦
1
1
asked May 5 '16 at 19:01
Mahyar
396146
396146
2
Possible duplicate of How to enable hibernation?
â DJCrashdummy
Jul 31 '16 at 16:20
Doessudo pm-hibernatework?
â Pilot6
Aug 1 '16 at 9:01
2
hasn't the situation changed with systemd? now we are meant to usesystemctl hibernateso perhaps not a dupe... or at least updated answer may be required to make the old question valid to dupe
â Zanna
Aug 1 '16 at 21:03
What kernel version are you running? Typeuname -rin the terminal (apologies if you already knew this).
â WinEunuuchs2Unix
Sep 2 '16 at 1:47
please edit your question and add the output offreeso we can determine if you have enough swap setup to successfully hibernate.
â Elder Geek
Sep 4 '16 at 18:15
 |Â
show 2 more comments
2
Possible duplicate of How to enable hibernation?
â DJCrashdummy
Jul 31 '16 at 16:20
Doessudo pm-hibernatework?
â Pilot6
Aug 1 '16 at 9:01
2
hasn't the situation changed with systemd? now we are meant to usesystemctl hibernateso perhaps not a dupe... or at least updated answer may be required to make the old question valid to dupe
â Zanna
Aug 1 '16 at 21:03
What kernel version are you running? Typeuname -rin the terminal (apologies if you already knew this).
â WinEunuuchs2Unix
Sep 2 '16 at 1:47
please edit your question and add the output offreeso we can determine if you have enough swap setup to successfully hibernate.
â Elder Geek
Sep 4 '16 at 18:15
2
2
Possible duplicate of How to enable hibernation?
â DJCrashdummy
Jul 31 '16 at 16:20
Possible duplicate of How to enable hibernation?
â DJCrashdummy
Jul 31 '16 at 16:20
Does
sudo pm-hibernate work?â Pilot6
Aug 1 '16 at 9:01
Does
sudo pm-hibernate work?â Pilot6
Aug 1 '16 at 9:01
2
2
hasn't the situation changed with systemd? now we are meant to use
systemctl hibernate so perhaps not a dupe... or at least updated answer may be required to make the old question valid to dupeâ Zanna
Aug 1 '16 at 21:03
hasn't the situation changed with systemd? now we are meant to use
systemctl hibernate so perhaps not a dupe... or at least updated answer may be required to make the old question valid to dupeâ Zanna
Aug 1 '16 at 21:03
What kernel version are you running? Type
uname -r in the terminal (apologies if you already knew this).â WinEunuuchs2Unix
Sep 2 '16 at 1:47
What kernel version are you running? Type
uname -r in the terminal (apologies if you already knew this).â WinEunuuchs2Unix
Sep 2 '16 at 1:47
please edit your question and add the output of
free so we can determine if you have enough swap setup to successfully hibernate.â Elder Geek
Sep 4 '16 at 18:15
please edit your question and add the output of
free so we can determine if you have enough swap setup to successfully hibernate.â Elder Geek
Sep 4 '16 at 18:15
 |Â
show 2 more comments
9 Answers
9
active
oldest
votes
up vote
48
down vote
You can use
sudo pm-hibernate
to check if hibernate works on your system (this will hibernate your computer).
If it does not work , check if your swap size is at least as large as your RAM.
To add the option to the settings menu, you can create a configuration file. Open a terminal window and run this command:
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
It opens nano with an empty file. Copy the lines below and paste them into the nano window.
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes
Then save the changes and close nano and reboot the system to make Hibernate available appear on "Power options".
Reference: How do I hibernate my computer? in the official documentation for Ubuntu 16.04.
Hope it works. This worked for me after trying all other options.
We need a reboot after editing the file to make Hibernate available appear on "Power options".
â Jus12
Jan 15 '17 at 7:30
12
'sudo pm-hibernate' killed my system immediately without warning. You should tell people that's what's going to happen.
â Yair Daon
Jun 9 '17 at 1:27
best answer . This also working on 17.4 and 17.10 as well .
â Saurabh Bhandari
Sep 23 '17 at 11:40
1
This answer combined with the one telling to add "resume=" to the GRUB_CMDLINE_LINUX_DEFAULT did solve it for me - thx!
â Christoph
Nov 3 '17 at 15:21
I have 17GB in my swap partition and 16GB of RAM, why is it not working? It seems to be hibernating because it takes forever to turn off the computer whereas if I do "shutdown" it turns off almost immediately. But when I turn my computer back on, everything's closed and I have to start over again. That's not hibernating at all. Why can't it be as simple as in Windows? I'd like some help if anyone has ideas about how I can get it to properly hibernate.
â user1271772
Apr 3 at 6:38
add a comment |Â
up vote
36
down vote
Hibernation using systemctl and getting it working in tough cases
For me, pm-hibernate always fails. After some tweaks, I was able to hibernate using the interface of systemd (init system in 16.04 and above). I also managed to get it working on 17.04 with a swap file. This case study may be useful for others with problems.
First try:
sudo systemctl hibernate
If that fails, begin troubleshooting: in the hibernate state (HTD or ACPI S4) the machine state is written to disk so that no power is needed to preserve it. The state is written either to a swap partition or to a swap file. Note: if using BTRFS DO NOT attempt to use a swap file as this may cause filesystem corruption
Your swap partition or swap file may need to be the same size as RAM to allow hibernation, but there is a good chance you will be able to hibernate if it is at least 2/5 the size of RAM, according to the Arch wiki page, so try other steps first before increasing swap size.
If your problem is that you get a clean boot instead of the expected resume, at a minimum you most likely need to set a boot parameter to find the disk image
Find your swap partition:
grep swap /etc/fstab
for me this returns (partial output)
# swap was on /dev/mmcblk0p3 during installation
where /dev/mmcblk0p3 is the partition to specify
Add a boot parameter:
sudoedit /etc/default/grub
To the line starting GRUB_CMDLINE_LINUX_DEFAULT add resume=/dev/YourSwapPartition to the section in quotes (replace with the the partition you identified earlier). Using my example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/mmcblk0p3"
Any time you change this file, you must run sudo update-grub or the changes will have no effect.
Now you need to reboot. Then you can try to hibernate, by issuing the command:
sudo systemctl hibernate
To resume, press the power button and the system will boot.
If you still have problems, start debugging.
I include my case below as an example, but detailed information on debugging S states can be found in this blog and also this one.
Set some more boot parameters to capture more information. Remove quiet and splash and add initcall_debug and no_console_suspend which will cause init system calls to be printed to the console so you can watch what is going wrong. I set this:
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/mmcblk0p3 no_console_suspend initcall_debug"
Which helped me see what was going wrong on resume from hibernation.
In my case, after resume I lost WiFi, and the kernel clearly was upset as most commands (for example reading anything from /sys, reloading modules or any systemctl command) would not work - the process would appear to start and just hang (all this would be returned to normal after reboot of course). Watching the system very slowly shut down and reading all the debug messages, I noticed that there were a lot of problems with "brcm", so I guessed my Broadcom wireless driver module was to blame. Sure enough I adjusted my hibernation procedure to unload the module first:
sudo modprobe -r brcmfmac
sudo systemctl hibernate
on resume I reinsert the module
sudo modprobe brcmfmac
And everything worked perfectly. I also have to blacklist the btsdio module which seems to be incompatible with brcmfmac
Update: Hibernation using a swap file on 17.04.
Once again with help from the Arch wiki page and some additional tinkering, I managed to get hibernation to work on 17.04 with a swap file. This required an additional boot parameter, resume_offset=n where n is the first number under physical_offset in the output of sudo filefrag -v /swapfile:
$ sudo filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 1425873920 (348114 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 32767: 34816.. 67583: 32768:
1: 32768.. 63487: 67584.. 98303: 30720:
....
Therefore, the additional boot parameter in my case is resume_offset=34816. You still need to set a boot parameter for the partition to resume from. This will be the root partition (or whatever partition your swap file is located on) My parameters are now:
GRUB_CMDLINE_LINUX_DEFAULT="no_console_suspend initcall_debug resume=/dev/mmcblk1p2 resume_offset=34816"
Where /dev/mmcblk1p2 is my root partition (yours is more likely to be something like /dev/sda2).
During resume I saw the image loading successfully, but in my case (just an example - YMMVAPD) then some more drivers (i2c_designware) threw some errors and I got a complete system freeze on resume. Hibernation works if I unload those modules in addition to brcmfmac, but the system quickly becomes unusable without those modules. I therefore made a sort of script to unload the buggy modules and immediately reinsert them on resume:
# remove buggy modules
modprobe -r brcmfmac i2c_designware_platform i2c_designware_core &&
# hibernate
echo disk > /sys/power/state
# reinsert
modprobe i2c_designware_core i2c_designware_platform brcmfmac
When I want to hibernate, I run sudo bash script. This works great.
TL;DR
Use systemd, set a boot parameter for resume from swap, identify buggy drivers and unload them before initiating hibernation. If the system can't work for long without those modules or you need to unload several, it may be easier to use a simple script to initiate hibernation.
Where is that information from, that 2/5 of the RAM size might be enough, and under which circumstances? I have a user option in Gnome, "Hibernate" and it does seem to hibernate, but on waking up, it doesn't work properly. I have a swap partition of 8GB and 32GB RAM. That's not 2/5, but before creating a 32GB swap file (or partition) it'd be nice to know.
â cslotty
Dec 13 '16 at 15:11
@cslotty I got that information from the Arch wiki IIRC - let me know if you do manage it please
â Zanna
Dec 13 '16 at 15:52
Thanks, @Zanna. I found out that it's actually not hibernate, what I want, but suspend (S3/STR) - sry.
â cslotty
Dec 13 '16 at 16:36
@cslotty no worries at all. In that case, swap is not your problem as it's not related.
â Zanna
Dec 13 '16 at 16:53
1
Thanks, I needed a synthesis of this answer as well as the tip on disabling SecureBoot to make it work in the end.
â oligofren
Dec 18 '17 at 12:55
 |Â
show 1 more comment
up vote
17
down vote
I think, how to enable hibernate for 16.04 answer is known to all as described in the Ubuntu Wiki (See below if you need the steps). But The things that need checking isn't thorough I think. At least, that's what I found.
Things to check
From my own tests, I've at least found one extra check that you should perform. I haven't found about it anywhere in the Internet.
Here are some checkings -
Check that you're not using any btrfs partitions. Yes. From my test, I found that if you have btrfs partitions, hibernate will not work. Removing or changing the partition type to
ext4didn't help me. I needed to remove thebtrfs-toolspackage.sudo apt-get purge btrfs-toolsYou might want to check other new partition types which are not well tested. Without removing package, blacklisting the driver might also work, but I haven't tested that.
Also you need to check that you have a swap partition large enough to hold the content of RAM. If your RAM is 4 GB, swap should be at least 4 GB large ( You should allocate few more MB to be safe).
Steps to enable hibernate
It involves these steps
Create a file as root in
/etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklasudo -i nano /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklaPut these contents on that file
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yesSave the file by pressing Ctrl-O. Exit with Ctrl-X
Restart the
polkitddaemonsudo systemctl restart polkitd.service
It should enable hibernate.
1
Thanks, Anwar. I filed bug #1619846 and referred you your answer above. Any chance you could propose more exact changes/additions to that page in the official documentation?
â Gunnar Hjalmarsson
Sep 3 '16 at 4:57
@GunnarHjalmarsson I'd propose this caveat. But, I'll need more testers verifying this. Will let you know later
â Anwar
Sep 3 '16 at 5:54
Ok, let's talk more then.
â Gunnar Hjalmarsson
Sep 3 '16 at 6:00
I installed on a btrfs partition and purgedbtrfs-toolsaccording to your instructions. Still can't hibernate.
â Oxwivi
Sep 4 '16 at 9:04
1
On disk there's onlyvfatfor UEFI, andbtrfsandswap. I'm actually suspecting it's due to the hardware (AMD laptop). I'm going to test this on another system with btrfs and get back at you.
â Oxwivi
Sep 4 '16 at 11:03
 |Â
show 6 more comments
up vote
4
down vote
Secure Boot
(I asked a similar question asking for a focus on systemd-based replies, sharing my solution here for people following this question)
This solution comes from Fedora topics (they made the switch to systemd a while ago so there's more material there).
In my case (fresh 16.04.1 install on a machine that always supported hibernation), calling the obsolete sudo pm-hibernate did not seem to do anything, and the up to date systemd approach, systemctl hibernate, would return:
Failed to hibernate system via logind: Sleep verb not supported
It turns out that secure boot was the culprit: installing 16.04 you are asked what you want to do with it (which is a new thing as far as I can recall) and I kept it ON without giving it much thought.
On my machine with secure boot ON, cat /sys/power/disk answered:
[disabled]
After reboot and disabling secure boot in the BIOS settings (these are machine-specific, but usually pretty straightforward) I tried a cat /sys/power/disk and got:
[platform] shutdown reboot suspend
which looks better. And indeed calling systemctl hibernate results in a successful hibernate/thaw sequence.
Moreover, after that I could see hibernation available as an option in various places of the graphical interface, without the need of any polkit hack. So it seems that systemd was actually guessing from /sys/power/disk that the system was not able to hibernate.
I did exactly what you have explained here. But after I execute "systemctl hibernate" command the screen got black for 3 seconds then the desktop went back with all my opened programs just like before I executed the command. When I executed the command "cat /sys/power/disk"... it shown me this text: "[platform] shutdown reboot suspend test_resume" which it's similar to the result when you executed the same from your side but the last text: "test_resume". Do you have an idea what I could try to solve my problem ?
â foxhard
May 6 at 16:58
Not too sure, looks like hibernation does not work out of the box on your hardware, which is why it is disabled by default as others pointed out. You might want to start a separate question about your specific issue.
â Marc
May 14 at 9:04
Only half-working for me. Hibernates but instead of waking up from hibernation, goes to normal boot, then gets stuck forever until a hard physical shutdown.
â matt
Jul 1 at 20:11
add a comment |Â
up vote
2
down vote
First, I do recommend that you test if your machine supports hibernation, because the reason why hibernation is disabled by default is because it sometimes has unpleasant results on some machines. Test your machine by opening the terminal (Ctrl+Alt+T) and then typing sudo pm-hibernate
Your machine should hibernate. Wake your machine up after hibernation and observe if it misbehaves or if it acts normally.
If you experience any abnormality after the hibernation, then I advise you don't continue with the following procedure. However, if it works just fine, continue to activate hibernation by doing this:
sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Edit the opened file and add this lines:
[Re-enable hibernation]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
After this, restart your machine, and after logging in, you should see a hibernation option added on the power menu, on the top right settings corner.
I have thinkpad -E550 and it has no problem with hibernation when my OS is ubuntu 15.1 or windows8.1 . but using ubuntu 16.04 , when i use the command "sudo pm-hibernate" , it does not completely hibernate and just the screen goes black and the machine is still on.
â Mahyar
May 6 '16 at 18:14
In my case, the command does nothing at all. The terminal goes to the newline and awaits next command i.e. previous command has been executed. But it does nothingat all
â Aalok
Jul 17 '16 at 18:01
This doesn't work for me. Ubuntu 16.04. The Hibernate option do not come up and stay disable in Settings -> Power, anything else?
â Daniele Segato
Aug 7 '16 at 17:02
Editing the already existing policy is better: zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04
â fgblomqvist
Aug 24 '16 at 1:41
Incomplete contents incom.ubuntu.enable-hibernate.pkla. See answer posted by NirajW.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:31
 |Â
show 1 more comment
up vote
2
down vote
Expanding on my own comment to kelvinelove's answer, the file he suggests editing did not exist on my system (fresh Ubuntu 16.04). Instead, I did this:
sudo nano /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pklaLook for these sections (they are right by each other):
[Disable hibernate by default in upower] Identity=unix-user:*
Action=org.freedesktop.upower.hibernate ResultActive=no
[Disable hibernate by default in logind] Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;
ResultActive=noChange ResultActive=no to ResultActive=yes for both of them.
- Press Ctrl + O to save the file.
- Reboot your computer
- The Hibernate option is now available in your power menus.
EDIT: Gunnar pointed out that this file gets overwritten if a certain package gets updated, so depending on your intentions it is most likely not the best solution.
Source: http://www.zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04/
The file in/etcis not supposed to exists by default. It's a configuration file which you create. Editing a package owned file, as you suggest above, is bad advice, since it will be overwritten at next package update.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:11
@GunnarHjalmarsson If that's the case I would argue that it should be stated that it might not exist. I expect more from a top rated Ask Ubuntu answer than a "copy/paste this command"->"type this" -style answer that lacks any kind of verification of whether you are doing the right thing (other than checking if it worked). What if someone finds that answer in a couple of years, but is afraid of trying it since the file is empty, and the instructions clearly state to add to the file, implying that it exists? Nonetheless, I appreciate the information, will add it to the answer for completion.
â fgblomqvist
Sep 3 '16 at 1:05
1
Fair point; I edited NirajW's answer with that clarification. It should be noted that the original source of info at this page talks about creation.
â Gunnar Hjalmarsson
Sep 3 '16 at 5:16
add a comment |Â
up vote
2
down vote
There are some very good resources here to help you sort out some of the more common hibernate issues under Ubuntu.
In my case, running Ubuntu 16.10 on a Lenovo u300s, in order for hibernate to work correctly I had to do the following:
- Create an appropriately-sized swap file (I typically set for ~1x in
size, but I've heard up to 1.6x and 2x) Edit
/etc/default/grubto include the following line:GRUB_CMDLINE_LINUX_DEFAULT="splash quiet pci=nomsi RESUME=UUID=92781adb-f2a6-4f15-88fc-e1ce801291dd"
The RESUME refers to your specific swap file UUID. In particular, on my machine setting pci=nomsi was the key.
Best of luck!
add a comment |Â
up vote
1
down vote
For me, it works to install hibernate package, reboot and then run sudo hibernate-disk. I am sure it is possible to add it to menu, but is not worth the time for me.
add a comment |Â
up vote
0
down vote
You have to manually enable it with a little effort. It's been disabled by default.
http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04/
Then, if it doesn't work, it's might be a 4.4.0 kernel issue, and you might have to upgrade kernel.
1
The answer referes to 14.04, while the question is about 16.04.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:08
add a comment |Â
protected by Community⦠Jan 3 '17 at 12:34
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
48
down vote
You can use
sudo pm-hibernate
to check if hibernate works on your system (this will hibernate your computer).
If it does not work , check if your swap size is at least as large as your RAM.
To add the option to the settings menu, you can create a configuration file. Open a terminal window and run this command:
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
It opens nano with an empty file. Copy the lines below and paste them into the nano window.
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes
Then save the changes and close nano and reboot the system to make Hibernate available appear on "Power options".
Reference: How do I hibernate my computer? in the official documentation for Ubuntu 16.04.
Hope it works. This worked for me after trying all other options.
We need a reboot after editing the file to make Hibernate available appear on "Power options".
â Jus12
Jan 15 '17 at 7:30
12
'sudo pm-hibernate' killed my system immediately without warning. You should tell people that's what's going to happen.
â Yair Daon
Jun 9 '17 at 1:27
best answer . This also working on 17.4 and 17.10 as well .
â Saurabh Bhandari
Sep 23 '17 at 11:40
1
This answer combined with the one telling to add "resume=" to the GRUB_CMDLINE_LINUX_DEFAULT did solve it for me - thx!
â Christoph
Nov 3 '17 at 15:21
I have 17GB in my swap partition and 16GB of RAM, why is it not working? It seems to be hibernating because it takes forever to turn off the computer whereas if I do "shutdown" it turns off almost immediately. But when I turn my computer back on, everything's closed and I have to start over again. That's not hibernating at all. Why can't it be as simple as in Windows? I'd like some help if anyone has ideas about how I can get it to properly hibernate.
â user1271772
Apr 3 at 6:38
add a comment |Â
up vote
48
down vote
You can use
sudo pm-hibernate
to check if hibernate works on your system (this will hibernate your computer).
If it does not work , check if your swap size is at least as large as your RAM.
To add the option to the settings menu, you can create a configuration file. Open a terminal window and run this command:
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
It opens nano with an empty file. Copy the lines below and paste them into the nano window.
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes
Then save the changes and close nano and reboot the system to make Hibernate available appear on "Power options".
Reference: How do I hibernate my computer? in the official documentation for Ubuntu 16.04.
Hope it works. This worked for me after trying all other options.
We need a reboot after editing the file to make Hibernate available appear on "Power options".
â Jus12
Jan 15 '17 at 7:30
12
'sudo pm-hibernate' killed my system immediately without warning. You should tell people that's what's going to happen.
â Yair Daon
Jun 9 '17 at 1:27
best answer . This also working on 17.4 and 17.10 as well .
â Saurabh Bhandari
Sep 23 '17 at 11:40
1
This answer combined with the one telling to add "resume=" to the GRUB_CMDLINE_LINUX_DEFAULT did solve it for me - thx!
â Christoph
Nov 3 '17 at 15:21
I have 17GB in my swap partition and 16GB of RAM, why is it not working? It seems to be hibernating because it takes forever to turn off the computer whereas if I do "shutdown" it turns off almost immediately. But when I turn my computer back on, everything's closed and I have to start over again. That's not hibernating at all. Why can't it be as simple as in Windows? I'd like some help if anyone has ideas about how I can get it to properly hibernate.
â user1271772
Apr 3 at 6:38
add a comment |Â
up vote
48
down vote
up vote
48
down vote
You can use
sudo pm-hibernate
to check if hibernate works on your system (this will hibernate your computer).
If it does not work , check if your swap size is at least as large as your RAM.
To add the option to the settings menu, you can create a configuration file. Open a terminal window and run this command:
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
It opens nano with an empty file. Copy the lines below and paste them into the nano window.
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes
Then save the changes and close nano and reboot the system to make Hibernate available appear on "Power options".
Reference: How do I hibernate my computer? in the official documentation for Ubuntu 16.04.
Hope it works. This worked for me after trying all other options.
You can use
sudo pm-hibernate
to check if hibernate works on your system (this will hibernate your computer).
If it does not work , check if your swap size is at least as large as your RAM.
To add the option to the settings menu, you can create a configuration file. Open a terminal window and run this command:
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
It opens nano with an empty file. Copy the lines below and paste them into the nano window.
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes
Then save the changes and close nano and reboot the system to make Hibernate available appear on "Power options".
Reference: How do I hibernate my computer? in the official documentation for Ubuntu 16.04.
Hope it works. This worked for me after trying all other options.
edited Jan 19 at 6:17
John D
1035
1035
answered Sep 2 '16 at 6:01
NirajW
59144
59144
We need a reboot after editing the file to make Hibernate available appear on "Power options".
â Jus12
Jan 15 '17 at 7:30
12
'sudo pm-hibernate' killed my system immediately without warning. You should tell people that's what's going to happen.
â Yair Daon
Jun 9 '17 at 1:27
best answer . This also working on 17.4 and 17.10 as well .
â Saurabh Bhandari
Sep 23 '17 at 11:40
1
This answer combined with the one telling to add "resume=" to the GRUB_CMDLINE_LINUX_DEFAULT did solve it for me - thx!
â Christoph
Nov 3 '17 at 15:21
I have 17GB in my swap partition and 16GB of RAM, why is it not working? It seems to be hibernating because it takes forever to turn off the computer whereas if I do "shutdown" it turns off almost immediately. But when I turn my computer back on, everything's closed and I have to start over again. That's not hibernating at all. Why can't it be as simple as in Windows? I'd like some help if anyone has ideas about how I can get it to properly hibernate.
â user1271772
Apr 3 at 6:38
add a comment |Â
We need a reboot after editing the file to make Hibernate available appear on "Power options".
â Jus12
Jan 15 '17 at 7:30
12
'sudo pm-hibernate' killed my system immediately without warning. You should tell people that's what's going to happen.
â Yair Daon
Jun 9 '17 at 1:27
best answer . This also working on 17.4 and 17.10 as well .
â Saurabh Bhandari
Sep 23 '17 at 11:40
1
This answer combined with the one telling to add "resume=" to the GRUB_CMDLINE_LINUX_DEFAULT did solve it for me - thx!
â Christoph
Nov 3 '17 at 15:21
I have 17GB in my swap partition and 16GB of RAM, why is it not working? It seems to be hibernating because it takes forever to turn off the computer whereas if I do "shutdown" it turns off almost immediately. But when I turn my computer back on, everything's closed and I have to start over again. That's not hibernating at all. Why can't it be as simple as in Windows? I'd like some help if anyone has ideas about how I can get it to properly hibernate.
â user1271772
Apr 3 at 6:38
We need a reboot after editing the file to make Hibernate available appear on "Power options".
â Jus12
Jan 15 '17 at 7:30
We need a reboot after editing the file to make Hibernate available appear on "Power options".
â Jus12
Jan 15 '17 at 7:30
12
12
'sudo pm-hibernate' killed my system immediately without warning. You should tell people that's what's going to happen.
â Yair Daon
Jun 9 '17 at 1:27
'sudo pm-hibernate' killed my system immediately without warning. You should tell people that's what's going to happen.
â Yair Daon
Jun 9 '17 at 1:27
best answer . This also working on 17.4 and 17.10 as well .
â Saurabh Bhandari
Sep 23 '17 at 11:40
best answer . This also working on 17.4 and 17.10 as well .
â Saurabh Bhandari
Sep 23 '17 at 11:40
1
1
This answer combined with the one telling to add "resume=" to the GRUB_CMDLINE_LINUX_DEFAULT did solve it for me - thx!
â Christoph
Nov 3 '17 at 15:21
This answer combined with the one telling to add "resume=" to the GRUB_CMDLINE_LINUX_DEFAULT did solve it for me - thx!
â Christoph
Nov 3 '17 at 15:21
I have 17GB in my swap partition and 16GB of RAM, why is it not working? It seems to be hibernating because it takes forever to turn off the computer whereas if I do "shutdown" it turns off almost immediately. But when I turn my computer back on, everything's closed and I have to start over again. That's not hibernating at all. Why can't it be as simple as in Windows? I'd like some help if anyone has ideas about how I can get it to properly hibernate.
â user1271772
Apr 3 at 6:38
I have 17GB in my swap partition and 16GB of RAM, why is it not working? It seems to be hibernating because it takes forever to turn off the computer whereas if I do "shutdown" it turns off almost immediately. But when I turn my computer back on, everything's closed and I have to start over again. That's not hibernating at all. Why can't it be as simple as in Windows? I'd like some help if anyone has ideas about how I can get it to properly hibernate.
â user1271772
Apr 3 at 6:38
add a comment |Â
up vote
36
down vote
Hibernation using systemctl and getting it working in tough cases
For me, pm-hibernate always fails. After some tweaks, I was able to hibernate using the interface of systemd (init system in 16.04 and above). I also managed to get it working on 17.04 with a swap file. This case study may be useful for others with problems.
First try:
sudo systemctl hibernate
If that fails, begin troubleshooting: in the hibernate state (HTD or ACPI S4) the machine state is written to disk so that no power is needed to preserve it. The state is written either to a swap partition or to a swap file. Note: if using BTRFS DO NOT attempt to use a swap file as this may cause filesystem corruption
Your swap partition or swap file may need to be the same size as RAM to allow hibernation, but there is a good chance you will be able to hibernate if it is at least 2/5 the size of RAM, according to the Arch wiki page, so try other steps first before increasing swap size.
If your problem is that you get a clean boot instead of the expected resume, at a minimum you most likely need to set a boot parameter to find the disk image
Find your swap partition:
grep swap /etc/fstab
for me this returns (partial output)
# swap was on /dev/mmcblk0p3 during installation
where /dev/mmcblk0p3 is the partition to specify
Add a boot parameter:
sudoedit /etc/default/grub
To the line starting GRUB_CMDLINE_LINUX_DEFAULT add resume=/dev/YourSwapPartition to the section in quotes (replace with the the partition you identified earlier). Using my example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/mmcblk0p3"
Any time you change this file, you must run sudo update-grub or the changes will have no effect.
Now you need to reboot. Then you can try to hibernate, by issuing the command:
sudo systemctl hibernate
To resume, press the power button and the system will boot.
If you still have problems, start debugging.
I include my case below as an example, but detailed information on debugging S states can be found in this blog and also this one.
Set some more boot parameters to capture more information. Remove quiet and splash and add initcall_debug and no_console_suspend which will cause init system calls to be printed to the console so you can watch what is going wrong. I set this:
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/mmcblk0p3 no_console_suspend initcall_debug"
Which helped me see what was going wrong on resume from hibernation.
In my case, after resume I lost WiFi, and the kernel clearly was upset as most commands (for example reading anything from /sys, reloading modules or any systemctl command) would not work - the process would appear to start and just hang (all this would be returned to normal after reboot of course). Watching the system very slowly shut down and reading all the debug messages, I noticed that there were a lot of problems with "brcm", so I guessed my Broadcom wireless driver module was to blame. Sure enough I adjusted my hibernation procedure to unload the module first:
sudo modprobe -r brcmfmac
sudo systemctl hibernate
on resume I reinsert the module
sudo modprobe brcmfmac
And everything worked perfectly. I also have to blacklist the btsdio module which seems to be incompatible with brcmfmac
Update: Hibernation using a swap file on 17.04.
Once again with help from the Arch wiki page and some additional tinkering, I managed to get hibernation to work on 17.04 with a swap file. This required an additional boot parameter, resume_offset=n where n is the first number under physical_offset in the output of sudo filefrag -v /swapfile:
$ sudo filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 1425873920 (348114 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 32767: 34816.. 67583: 32768:
1: 32768.. 63487: 67584.. 98303: 30720:
....
Therefore, the additional boot parameter in my case is resume_offset=34816. You still need to set a boot parameter for the partition to resume from. This will be the root partition (or whatever partition your swap file is located on) My parameters are now:
GRUB_CMDLINE_LINUX_DEFAULT="no_console_suspend initcall_debug resume=/dev/mmcblk1p2 resume_offset=34816"
Where /dev/mmcblk1p2 is my root partition (yours is more likely to be something like /dev/sda2).
During resume I saw the image loading successfully, but in my case (just an example - YMMVAPD) then some more drivers (i2c_designware) threw some errors and I got a complete system freeze on resume. Hibernation works if I unload those modules in addition to brcmfmac, but the system quickly becomes unusable without those modules. I therefore made a sort of script to unload the buggy modules and immediately reinsert them on resume:
# remove buggy modules
modprobe -r brcmfmac i2c_designware_platform i2c_designware_core &&
# hibernate
echo disk > /sys/power/state
# reinsert
modprobe i2c_designware_core i2c_designware_platform brcmfmac
When I want to hibernate, I run sudo bash script. This works great.
TL;DR
Use systemd, set a boot parameter for resume from swap, identify buggy drivers and unload them before initiating hibernation. If the system can't work for long without those modules or you need to unload several, it may be easier to use a simple script to initiate hibernation.
Where is that information from, that 2/5 of the RAM size might be enough, and under which circumstances? I have a user option in Gnome, "Hibernate" and it does seem to hibernate, but on waking up, it doesn't work properly. I have a swap partition of 8GB and 32GB RAM. That's not 2/5, but before creating a 32GB swap file (or partition) it'd be nice to know.
â cslotty
Dec 13 '16 at 15:11
@cslotty I got that information from the Arch wiki IIRC - let me know if you do manage it please
â Zanna
Dec 13 '16 at 15:52
Thanks, @Zanna. I found out that it's actually not hibernate, what I want, but suspend (S3/STR) - sry.
â cslotty
Dec 13 '16 at 16:36
@cslotty no worries at all. In that case, swap is not your problem as it's not related.
â Zanna
Dec 13 '16 at 16:53
1
Thanks, I needed a synthesis of this answer as well as the tip on disabling SecureBoot to make it work in the end.
â oligofren
Dec 18 '17 at 12:55
 |Â
show 1 more comment
up vote
36
down vote
Hibernation using systemctl and getting it working in tough cases
For me, pm-hibernate always fails. After some tweaks, I was able to hibernate using the interface of systemd (init system in 16.04 and above). I also managed to get it working on 17.04 with a swap file. This case study may be useful for others with problems.
First try:
sudo systemctl hibernate
If that fails, begin troubleshooting: in the hibernate state (HTD or ACPI S4) the machine state is written to disk so that no power is needed to preserve it. The state is written either to a swap partition or to a swap file. Note: if using BTRFS DO NOT attempt to use a swap file as this may cause filesystem corruption
Your swap partition or swap file may need to be the same size as RAM to allow hibernation, but there is a good chance you will be able to hibernate if it is at least 2/5 the size of RAM, according to the Arch wiki page, so try other steps first before increasing swap size.
If your problem is that you get a clean boot instead of the expected resume, at a minimum you most likely need to set a boot parameter to find the disk image
Find your swap partition:
grep swap /etc/fstab
for me this returns (partial output)
# swap was on /dev/mmcblk0p3 during installation
where /dev/mmcblk0p3 is the partition to specify
Add a boot parameter:
sudoedit /etc/default/grub
To the line starting GRUB_CMDLINE_LINUX_DEFAULT add resume=/dev/YourSwapPartition to the section in quotes (replace with the the partition you identified earlier). Using my example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/mmcblk0p3"
Any time you change this file, you must run sudo update-grub or the changes will have no effect.
Now you need to reboot. Then you can try to hibernate, by issuing the command:
sudo systemctl hibernate
To resume, press the power button and the system will boot.
If you still have problems, start debugging.
I include my case below as an example, but detailed information on debugging S states can be found in this blog and also this one.
Set some more boot parameters to capture more information. Remove quiet and splash and add initcall_debug and no_console_suspend which will cause init system calls to be printed to the console so you can watch what is going wrong. I set this:
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/mmcblk0p3 no_console_suspend initcall_debug"
Which helped me see what was going wrong on resume from hibernation.
In my case, after resume I lost WiFi, and the kernel clearly was upset as most commands (for example reading anything from /sys, reloading modules or any systemctl command) would not work - the process would appear to start and just hang (all this would be returned to normal after reboot of course). Watching the system very slowly shut down and reading all the debug messages, I noticed that there were a lot of problems with "brcm", so I guessed my Broadcom wireless driver module was to blame. Sure enough I adjusted my hibernation procedure to unload the module first:
sudo modprobe -r brcmfmac
sudo systemctl hibernate
on resume I reinsert the module
sudo modprobe brcmfmac
And everything worked perfectly. I also have to blacklist the btsdio module which seems to be incompatible with brcmfmac
Update: Hibernation using a swap file on 17.04.
Once again with help from the Arch wiki page and some additional tinkering, I managed to get hibernation to work on 17.04 with a swap file. This required an additional boot parameter, resume_offset=n where n is the first number under physical_offset in the output of sudo filefrag -v /swapfile:
$ sudo filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 1425873920 (348114 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 32767: 34816.. 67583: 32768:
1: 32768.. 63487: 67584.. 98303: 30720:
....
Therefore, the additional boot parameter in my case is resume_offset=34816. You still need to set a boot parameter for the partition to resume from. This will be the root partition (or whatever partition your swap file is located on) My parameters are now:
GRUB_CMDLINE_LINUX_DEFAULT="no_console_suspend initcall_debug resume=/dev/mmcblk1p2 resume_offset=34816"
Where /dev/mmcblk1p2 is my root partition (yours is more likely to be something like /dev/sda2).
During resume I saw the image loading successfully, but in my case (just an example - YMMVAPD) then some more drivers (i2c_designware) threw some errors and I got a complete system freeze on resume. Hibernation works if I unload those modules in addition to brcmfmac, but the system quickly becomes unusable without those modules. I therefore made a sort of script to unload the buggy modules and immediately reinsert them on resume:
# remove buggy modules
modprobe -r brcmfmac i2c_designware_platform i2c_designware_core &&
# hibernate
echo disk > /sys/power/state
# reinsert
modprobe i2c_designware_core i2c_designware_platform brcmfmac
When I want to hibernate, I run sudo bash script. This works great.
TL;DR
Use systemd, set a boot parameter for resume from swap, identify buggy drivers and unload them before initiating hibernation. If the system can't work for long without those modules or you need to unload several, it may be easier to use a simple script to initiate hibernation.
Where is that information from, that 2/5 of the RAM size might be enough, and under which circumstances? I have a user option in Gnome, "Hibernate" and it does seem to hibernate, but on waking up, it doesn't work properly. I have a swap partition of 8GB and 32GB RAM. That's not 2/5, but before creating a 32GB swap file (or partition) it'd be nice to know.
â cslotty
Dec 13 '16 at 15:11
@cslotty I got that information from the Arch wiki IIRC - let me know if you do manage it please
â Zanna
Dec 13 '16 at 15:52
Thanks, @Zanna. I found out that it's actually not hibernate, what I want, but suspend (S3/STR) - sry.
â cslotty
Dec 13 '16 at 16:36
@cslotty no worries at all. In that case, swap is not your problem as it's not related.
â Zanna
Dec 13 '16 at 16:53
1
Thanks, I needed a synthesis of this answer as well as the tip on disabling SecureBoot to make it work in the end.
â oligofren
Dec 18 '17 at 12:55
 |Â
show 1 more comment
up vote
36
down vote
up vote
36
down vote
Hibernation using systemctl and getting it working in tough cases
For me, pm-hibernate always fails. After some tweaks, I was able to hibernate using the interface of systemd (init system in 16.04 and above). I also managed to get it working on 17.04 with a swap file. This case study may be useful for others with problems.
First try:
sudo systemctl hibernate
If that fails, begin troubleshooting: in the hibernate state (HTD or ACPI S4) the machine state is written to disk so that no power is needed to preserve it. The state is written either to a swap partition or to a swap file. Note: if using BTRFS DO NOT attempt to use a swap file as this may cause filesystem corruption
Your swap partition or swap file may need to be the same size as RAM to allow hibernation, but there is a good chance you will be able to hibernate if it is at least 2/5 the size of RAM, according to the Arch wiki page, so try other steps first before increasing swap size.
If your problem is that you get a clean boot instead of the expected resume, at a minimum you most likely need to set a boot parameter to find the disk image
Find your swap partition:
grep swap /etc/fstab
for me this returns (partial output)
# swap was on /dev/mmcblk0p3 during installation
where /dev/mmcblk0p3 is the partition to specify
Add a boot parameter:
sudoedit /etc/default/grub
To the line starting GRUB_CMDLINE_LINUX_DEFAULT add resume=/dev/YourSwapPartition to the section in quotes (replace with the the partition you identified earlier). Using my example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/mmcblk0p3"
Any time you change this file, you must run sudo update-grub or the changes will have no effect.
Now you need to reboot. Then you can try to hibernate, by issuing the command:
sudo systemctl hibernate
To resume, press the power button and the system will boot.
If you still have problems, start debugging.
I include my case below as an example, but detailed information on debugging S states can be found in this blog and also this one.
Set some more boot parameters to capture more information. Remove quiet and splash and add initcall_debug and no_console_suspend which will cause init system calls to be printed to the console so you can watch what is going wrong. I set this:
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/mmcblk0p3 no_console_suspend initcall_debug"
Which helped me see what was going wrong on resume from hibernation.
In my case, after resume I lost WiFi, and the kernel clearly was upset as most commands (for example reading anything from /sys, reloading modules or any systemctl command) would not work - the process would appear to start and just hang (all this would be returned to normal after reboot of course). Watching the system very slowly shut down and reading all the debug messages, I noticed that there were a lot of problems with "brcm", so I guessed my Broadcom wireless driver module was to blame. Sure enough I adjusted my hibernation procedure to unload the module first:
sudo modprobe -r brcmfmac
sudo systemctl hibernate
on resume I reinsert the module
sudo modprobe brcmfmac
And everything worked perfectly. I also have to blacklist the btsdio module which seems to be incompatible with brcmfmac
Update: Hibernation using a swap file on 17.04.
Once again with help from the Arch wiki page and some additional tinkering, I managed to get hibernation to work on 17.04 with a swap file. This required an additional boot parameter, resume_offset=n where n is the first number under physical_offset in the output of sudo filefrag -v /swapfile:
$ sudo filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 1425873920 (348114 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 32767: 34816.. 67583: 32768:
1: 32768.. 63487: 67584.. 98303: 30720:
....
Therefore, the additional boot parameter in my case is resume_offset=34816. You still need to set a boot parameter for the partition to resume from. This will be the root partition (or whatever partition your swap file is located on) My parameters are now:
GRUB_CMDLINE_LINUX_DEFAULT="no_console_suspend initcall_debug resume=/dev/mmcblk1p2 resume_offset=34816"
Where /dev/mmcblk1p2 is my root partition (yours is more likely to be something like /dev/sda2).
During resume I saw the image loading successfully, but in my case (just an example - YMMVAPD) then some more drivers (i2c_designware) threw some errors and I got a complete system freeze on resume. Hibernation works if I unload those modules in addition to brcmfmac, but the system quickly becomes unusable without those modules. I therefore made a sort of script to unload the buggy modules and immediately reinsert them on resume:
# remove buggy modules
modprobe -r brcmfmac i2c_designware_platform i2c_designware_core &&
# hibernate
echo disk > /sys/power/state
# reinsert
modprobe i2c_designware_core i2c_designware_platform brcmfmac
When I want to hibernate, I run sudo bash script. This works great.
TL;DR
Use systemd, set a boot parameter for resume from swap, identify buggy drivers and unload them before initiating hibernation. If the system can't work for long without those modules or you need to unload several, it may be easier to use a simple script to initiate hibernation.
Hibernation using systemctl and getting it working in tough cases
For me, pm-hibernate always fails. After some tweaks, I was able to hibernate using the interface of systemd (init system in 16.04 and above). I also managed to get it working on 17.04 with a swap file. This case study may be useful for others with problems.
First try:
sudo systemctl hibernate
If that fails, begin troubleshooting: in the hibernate state (HTD or ACPI S4) the machine state is written to disk so that no power is needed to preserve it. The state is written either to a swap partition or to a swap file. Note: if using BTRFS DO NOT attempt to use a swap file as this may cause filesystem corruption
Your swap partition or swap file may need to be the same size as RAM to allow hibernation, but there is a good chance you will be able to hibernate if it is at least 2/5 the size of RAM, according to the Arch wiki page, so try other steps first before increasing swap size.
If your problem is that you get a clean boot instead of the expected resume, at a minimum you most likely need to set a boot parameter to find the disk image
Find your swap partition:
grep swap /etc/fstab
for me this returns (partial output)
# swap was on /dev/mmcblk0p3 during installation
where /dev/mmcblk0p3 is the partition to specify
Add a boot parameter:
sudoedit /etc/default/grub
To the line starting GRUB_CMDLINE_LINUX_DEFAULT add resume=/dev/YourSwapPartition to the section in quotes (replace with the the partition you identified earlier). Using my example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/mmcblk0p3"
Any time you change this file, you must run sudo update-grub or the changes will have no effect.
Now you need to reboot. Then you can try to hibernate, by issuing the command:
sudo systemctl hibernate
To resume, press the power button and the system will boot.
If you still have problems, start debugging.
I include my case below as an example, but detailed information on debugging S states can be found in this blog and also this one.
Set some more boot parameters to capture more information. Remove quiet and splash and add initcall_debug and no_console_suspend which will cause init system calls to be printed to the console so you can watch what is going wrong. I set this:
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/mmcblk0p3 no_console_suspend initcall_debug"
Which helped me see what was going wrong on resume from hibernation.
In my case, after resume I lost WiFi, and the kernel clearly was upset as most commands (for example reading anything from /sys, reloading modules or any systemctl command) would not work - the process would appear to start and just hang (all this would be returned to normal after reboot of course). Watching the system very slowly shut down and reading all the debug messages, I noticed that there were a lot of problems with "brcm", so I guessed my Broadcom wireless driver module was to blame. Sure enough I adjusted my hibernation procedure to unload the module first:
sudo modprobe -r brcmfmac
sudo systemctl hibernate
on resume I reinsert the module
sudo modprobe brcmfmac
And everything worked perfectly. I also have to blacklist the btsdio module which seems to be incompatible with brcmfmac
Update: Hibernation using a swap file on 17.04.
Once again with help from the Arch wiki page and some additional tinkering, I managed to get hibernation to work on 17.04 with a swap file. This required an additional boot parameter, resume_offset=n where n is the first number under physical_offset in the output of sudo filefrag -v /swapfile:
$ sudo filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 1425873920 (348114 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 32767: 34816.. 67583: 32768:
1: 32768.. 63487: 67584.. 98303: 30720:
....
Therefore, the additional boot parameter in my case is resume_offset=34816. You still need to set a boot parameter for the partition to resume from. This will be the root partition (or whatever partition your swap file is located on) My parameters are now:
GRUB_CMDLINE_LINUX_DEFAULT="no_console_suspend initcall_debug resume=/dev/mmcblk1p2 resume_offset=34816"
Where /dev/mmcblk1p2 is my root partition (yours is more likely to be something like /dev/sda2).
During resume I saw the image loading successfully, but in my case (just an example - YMMVAPD) then some more drivers (i2c_designware) threw some errors and I got a complete system freeze on resume. Hibernation works if I unload those modules in addition to brcmfmac, but the system quickly becomes unusable without those modules. I therefore made a sort of script to unload the buggy modules and immediately reinsert them on resume:
# remove buggy modules
modprobe -r brcmfmac i2c_designware_platform i2c_designware_core &&
# hibernate
echo disk > /sys/power/state
# reinsert
modprobe i2c_designware_core i2c_designware_platform brcmfmac
When I want to hibernate, I run sudo bash script. This works great.
TL;DR
Use systemd, set a boot parameter for resume from swap, identify buggy drivers and unload them before initiating hibernation. If the system can't work for long without those modules or you need to unload several, it may be easier to use a simple script to initiate hibernation.
edited May 15 '17 at 7:22
answered Sep 5 '16 at 7:36
Zanna
48.3k13120229
48.3k13120229
Where is that information from, that 2/5 of the RAM size might be enough, and under which circumstances? I have a user option in Gnome, "Hibernate" and it does seem to hibernate, but on waking up, it doesn't work properly. I have a swap partition of 8GB and 32GB RAM. That's not 2/5, but before creating a 32GB swap file (or partition) it'd be nice to know.
â cslotty
Dec 13 '16 at 15:11
@cslotty I got that information from the Arch wiki IIRC - let me know if you do manage it please
â Zanna
Dec 13 '16 at 15:52
Thanks, @Zanna. I found out that it's actually not hibernate, what I want, but suspend (S3/STR) - sry.
â cslotty
Dec 13 '16 at 16:36
@cslotty no worries at all. In that case, swap is not your problem as it's not related.
â Zanna
Dec 13 '16 at 16:53
1
Thanks, I needed a synthesis of this answer as well as the tip on disabling SecureBoot to make it work in the end.
â oligofren
Dec 18 '17 at 12:55
 |Â
show 1 more comment
Where is that information from, that 2/5 of the RAM size might be enough, and under which circumstances? I have a user option in Gnome, "Hibernate" and it does seem to hibernate, but on waking up, it doesn't work properly. I have a swap partition of 8GB and 32GB RAM. That's not 2/5, but before creating a 32GB swap file (or partition) it'd be nice to know.
â cslotty
Dec 13 '16 at 15:11
@cslotty I got that information from the Arch wiki IIRC - let me know if you do manage it please
â Zanna
Dec 13 '16 at 15:52
Thanks, @Zanna. I found out that it's actually not hibernate, what I want, but suspend (S3/STR) - sry.
â cslotty
Dec 13 '16 at 16:36
@cslotty no worries at all. In that case, swap is not your problem as it's not related.
â Zanna
Dec 13 '16 at 16:53
1
Thanks, I needed a synthesis of this answer as well as the tip on disabling SecureBoot to make it work in the end.
â oligofren
Dec 18 '17 at 12:55
Where is that information from, that 2/5 of the RAM size might be enough, and under which circumstances? I have a user option in Gnome, "Hibernate" and it does seem to hibernate, but on waking up, it doesn't work properly. I have a swap partition of 8GB and 32GB RAM. That's not 2/5, but before creating a 32GB swap file (or partition) it'd be nice to know.
â cslotty
Dec 13 '16 at 15:11
Where is that information from, that 2/5 of the RAM size might be enough, and under which circumstances? I have a user option in Gnome, "Hibernate" and it does seem to hibernate, but on waking up, it doesn't work properly. I have a swap partition of 8GB and 32GB RAM. That's not 2/5, but before creating a 32GB swap file (or partition) it'd be nice to know.
â cslotty
Dec 13 '16 at 15:11
@cslotty I got that information from the Arch wiki IIRC - let me know if you do manage it please
â Zanna
Dec 13 '16 at 15:52
@cslotty I got that information from the Arch wiki IIRC - let me know if you do manage it please
â Zanna
Dec 13 '16 at 15:52
Thanks, @Zanna. I found out that it's actually not hibernate, what I want, but suspend (S3/STR) - sry.
â cslotty
Dec 13 '16 at 16:36
Thanks, @Zanna. I found out that it's actually not hibernate, what I want, but suspend (S3/STR) - sry.
â cslotty
Dec 13 '16 at 16:36
@cslotty no worries at all. In that case, swap is not your problem as it's not related.
â Zanna
Dec 13 '16 at 16:53
@cslotty no worries at all. In that case, swap is not your problem as it's not related.
â Zanna
Dec 13 '16 at 16:53
1
1
Thanks, I needed a synthesis of this answer as well as the tip on disabling SecureBoot to make it work in the end.
â oligofren
Dec 18 '17 at 12:55
Thanks, I needed a synthesis of this answer as well as the tip on disabling SecureBoot to make it work in the end.
â oligofren
Dec 18 '17 at 12:55
 |Â
show 1 more comment
up vote
17
down vote
I think, how to enable hibernate for 16.04 answer is known to all as described in the Ubuntu Wiki (See below if you need the steps). But The things that need checking isn't thorough I think. At least, that's what I found.
Things to check
From my own tests, I've at least found one extra check that you should perform. I haven't found about it anywhere in the Internet.
Here are some checkings -
Check that you're not using any btrfs partitions. Yes. From my test, I found that if you have btrfs partitions, hibernate will not work. Removing or changing the partition type to
ext4didn't help me. I needed to remove thebtrfs-toolspackage.sudo apt-get purge btrfs-toolsYou might want to check other new partition types which are not well tested. Without removing package, blacklisting the driver might also work, but I haven't tested that.
Also you need to check that you have a swap partition large enough to hold the content of RAM. If your RAM is 4 GB, swap should be at least 4 GB large ( You should allocate few more MB to be safe).
Steps to enable hibernate
It involves these steps
Create a file as root in
/etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklasudo -i nano /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklaPut these contents on that file
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yesSave the file by pressing Ctrl-O. Exit with Ctrl-X
Restart the
polkitddaemonsudo systemctl restart polkitd.service
It should enable hibernate.
1
Thanks, Anwar. I filed bug #1619846 and referred you your answer above. Any chance you could propose more exact changes/additions to that page in the official documentation?
â Gunnar Hjalmarsson
Sep 3 '16 at 4:57
@GunnarHjalmarsson I'd propose this caveat. But, I'll need more testers verifying this. Will let you know later
â Anwar
Sep 3 '16 at 5:54
Ok, let's talk more then.
â Gunnar Hjalmarsson
Sep 3 '16 at 6:00
I installed on a btrfs partition and purgedbtrfs-toolsaccording to your instructions. Still can't hibernate.
â Oxwivi
Sep 4 '16 at 9:04
1
On disk there's onlyvfatfor UEFI, andbtrfsandswap. I'm actually suspecting it's due to the hardware (AMD laptop). I'm going to test this on another system with btrfs and get back at you.
â Oxwivi
Sep 4 '16 at 11:03
 |Â
show 6 more comments
up vote
17
down vote
I think, how to enable hibernate for 16.04 answer is known to all as described in the Ubuntu Wiki (See below if you need the steps). But The things that need checking isn't thorough I think. At least, that's what I found.
Things to check
From my own tests, I've at least found one extra check that you should perform. I haven't found about it anywhere in the Internet.
Here are some checkings -
Check that you're not using any btrfs partitions. Yes. From my test, I found that if you have btrfs partitions, hibernate will not work. Removing or changing the partition type to
ext4didn't help me. I needed to remove thebtrfs-toolspackage.sudo apt-get purge btrfs-toolsYou might want to check other new partition types which are not well tested. Without removing package, blacklisting the driver might also work, but I haven't tested that.
Also you need to check that you have a swap partition large enough to hold the content of RAM. If your RAM is 4 GB, swap should be at least 4 GB large ( You should allocate few more MB to be safe).
Steps to enable hibernate
It involves these steps
Create a file as root in
/etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklasudo -i nano /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklaPut these contents on that file
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yesSave the file by pressing Ctrl-O. Exit with Ctrl-X
Restart the
polkitddaemonsudo systemctl restart polkitd.service
It should enable hibernate.
1
Thanks, Anwar. I filed bug #1619846 and referred you your answer above. Any chance you could propose more exact changes/additions to that page in the official documentation?
â Gunnar Hjalmarsson
Sep 3 '16 at 4:57
@GunnarHjalmarsson I'd propose this caveat. But, I'll need more testers verifying this. Will let you know later
â Anwar
Sep 3 '16 at 5:54
Ok, let's talk more then.
â Gunnar Hjalmarsson
Sep 3 '16 at 6:00
I installed on a btrfs partition and purgedbtrfs-toolsaccording to your instructions. Still can't hibernate.
â Oxwivi
Sep 4 '16 at 9:04
1
On disk there's onlyvfatfor UEFI, andbtrfsandswap. I'm actually suspecting it's due to the hardware (AMD laptop). I'm going to test this on another system with btrfs and get back at you.
â Oxwivi
Sep 4 '16 at 11:03
 |Â
show 6 more comments
up vote
17
down vote
up vote
17
down vote
I think, how to enable hibernate for 16.04 answer is known to all as described in the Ubuntu Wiki (See below if you need the steps). But The things that need checking isn't thorough I think. At least, that's what I found.
Things to check
From my own tests, I've at least found one extra check that you should perform. I haven't found about it anywhere in the Internet.
Here are some checkings -
Check that you're not using any btrfs partitions. Yes. From my test, I found that if you have btrfs partitions, hibernate will not work. Removing or changing the partition type to
ext4didn't help me. I needed to remove thebtrfs-toolspackage.sudo apt-get purge btrfs-toolsYou might want to check other new partition types which are not well tested. Without removing package, blacklisting the driver might also work, but I haven't tested that.
Also you need to check that you have a swap partition large enough to hold the content of RAM. If your RAM is 4 GB, swap should be at least 4 GB large ( You should allocate few more MB to be safe).
Steps to enable hibernate
It involves these steps
Create a file as root in
/etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklasudo -i nano /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklaPut these contents on that file
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yesSave the file by pressing Ctrl-O. Exit with Ctrl-X
Restart the
polkitddaemonsudo systemctl restart polkitd.service
It should enable hibernate.
I think, how to enable hibernate for 16.04 answer is known to all as described in the Ubuntu Wiki (See below if you need the steps). But The things that need checking isn't thorough I think. At least, that's what I found.
Things to check
From my own tests, I've at least found one extra check that you should perform. I haven't found about it anywhere in the Internet.
Here are some checkings -
Check that you're not using any btrfs partitions. Yes. From my test, I found that if you have btrfs partitions, hibernate will not work. Removing or changing the partition type to
ext4didn't help me. I needed to remove thebtrfs-toolspackage.sudo apt-get purge btrfs-toolsYou might want to check other new partition types which are not well tested. Without removing package, blacklisting the driver might also work, but I haven't tested that.
Also you need to check that you have a swap partition large enough to hold the content of RAM. If your RAM is 4 GB, swap should be at least 4 GB large ( You should allocate few more MB to be safe).
Steps to enable hibernate
It involves these steps
Create a file as root in
/etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklasudo -i nano /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pklaPut these contents on that file
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yesSave the file by pressing Ctrl-O. Exit with Ctrl-X
Restart the
polkitddaemonsudo systemctl restart polkitd.service
It should enable hibernate.
edited Apr 18 '17 at 5:22
answered Sep 3 '16 at 3:12
Anwar
54.9k20143249
54.9k20143249
1
Thanks, Anwar. I filed bug #1619846 and referred you your answer above. Any chance you could propose more exact changes/additions to that page in the official documentation?
â Gunnar Hjalmarsson
Sep 3 '16 at 4:57
@GunnarHjalmarsson I'd propose this caveat. But, I'll need more testers verifying this. Will let you know later
â Anwar
Sep 3 '16 at 5:54
Ok, let's talk more then.
â Gunnar Hjalmarsson
Sep 3 '16 at 6:00
I installed on a btrfs partition and purgedbtrfs-toolsaccording to your instructions. Still can't hibernate.
â Oxwivi
Sep 4 '16 at 9:04
1
On disk there's onlyvfatfor UEFI, andbtrfsandswap. I'm actually suspecting it's due to the hardware (AMD laptop). I'm going to test this on another system with btrfs and get back at you.
â Oxwivi
Sep 4 '16 at 11:03
 |Â
show 6 more comments
1
Thanks, Anwar. I filed bug #1619846 and referred you your answer above. Any chance you could propose more exact changes/additions to that page in the official documentation?
â Gunnar Hjalmarsson
Sep 3 '16 at 4:57
@GunnarHjalmarsson I'd propose this caveat. But, I'll need more testers verifying this. Will let you know later
â Anwar
Sep 3 '16 at 5:54
Ok, let's talk more then.
â Gunnar Hjalmarsson
Sep 3 '16 at 6:00
I installed on a btrfs partition and purgedbtrfs-toolsaccording to your instructions. Still can't hibernate.
â Oxwivi
Sep 4 '16 at 9:04
1
On disk there's onlyvfatfor UEFI, andbtrfsandswap. I'm actually suspecting it's due to the hardware (AMD laptop). I'm going to test this on another system with btrfs and get back at you.
â Oxwivi
Sep 4 '16 at 11:03
1
1
Thanks, Anwar. I filed bug #1619846 and referred you your answer above. Any chance you could propose more exact changes/additions to that page in the official documentation?
â Gunnar Hjalmarsson
Sep 3 '16 at 4:57
Thanks, Anwar. I filed bug #1619846 and referred you your answer above. Any chance you could propose more exact changes/additions to that page in the official documentation?
â Gunnar Hjalmarsson
Sep 3 '16 at 4:57
@GunnarHjalmarsson I'd propose this caveat. But, I'll need more testers verifying this. Will let you know later
â Anwar
Sep 3 '16 at 5:54
@GunnarHjalmarsson I'd propose this caveat. But, I'll need more testers verifying this. Will let you know later
â Anwar
Sep 3 '16 at 5:54
Ok, let's talk more then.
â Gunnar Hjalmarsson
Sep 3 '16 at 6:00
Ok, let's talk more then.
â Gunnar Hjalmarsson
Sep 3 '16 at 6:00
I installed on a btrfs partition and purged
btrfs-tools according to your instructions. Still can't hibernate.â Oxwivi
Sep 4 '16 at 9:04
I installed on a btrfs partition and purged
btrfs-tools according to your instructions. Still can't hibernate.â Oxwivi
Sep 4 '16 at 9:04
1
1
On disk there's only
vfat for UEFI, and btrfs and swap. I'm actually suspecting it's due to the hardware (AMD laptop). I'm going to test this on another system with btrfs and get back at you.â Oxwivi
Sep 4 '16 at 11:03
On disk there's only
vfat for UEFI, and btrfs and swap. I'm actually suspecting it's due to the hardware (AMD laptop). I'm going to test this on another system with btrfs and get back at you.â Oxwivi
Sep 4 '16 at 11:03
 |Â
show 6 more comments
up vote
4
down vote
Secure Boot
(I asked a similar question asking for a focus on systemd-based replies, sharing my solution here for people following this question)
This solution comes from Fedora topics (they made the switch to systemd a while ago so there's more material there).
In my case (fresh 16.04.1 install on a machine that always supported hibernation), calling the obsolete sudo pm-hibernate did not seem to do anything, and the up to date systemd approach, systemctl hibernate, would return:
Failed to hibernate system via logind: Sleep verb not supported
It turns out that secure boot was the culprit: installing 16.04 you are asked what you want to do with it (which is a new thing as far as I can recall) and I kept it ON without giving it much thought.
On my machine with secure boot ON, cat /sys/power/disk answered:
[disabled]
After reboot and disabling secure boot in the BIOS settings (these are machine-specific, but usually pretty straightforward) I tried a cat /sys/power/disk and got:
[platform] shutdown reboot suspend
which looks better. And indeed calling systemctl hibernate results in a successful hibernate/thaw sequence.
Moreover, after that I could see hibernation available as an option in various places of the graphical interface, without the need of any polkit hack. So it seems that systemd was actually guessing from /sys/power/disk that the system was not able to hibernate.
I did exactly what you have explained here. But after I execute "systemctl hibernate" command the screen got black for 3 seconds then the desktop went back with all my opened programs just like before I executed the command. When I executed the command "cat /sys/power/disk"... it shown me this text: "[platform] shutdown reboot suspend test_resume" which it's similar to the result when you executed the same from your side but the last text: "test_resume". Do you have an idea what I could try to solve my problem ?
â foxhard
May 6 at 16:58
Not too sure, looks like hibernation does not work out of the box on your hardware, which is why it is disabled by default as others pointed out. You might want to start a separate question about your specific issue.
â Marc
May 14 at 9:04
Only half-working for me. Hibernates but instead of waking up from hibernation, goes to normal boot, then gets stuck forever until a hard physical shutdown.
â matt
Jul 1 at 20:11
add a comment |Â
up vote
4
down vote
Secure Boot
(I asked a similar question asking for a focus on systemd-based replies, sharing my solution here for people following this question)
This solution comes from Fedora topics (they made the switch to systemd a while ago so there's more material there).
In my case (fresh 16.04.1 install on a machine that always supported hibernation), calling the obsolete sudo pm-hibernate did not seem to do anything, and the up to date systemd approach, systemctl hibernate, would return:
Failed to hibernate system via logind: Sleep verb not supported
It turns out that secure boot was the culprit: installing 16.04 you are asked what you want to do with it (which is a new thing as far as I can recall) and I kept it ON without giving it much thought.
On my machine with secure boot ON, cat /sys/power/disk answered:
[disabled]
After reboot and disabling secure boot in the BIOS settings (these are machine-specific, but usually pretty straightforward) I tried a cat /sys/power/disk and got:
[platform] shutdown reboot suspend
which looks better. And indeed calling systemctl hibernate results in a successful hibernate/thaw sequence.
Moreover, after that I could see hibernation available as an option in various places of the graphical interface, without the need of any polkit hack. So it seems that systemd was actually guessing from /sys/power/disk that the system was not able to hibernate.
I did exactly what you have explained here. But after I execute "systemctl hibernate" command the screen got black for 3 seconds then the desktop went back with all my opened programs just like before I executed the command. When I executed the command "cat /sys/power/disk"... it shown me this text: "[platform] shutdown reboot suspend test_resume" which it's similar to the result when you executed the same from your side but the last text: "test_resume". Do you have an idea what I could try to solve my problem ?
â foxhard
May 6 at 16:58
Not too sure, looks like hibernation does not work out of the box on your hardware, which is why it is disabled by default as others pointed out. You might want to start a separate question about your specific issue.
â Marc
May 14 at 9:04
Only half-working for me. Hibernates but instead of waking up from hibernation, goes to normal boot, then gets stuck forever until a hard physical shutdown.
â matt
Jul 1 at 20:11
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Secure Boot
(I asked a similar question asking for a focus on systemd-based replies, sharing my solution here for people following this question)
This solution comes from Fedora topics (they made the switch to systemd a while ago so there's more material there).
In my case (fresh 16.04.1 install on a machine that always supported hibernation), calling the obsolete sudo pm-hibernate did not seem to do anything, and the up to date systemd approach, systemctl hibernate, would return:
Failed to hibernate system via logind: Sleep verb not supported
It turns out that secure boot was the culprit: installing 16.04 you are asked what you want to do with it (which is a new thing as far as I can recall) and I kept it ON without giving it much thought.
On my machine with secure boot ON, cat /sys/power/disk answered:
[disabled]
After reboot and disabling secure boot in the BIOS settings (these are machine-specific, but usually pretty straightforward) I tried a cat /sys/power/disk and got:
[platform] shutdown reboot suspend
which looks better. And indeed calling systemctl hibernate results in a successful hibernate/thaw sequence.
Moreover, after that I could see hibernation available as an option in various places of the graphical interface, without the need of any polkit hack. So it seems that systemd was actually guessing from /sys/power/disk that the system was not able to hibernate.
Secure Boot
(I asked a similar question asking for a focus on systemd-based replies, sharing my solution here for people following this question)
This solution comes from Fedora topics (they made the switch to systemd a while ago so there's more material there).
In my case (fresh 16.04.1 install on a machine that always supported hibernation), calling the obsolete sudo pm-hibernate did not seem to do anything, and the up to date systemd approach, systemctl hibernate, would return:
Failed to hibernate system via logind: Sleep verb not supported
It turns out that secure boot was the culprit: installing 16.04 you are asked what you want to do with it (which is a new thing as far as I can recall) and I kept it ON without giving it much thought.
On my machine with secure boot ON, cat /sys/power/disk answered:
[disabled]
After reboot and disabling secure boot in the BIOS settings (these are machine-specific, but usually pretty straightforward) I tried a cat /sys/power/disk and got:
[platform] shutdown reboot suspend
which looks better. And indeed calling systemctl hibernate results in a successful hibernate/thaw sequence.
Moreover, after that I could see hibernation available as an option in various places of the graphical interface, without the need of any polkit hack. So it seems that systemd was actually guessing from /sys/power/disk that the system was not able to hibernate.
edited Apr 13 '17 at 12:23
Communityâ¦
1
1
answered Jan 11 '17 at 6:50
Marc
4921311
4921311
I did exactly what you have explained here. But after I execute "systemctl hibernate" command the screen got black for 3 seconds then the desktop went back with all my opened programs just like before I executed the command. When I executed the command "cat /sys/power/disk"... it shown me this text: "[platform] shutdown reboot suspend test_resume" which it's similar to the result when you executed the same from your side but the last text: "test_resume". Do you have an idea what I could try to solve my problem ?
â foxhard
May 6 at 16:58
Not too sure, looks like hibernation does not work out of the box on your hardware, which is why it is disabled by default as others pointed out. You might want to start a separate question about your specific issue.
â Marc
May 14 at 9:04
Only half-working for me. Hibernates but instead of waking up from hibernation, goes to normal boot, then gets stuck forever until a hard physical shutdown.
â matt
Jul 1 at 20:11
add a comment |Â
I did exactly what you have explained here. But after I execute "systemctl hibernate" command the screen got black for 3 seconds then the desktop went back with all my opened programs just like before I executed the command. When I executed the command "cat /sys/power/disk"... it shown me this text: "[platform] shutdown reboot suspend test_resume" which it's similar to the result when you executed the same from your side but the last text: "test_resume". Do you have an idea what I could try to solve my problem ?
â foxhard
May 6 at 16:58
Not too sure, looks like hibernation does not work out of the box on your hardware, which is why it is disabled by default as others pointed out. You might want to start a separate question about your specific issue.
â Marc
May 14 at 9:04
Only half-working for me. Hibernates but instead of waking up from hibernation, goes to normal boot, then gets stuck forever until a hard physical shutdown.
â matt
Jul 1 at 20:11
I did exactly what you have explained here. But after I execute "systemctl hibernate" command the screen got black for 3 seconds then the desktop went back with all my opened programs just like before I executed the command. When I executed the command "cat /sys/power/disk"... it shown me this text: "[platform] shutdown reboot suspend test_resume" which it's similar to the result when you executed the same from your side but the last text: "test_resume". Do you have an idea what I could try to solve my problem ?
â foxhard
May 6 at 16:58
I did exactly what you have explained here. But after I execute "systemctl hibernate" command the screen got black for 3 seconds then the desktop went back with all my opened programs just like before I executed the command. When I executed the command "cat /sys/power/disk"... it shown me this text: "[platform] shutdown reboot suspend test_resume" which it's similar to the result when you executed the same from your side but the last text: "test_resume". Do you have an idea what I could try to solve my problem ?
â foxhard
May 6 at 16:58
Not too sure, looks like hibernation does not work out of the box on your hardware, which is why it is disabled by default as others pointed out. You might want to start a separate question about your specific issue.
â Marc
May 14 at 9:04
Not too sure, looks like hibernation does not work out of the box on your hardware, which is why it is disabled by default as others pointed out. You might want to start a separate question about your specific issue.
â Marc
May 14 at 9:04
Only half-working for me. Hibernates but instead of waking up from hibernation, goes to normal boot, then gets stuck forever until a hard physical shutdown.
â matt
Jul 1 at 20:11
Only half-working for me. Hibernates but instead of waking up from hibernation, goes to normal boot, then gets stuck forever until a hard physical shutdown.
â matt
Jul 1 at 20:11
add a comment |Â
up vote
2
down vote
First, I do recommend that you test if your machine supports hibernation, because the reason why hibernation is disabled by default is because it sometimes has unpleasant results on some machines. Test your machine by opening the terminal (Ctrl+Alt+T) and then typing sudo pm-hibernate
Your machine should hibernate. Wake your machine up after hibernation and observe if it misbehaves or if it acts normally.
If you experience any abnormality after the hibernation, then I advise you don't continue with the following procedure. However, if it works just fine, continue to activate hibernation by doing this:
sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Edit the opened file and add this lines:
[Re-enable hibernation]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
After this, restart your machine, and after logging in, you should see a hibernation option added on the power menu, on the top right settings corner.
I have thinkpad -E550 and it has no problem with hibernation when my OS is ubuntu 15.1 or windows8.1 . but using ubuntu 16.04 , when i use the command "sudo pm-hibernate" , it does not completely hibernate and just the screen goes black and the machine is still on.
â Mahyar
May 6 '16 at 18:14
In my case, the command does nothing at all. The terminal goes to the newline and awaits next command i.e. previous command has been executed. But it does nothingat all
â Aalok
Jul 17 '16 at 18:01
This doesn't work for me. Ubuntu 16.04. The Hibernate option do not come up and stay disable in Settings -> Power, anything else?
â Daniele Segato
Aug 7 '16 at 17:02
Editing the already existing policy is better: zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04
â fgblomqvist
Aug 24 '16 at 1:41
Incomplete contents incom.ubuntu.enable-hibernate.pkla. See answer posted by NirajW.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:31
 |Â
show 1 more comment
up vote
2
down vote
First, I do recommend that you test if your machine supports hibernation, because the reason why hibernation is disabled by default is because it sometimes has unpleasant results on some machines. Test your machine by opening the terminal (Ctrl+Alt+T) and then typing sudo pm-hibernate
Your machine should hibernate. Wake your machine up after hibernation and observe if it misbehaves or if it acts normally.
If you experience any abnormality after the hibernation, then I advise you don't continue with the following procedure. However, if it works just fine, continue to activate hibernation by doing this:
sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Edit the opened file and add this lines:
[Re-enable hibernation]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
After this, restart your machine, and after logging in, you should see a hibernation option added on the power menu, on the top right settings corner.
I have thinkpad -E550 and it has no problem with hibernation when my OS is ubuntu 15.1 or windows8.1 . but using ubuntu 16.04 , when i use the command "sudo pm-hibernate" , it does not completely hibernate and just the screen goes black and the machine is still on.
â Mahyar
May 6 '16 at 18:14
In my case, the command does nothing at all. The terminal goes to the newline and awaits next command i.e. previous command has been executed. But it does nothingat all
â Aalok
Jul 17 '16 at 18:01
This doesn't work for me. Ubuntu 16.04. The Hibernate option do not come up and stay disable in Settings -> Power, anything else?
â Daniele Segato
Aug 7 '16 at 17:02
Editing the already existing policy is better: zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04
â fgblomqvist
Aug 24 '16 at 1:41
Incomplete contents incom.ubuntu.enable-hibernate.pkla. See answer posted by NirajW.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:31
 |Â
show 1 more comment
up vote
2
down vote
up vote
2
down vote
First, I do recommend that you test if your machine supports hibernation, because the reason why hibernation is disabled by default is because it sometimes has unpleasant results on some machines. Test your machine by opening the terminal (Ctrl+Alt+T) and then typing sudo pm-hibernate
Your machine should hibernate. Wake your machine up after hibernation and observe if it misbehaves or if it acts normally.
If you experience any abnormality after the hibernation, then I advise you don't continue with the following procedure. However, if it works just fine, continue to activate hibernation by doing this:
sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Edit the opened file and add this lines:
[Re-enable hibernation]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
After this, restart your machine, and after logging in, you should see a hibernation option added on the power menu, on the top right settings corner.
First, I do recommend that you test if your machine supports hibernation, because the reason why hibernation is disabled by default is because it sometimes has unpleasant results on some machines. Test your machine by opening the terminal (Ctrl+Alt+T) and then typing sudo pm-hibernate
Your machine should hibernate. Wake your machine up after hibernation and observe if it misbehaves or if it acts normally.
If you experience any abnormality after the hibernation, then I advise you don't continue with the following procedure. However, if it works just fine, continue to activate hibernation by doing this:
sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Edit the opened file and add this lines:
[Re-enable hibernation]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
After this, restart your machine, and after logging in, you should see a hibernation option added on the power menu, on the top right settings corner.
answered May 6 '16 at 7:53
kelvinelove
1,51911326
1,51911326
I have thinkpad -E550 and it has no problem with hibernation when my OS is ubuntu 15.1 or windows8.1 . but using ubuntu 16.04 , when i use the command "sudo pm-hibernate" , it does not completely hibernate and just the screen goes black and the machine is still on.
â Mahyar
May 6 '16 at 18:14
In my case, the command does nothing at all. The terminal goes to the newline and awaits next command i.e. previous command has been executed. But it does nothingat all
â Aalok
Jul 17 '16 at 18:01
This doesn't work for me. Ubuntu 16.04. The Hibernate option do not come up and stay disable in Settings -> Power, anything else?
â Daniele Segato
Aug 7 '16 at 17:02
Editing the already existing policy is better: zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04
â fgblomqvist
Aug 24 '16 at 1:41
Incomplete contents incom.ubuntu.enable-hibernate.pkla. See answer posted by NirajW.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:31
 |Â
show 1 more comment
I have thinkpad -E550 and it has no problem with hibernation when my OS is ubuntu 15.1 or windows8.1 . but using ubuntu 16.04 , when i use the command "sudo pm-hibernate" , it does not completely hibernate and just the screen goes black and the machine is still on.
â Mahyar
May 6 '16 at 18:14
In my case, the command does nothing at all. The terminal goes to the newline and awaits next command i.e. previous command has been executed. But it does nothingat all
â Aalok
Jul 17 '16 at 18:01
This doesn't work for me. Ubuntu 16.04. The Hibernate option do not come up and stay disable in Settings -> Power, anything else?
â Daniele Segato
Aug 7 '16 at 17:02
Editing the already existing policy is better: zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04
â fgblomqvist
Aug 24 '16 at 1:41
Incomplete contents incom.ubuntu.enable-hibernate.pkla. See answer posted by NirajW.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:31
I have thinkpad -E550 and it has no problem with hibernation when my OS is ubuntu 15.1 or windows8.1 . but using ubuntu 16.04 , when i use the command "sudo pm-hibernate" , it does not completely hibernate and just the screen goes black and the machine is still on.
â Mahyar
May 6 '16 at 18:14
I have thinkpad -E550 and it has no problem with hibernation when my OS is ubuntu 15.1 or windows8.1 . but using ubuntu 16.04 , when i use the command "sudo pm-hibernate" , it does not completely hibernate and just the screen goes black and the machine is still on.
â Mahyar
May 6 '16 at 18:14
In my case, the command does nothing at all. The terminal goes to the newline and awaits next command i.e. previous command has been executed. But it does nothing
at allâ Aalok
Jul 17 '16 at 18:01
In my case, the command does nothing at all. The terminal goes to the newline and awaits next command i.e. previous command has been executed. But it does nothing
at allâ Aalok
Jul 17 '16 at 18:01
This doesn't work for me. Ubuntu 16.04. The Hibernate option do not come up and stay disable in Settings -> Power, anything else?
â Daniele Segato
Aug 7 '16 at 17:02
This doesn't work for me. Ubuntu 16.04. The Hibernate option do not come up and stay disable in Settings -> Power, anything else?
â Daniele Segato
Aug 7 '16 at 17:02
Editing the already existing policy is better: zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04
â fgblomqvist
Aug 24 '16 at 1:41
Editing the already existing policy is better: zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04
â fgblomqvist
Aug 24 '16 at 1:41
Incomplete contents in
com.ubuntu.enable-hibernate.pkla. See answer posted by NirajW.â Gunnar Hjalmarsson
Sep 2 '16 at 6:31
Incomplete contents in
com.ubuntu.enable-hibernate.pkla. See answer posted by NirajW.â Gunnar Hjalmarsson
Sep 2 '16 at 6:31
 |Â
show 1 more comment
up vote
2
down vote
Expanding on my own comment to kelvinelove's answer, the file he suggests editing did not exist on my system (fresh Ubuntu 16.04). Instead, I did this:
sudo nano /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pklaLook for these sections (they are right by each other):
[Disable hibernate by default in upower] Identity=unix-user:*
Action=org.freedesktop.upower.hibernate ResultActive=no
[Disable hibernate by default in logind] Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;
ResultActive=noChange ResultActive=no to ResultActive=yes for both of them.
- Press Ctrl + O to save the file.
- Reboot your computer
- The Hibernate option is now available in your power menus.
EDIT: Gunnar pointed out that this file gets overwritten if a certain package gets updated, so depending on your intentions it is most likely not the best solution.
Source: http://www.zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04/
The file in/etcis not supposed to exists by default. It's a configuration file which you create. Editing a package owned file, as you suggest above, is bad advice, since it will be overwritten at next package update.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:11
@GunnarHjalmarsson If that's the case I would argue that it should be stated that it might not exist. I expect more from a top rated Ask Ubuntu answer than a "copy/paste this command"->"type this" -style answer that lacks any kind of verification of whether you are doing the right thing (other than checking if it worked). What if someone finds that answer in a couple of years, but is afraid of trying it since the file is empty, and the instructions clearly state to add to the file, implying that it exists? Nonetheless, I appreciate the information, will add it to the answer for completion.
â fgblomqvist
Sep 3 '16 at 1:05
1
Fair point; I edited NirajW's answer with that clarification. It should be noted that the original source of info at this page talks about creation.
â Gunnar Hjalmarsson
Sep 3 '16 at 5:16
add a comment |Â
up vote
2
down vote
Expanding on my own comment to kelvinelove's answer, the file he suggests editing did not exist on my system (fresh Ubuntu 16.04). Instead, I did this:
sudo nano /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pklaLook for these sections (they are right by each other):
[Disable hibernate by default in upower] Identity=unix-user:*
Action=org.freedesktop.upower.hibernate ResultActive=no
[Disable hibernate by default in logind] Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;
ResultActive=noChange ResultActive=no to ResultActive=yes for both of them.
- Press Ctrl + O to save the file.
- Reboot your computer
- The Hibernate option is now available in your power menus.
EDIT: Gunnar pointed out that this file gets overwritten if a certain package gets updated, so depending on your intentions it is most likely not the best solution.
Source: http://www.zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04/
The file in/etcis not supposed to exists by default. It's a configuration file which you create. Editing a package owned file, as you suggest above, is bad advice, since it will be overwritten at next package update.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:11
@GunnarHjalmarsson If that's the case I would argue that it should be stated that it might not exist. I expect more from a top rated Ask Ubuntu answer than a "copy/paste this command"->"type this" -style answer that lacks any kind of verification of whether you are doing the right thing (other than checking if it worked). What if someone finds that answer in a couple of years, but is afraid of trying it since the file is empty, and the instructions clearly state to add to the file, implying that it exists? Nonetheless, I appreciate the information, will add it to the answer for completion.
â fgblomqvist
Sep 3 '16 at 1:05
1
Fair point; I edited NirajW's answer with that clarification. It should be noted that the original source of info at this page talks about creation.
â Gunnar Hjalmarsson
Sep 3 '16 at 5:16
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Expanding on my own comment to kelvinelove's answer, the file he suggests editing did not exist on my system (fresh Ubuntu 16.04). Instead, I did this:
sudo nano /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pklaLook for these sections (they are right by each other):
[Disable hibernate by default in upower] Identity=unix-user:*
Action=org.freedesktop.upower.hibernate ResultActive=no
[Disable hibernate by default in logind] Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;
ResultActive=noChange ResultActive=no to ResultActive=yes for both of them.
- Press Ctrl + O to save the file.
- Reboot your computer
- The Hibernate option is now available in your power menus.
EDIT: Gunnar pointed out that this file gets overwritten if a certain package gets updated, so depending on your intentions it is most likely not the best solution.
Source: http://www.zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04/
Expanding on my own comment to kelvinelove's answer, the file he suggests editing did not exist on my system (fresh Ubuntu 16.04). Instead, I did this:
sudo nano /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pklaLook for these sections (they are right by each other):
[Disable hibernate by default in upower] Identity=unix-user:*
Action=org.freedesktop.upower.hibernate ResultActive=no
[Disable hibernate by default in logind] Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;
ResultActive=noChange ResultActive=no to ResultActive=yes for both of them.
- Press Ctrl + O to save the file.
- Reboot your computer
- The Hibernate option is now available in your power menus.
EDIT: Gunnar pointed out that this file gets overwritten if a certain package gets updated, so depending on your intentions it is most likely not the best solution.
Source: http://www.zedt.eu/tech/linux/enable-hibernation-xubuntu-16-04/
edited Sep 3 '16 at 1:07
answered Aug 24 '16 at 1:47
fgblomqvist
1429
1429
The file in/etcis not supposed to exists by default. It's a configuration file which you create. Editing a package owned file, as you suggest above, is bad advice, since it will be overwritten at next package update.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:11
@GunnarHjalmarsson If that's the case I would argue that it should be stated that it might not exist. I expect more from a top rated Ask Ubuntu answer than a "copy/paste this command"->"type this" -style answer that lacks any kind of verification of whether you are doing the right thing (other than checking if it worked). What if someone finds that answer in a couple of years, but is afraid of trying it since the file is empty, and the instructions clearly state to add to the file, implying that it exists? Nonetheless, I appreciate the information, will add it to the answer for completion.
â fgblomqvist
Sep 3 '16 at 1:05
1
Fair point; I edited NirajW's answer with that clarification. It should be noted that the original source of info at this page talks about creation.
â Gunnar Hjalmarsson
Sep 3 '16 at 5:16
add a comment |Â
The file in/etcis not supposed to exists by default. It's a configuration file which you create. Editing a package owned file, as you suggest above, is bad advice, since it will be overwritten at next package update.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:11
@GunnarHjalmarsson If that's the case I would argue that it should be stated that it might not exist. I expect more from a top rated Ask Ubuntu answer than a "copy/paste this command"->"type this" -style answer that lacks any kind of verification of whether you are doing the right thing (other than checking if it worked). What if someone finds that answer in a couple of years, but is afraid of trying it since the file is empty, and the instructions clearly state to add to the file, implying that it exists? Nonetheless, I appreciate the information, will add it to the answer for completion.
â fgblomqvist
Sep 3 '16 at 1:05
1
Fair point; I edited NirajW's answer with that clarification. It should be noted that the original source of info at this page talks about creation.
â Gunnar Hjalmarsson
Sep 3 '16 at 5:16
The file in
/etc is not supposed to exists by default. It's a configuration file which you create. Editing a package owned file, as you suggest above, is bad advice, since it will be overwritten at next package update.â Gunnar Hjalmarsson
Sep 2 '16 at 6:11
The file in
/etc is not supposed to exists by default. It's a configuration file which you create. Editing a package owned file, as you suggest above, is bad advice, since it will be overwritten at next package update.â Gunnar Hjalmarsson
Sep 2 '16 at 6:11
@GunnarHjalmarsson If that's the case I would argue that it should be stated that it might not exist. I expect more from a top rated Ask Ubuntu answer than a "copy/paste this command"->"type this" -style answer that lacks any kind of verification of whether you are doing the right thing (other than checking if it worked). What if someone finds that answer in a couple of years, but is afraid of trying it since the file is empty, and the instructions clearly state to add to the file, implying that it exists? Nonetheless, I appreciate the information, will add it to the answer for completion.
â fgblomqvist
Sep 3 '16 at 1:05
@GunnarHjalmarsson If that's the case I would argue that it should be stated that it might not exist. I expect more from a top rated Ask Ubuntu answer than a "copy/paste this command"->"type this" -style answer that lacks any kind of verification of whether you are doing the right thing (other than checking if it worked). What if someone finds that answer in a couple of years, but is afraid of trying it since the file is empty, and the instructions clearly state to add to the file, implying that it exists? Nonetheless, I appreciate the information, will add it to the answer for completion.
â fgblomqvist
Sep 3 '16 at 1:05
1
1
Fair point; I edited NirajW's answer with that clarification. It should be noted that the original source of info at this page talks about creation.
â Gunnar Hjalmarsson
Sep 3 '16 at 5:16
Fair point; I edited NirajW's answer with that clarification. It should be noted that the original source of info at this page talks about creation.
â Gunnar Hjalmarsson
Sep 3 '16 at 5:16
add a comment |Â
up vote
2
down vote
There are some very good resources here to help you sort out some of the more common hibernate issues under Ubuntu.
In my case, running Ubuntu 16.10 on a Lenovo u300s, in order for hibernate to work correctly I had to do the following:
- Create an appropriately-sized swap file (I typically set for ~1x in
size, but I've heard up to 1.6x and 2x) Edit
/etc/default/grubto include the following line:GRUB_CMDLINE_LINUX_DEFAULT="splash quiet pci=nomsi RESUME=UUID=92781adb-f2a6-4f15-88fc-e1ce801291dd"
The RESUME refers to your specific swap file UUID. In particular, on my machine setting pci=nomsi was the key.
Best of luck!
add a comment |Â
up vote
2
down vote
There are some very good resources here to help you sort out some of the more common hibernate issues under Ubuntu.
In my case, running Ubuntu 16.10 on a Lenovo u300s, in order for hibernate to work correctly I had to do the following:
- Create an appropriately-sized swap file (I typically set for ~1x in
size, but I've heard up to 1.6x and 2x) Edit
/etc/default/grubto include the following line:GRUB_CMDLINE_LINUX_DEFAULT="splash quiet pci=nomsi RESUME=UUID=92781adb-f2a6-4f15-88fc-e1ce801291dd"
The RESUME refers to your specific swap file UUID. In particular, on my machine setting pci=nomsi was the key.
Best of luck!
add a comment |Â
up vote
2
down vote
up vote
2
down vote
There are some very good resources here to help you sort out some of the more common hibernate issues under Ubuntu.
In my case, running Ubuntu 16.10 on a Lenovo u300s, in order for hibernate to work correctly I had to do the following:
- Create an appropriately-sized swap file (I typically set for ~1x in
size, but I've heard up to 1.6x and 2x) Edit
/etc/default/grubto include the following line:GRUB_CMDLINE_LINUX_DEFAULT="splash quiet pci=nomsi RESUME=UUID=92781adb-f2a6-4f15-88fc-e1ce801291dd"
The RESUME refers to your specific swap file UUID. In particular, on my machine setting pci=nomsi was the key.
Best of luck!
There are some very good resources here to help you sort out some of the more common hibernate issues under Ubuntu.
In my case, running Ubuntu 16.10 on a Lenovo u300s, in order for hibernate to work correctly I had to do the following:
- Create an appropriately-sized swap file (I typically set for ~1x in
size, but I've heard up to 1.6x and 2x) Edit
/etc/default/grubto include the following line:GRUB_CMDLINE_LINUX_DEFAULT="splash quiet pci=nomsi RESUME=UUID=92781adb-f2a6-4f15-88fc-e1ce801291dd"
The RESUME refers to your specific swap file UUID. In particular, on my machine setting pci=nomsi was the key.
Best of luck!
answered Nov 14 '16 at 0:34
richbl
1,2881918
1,2881918
add a comment |Â
add a comment |Â
up vote
1
down vote
For me, it works to install hibernate package, reboot and then run sudo hibernate-disk. I am sure it is possible to add it to menu, but is not worth the time for me.
add a comment |Â
up vote
1
down vote
For me, it works to install hibernate package, reboot and then run sudo hibernate-disk. I am sure it is possible to add it to menu, but is not worth the time for me.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
For me, it works to install hibernate package, reboot and then run sudo hibernate-disk. I am sure it is possible to add it to menu, but is not worth the time for me.
For me, it works to install hibernate package, reboot and then run sudo hibernate-disk. I am sure it is possible to add it to menu, but is not worth the time for me.
answered Nov 18 '16 at 7:54
Aiphee
668412
668412
add a comment |Â
add a comment |Â
up vote
0
down vote
You have to manually enable it with a little effort. It's been disabled by default.
http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04/
Then, if it doesn't work, it's might be a 4.4.0 kernel issue, and you might have to upgrade kernel.
1
The answer referes to 14.04, while the question is about 16.04.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:08
add a comment |Â
up vote
0
down vote
You have to manually enable it with a little effort. It's been disabled by default.
http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04/
Then, if it doesn't work, it's might be a 4.4.0 kernel issue, and you might have to upgrade kernel.
1
The answer referes to 14.04, while the question is about 16.04.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:08
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You have to manually enable it with a little effort. It's been disabled by default.
http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04/
Then, if it doesn't work, it's might be a 4.4.0 kernel issue, and you might have to upgrade kernel.
You have to manually enable it with a little effort. It's been disabled by default.
http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04/
Then, if it doesn't work, it's might be a 4.4.0 kernel issue, and you might have to upgrade kernel.
answered May 5 '16 at 19:39
Mookey
2,855112354
2,855112354
1
The answer referes to 14.04, while the question is about 16.04.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:08
add a comment |Â
1
The answer referes to 14.04, while the question is about 16.04.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:08
1
1
The answer referes to 14.04, while the question is about 16.04.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:08
The answer referes to 14.04, while the question is about 16.04.
â Gunnar Hjalmarsson
Sep 2 '16 at 6:08
add a comment |Â
protected by Community⦠Jan 3 '17 at 12:34
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
2
Possible duplicate of How to enable hibernation?
â DJCrashdummy
Jul 31 '16 at 16:20
Does
sudo pm-hibernatework?â Pilot6
Aug 1 '16 at 9:01
2
hasn't the situation changed with systemd? now we are meant to use
systemctl hibernateso perhaps not a dupe... or at least updated answer may be required to make the old question valid to dupeâ Zanna
Aug 1 '16 at 21:03
What kernel version are you running? Type
uname -rin the terminal (apologies if you already knew this).â WinEunuuchs2Unix
Sep 2 '16 at 1:47
please edit your question and add the output of
freeso we can determine if you have enough swap setup to successfully hibernate.â Elder Geek
Sep 4 '16 at 18:15