hibernate to disk not restoring, but suspend to ram is working
Solution 1
I've just had to deal with this on a laptop running Debian Testing (Jessie/Sid).
Possibly relevant: swap partition on an LVM volume (non-encrypted) at /dev/vg1/swap
.
To make the system resume after hibernation, I had to edit /etc/default/grub
and change
GRUB_CMDLINE_LINUX=""
to
GRUB_CMDLINE_LINUX="resume=/dev/mapper/vg1-swap"
and then run update-grub
.
If you'd rather the kernel didn't check for resume images when you choose a recovery option from the GRUB menu, you'd want to modify GRUB_CMDLINE_LINUX_DEFAULT
instead of GRUB_CMDLINE_LINUX
.
I would have expected update-grub
to write any necessary resume=
parameters into /boot/grub/grub.cfg
on its own, without my needing to be this explicit about it.
However, the only mention of resume=
inside the script fragments in /etc/grub.d
is in a piece that has something to do with OSX support. Not sure what's going on there.
Solution 2
This is a common issue for hibernate and suspend in Ubuntu / Debian.
install uswsusp
sudo apt-get install uswsusp
then try the following for suspend and hibernate respectively,
sudo s2ram
sudo s2disk
if it works, then you can make it permanent, back up the following,
sudo cp /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux.bak
sudo cp /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux.bak
and edit the following,
/usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
#!/bin/sh
/sbin/s2ram –force
/usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux
#!/bin/sh
/sbin/s2disk
Solution 3
# update-initramfs -u
This was the missing piece in my similar case. When resume from a successful hibernate started failing, after changing the swap partition. A lot of advice suggested the grub command-line fix (like mentioned in earlier answer here).
However on my system (Ubuntu 14.04) hibernate used to work OK, without the resume parameter in grub, before the change to the swap partition. So I realized there must be some other way the resume is handled.
The sequence to enable the hibernate/resume after changes to swap partition change (after a new UUID has been assigned to the swap partition device, per blkid
or ls /dev/disk/by-uuid -la
):
- Edit
/etc/fstab
to change to the swap's new UUID - Edit
/etc/initramfs-tools/conf.d/resume
to reflect the new swap's UUID - Run
update-initramfs -u
to rebuild the/boot/initrd.img*
- Reboot
Thanks to @Demis Palma!
Solution 4
If you have change your hard disk or the partition table, then your computer will save a session, but it won't be able to resume it upon power up, acting as if it was rebooted rather than hibernated.
In this case, you have to inform initramfs-tools about the correct partition uuid. First of all, take note of the id of your swap partition with
$ ls /dev/disk/by-uuid -la
Then, edit the file /etc/initramfs-tools/conf.d/resume accordingly.
Finally update initramfs with
# update-initramfs -u
It it still doesn't work, try to specify the restore partition to Grub too. However, it should not be necessary.
Edit the file /etc/default/grub specifying the UUID of your swap partition:
GRUB_CMDLINE_LINUX="resume=UUID=6098d082-4654-4840-8937-7337d14b2c5d other-option=value"
or simply use the device
GRUB_CMDLINE_LINUX="resume=/dev/sda1 other-option=value"
Don't forget to update Grub.
# update-grub
Reboot, and try to hibernate:
# pm-hibernate
Related videos on Youtube
ctrl-alt-delor
A software engineer, programmer, project manager, Gnu+Linux user, Newly Qualified Teacher of computing. I am currently hanging out on A new site for computer science and IT educators. Visit the site here
Updated on September 17, 2022Comments
-
ctrl-alt-delor over 1 year
I have Debian 6, I have also seen this under Ubuntu (can not remember how I fixed it).
I can hibernate, but when I switch on the system cold boots (it does not restore previous session).
Note suspend works fine. Have looked in
/var/log/pm-suspend.log
Shows for eachsuspend suspend
block aresume suspend
block, buthibernate hibernate' is not followed by
resume hibernate` ( I assume that is what is expected.
Installed package hibernate, as was thinking it may be needed, but made no difference.
I just started looking and can't find
/usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux
or/usr/lib/hal
I searched for power files (is it all there?:find /usr/lib -iname "*power*" /usr/lib/libupower-glib.so.1 /usr/lib/klibc/bin/poweroff /usr/lib/python2.6/dist-packages/axiom/test/test_powerup.pyc /usr/lib/python2.6/dist-packages/axiom/test/test_powerup.py /usr/lib/upower /usr/lib/upower/upowerd /usr/lib/libupower-glib.so.1.0.1 /usr/lib/gnome-power-manager /usr/lib/pymodules/python2.6/OpenGL/raw/GL/ARB/texture_non_power_of_two.pyc /usr/lib/pymodules/python2.6/OpenGL/raw/GL/ARB/texture_non_power_of_two.py /usr/lib/pymodules/python2.6/OpenGL/GL/ARB/texture_non_power_of_two.pyc /usr/lib/pymodules/python2.6/OpenGL/GL/ARB/texture_non_power_of_two.py /usr/lib/pymodules/python2.6/coherence/upnp/services/servers/switch_power_server.py /usr/lib/pymodules/python2.6/coherence/upnp/services/servers/switch_power_server.pyc /usr/lib/pymodules/python2.6/coherence/upnp/services/clients/switch_power_client.pyc /usr/lib/pymodules/python2.6/coherence/upnp/services/clients/test/test_switch_power_client.py /usr/lib/pymodules/python2.6/coherence/upnp/services/clients/test/test_switch_power_client.pyc /usr/lib/pymodules/python2.6/coherence/upnp/services/clients/switch_power_client.py /usr/lib/pymodules/python2.6/coherence/upnp/core/xml-service-descriptions/SwitchPower1.xml /usr/lib/pm-utils/power.d /usr/lib/pm-utils/power.d/sched-powersave /usr/lib/pm-utils/sleep.d/00powersave /usr/lib/rhythmbox/plugins/power-manager /usr/lib/rhythmbox/plugins/power-manager/libpower-manager.so /usr/lib/rhythmbox/plugins/power-manager/power-manager.rb-plugin
-
Gilles 'SO- stop being evil' about 13 yearsDo you have a swap partition or just a swap file? Hibernating to a swap file is supported in theory but sometimes requires some hand-holding. Swap partitions should work out of the box (at least they do on Debian 5).
-
ctrl-alt-delor about 13 yearsit is a partition
-
ctrl-alt-delor about 13 yearsThis issue has now fixed it self, there is nothing in synaptics history to say that I installed something to fix it. It may have been an update, are these in the same history log? BUT Redetection of my 'option' modem is now slower.
-
-
setzamora about 13 yearsright, let us know the result. you need to install the proper drivers for it to work. this is just an alternative.
-
ctrl-alt-delor about 13 yearscan't find
/usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux
see question -
ctrl-alt-delor about 13 yearsI have discovered that the uswsusp package is missing from debian squeeze. I could get it from testing or unstable repository, but have to be careful about not pulling in other dependencies. I would like to know if it will fix it. Is uswsusp needed for hibernate. Or should pm-utils be enough. (suspend it ram is working fine.)
-
ctrl-alt-delor over 4 yearsThanks. Looks promising (I can't test now, I will the next time things go wrong).
-
Indacochea Wachín over 3 yearsAmazing, working for me: sudo s2ram
-
Sufian over 2 yearsWorked on Debian 11 Bullseye with a small change. Instead of
resume=/dev/mapper/vg1-swap
, I wroteresume=UUID=1603aad4-2435-4da2-9520-c21b70fa9be3
where1603aad4-2435-4da2-9520-c21b70fa9be3
is the UUID of my swap partition. To get the UUID, I ranls /dev/disk/by-uuid -la
and took the UUID against the../../sda3
entry (my swap partition)