Resume from Hibernate Failed on Ubuntu Gutsy Gibbon

For many years I’ve enjoyed the reliability of the Ubuntu/Kubuntu Linux hibernate functionality (just the opposite of Windows). However, today it actually failed. When I powered up the system, it didn’t resume from the swap file. Instead, it just booted up as if I had previously killed the power.

Upon checking into the problem, I noticed that the UUID for the swap partition had changed. I don’t know why. After much hunting and trial-and-error, I was able to reinitialize the swap partition, update the necessary config files and get the system to resume from hibernate once again.

1. First, you need to know the /dev path to your swap file (e.g. /dev/hda2). If you don’t know what it is, take a look inside the /etc/fstab file. In the recent versions of Ubuntu, there is a comment above each device’s UUID entry to tell you what path it points to. Look for a line with

UUID=a-bunch-of-letters-and-numbers none swap sw 0 0

On the line above it should be a comment that says what partition it is (e.g. # /dev/hda2)

Now, armed with that information, do the following:

2. sudo mkswap /dev/your-swap-partition
For /dev/your-swap-partition, fill in the swap partition path you found in the /etc/fstab file. This will reinitialize your swap partition and create a new UUID. Copy down the new UUID (e.g. copy it to the clipboard).

3. sudo gedit /etc/fstab
Look for the same UUID= line from step #1 (the one for your swap partition). Replace the existing UUID value with the new one that you copied in step #2. Then, save the file.

4. sudo gedit /etc/initramfs-tools/conf.d/resume
Replace the old UUID value that appears after RESUME=UUID= in the file with the new value from step #2. Save.

5. cd /dev/disk/by-uuid
This directory contains symlinks from UUIDs to actual partitions.

6. sudo rm your-old-UUID
Enter the old UUID for the swap partition in place of your-old-UUID. This will remove the old, incorrect symlink.

7. sudo ln -s ../../your-swap-partition your-new-UUID
Now, create a new symlink from your swap partition to the new UUID.

8. sudo swapon -va
This will mount the swap partition based on the UUID settings you entered. If it succeeds, you didn’t make any mistakes. If it fails, then you need to verify that you have the correct UUID and partitions in the steps above.

9. sudo update-initramfs -u
This will create a new initramfs image. When it’s done, you’ll be able to hibernate and resume again.

That was a really weird problem. Thanks to a combination of techniques from these two sources, I was able to get it back to normal:

Suddenly my swap drive was missing
Kubuntu Edgy: swap failed when awaken from hibernate

28 thoughts on “Resume from Hibernate Failed on Ubuntu Gutsy Gibbon”

  1. thanks for the nice guide. i spent a couple hours this morning trying to fix this, and all the other forums i looked at included SOME of these steps, but not all. but, everything seems to be working now. i should note that after i completed the steps outlined here, i had to reboot normally once BEFORE trying to initiate hibernate. when i tried hibernating right away, it annihilated my swap again.

  2. You’re welcome, Ben. Glad it helped. Thanks for the tip on rebooting. I didn’t need to but apparently others might so thanks for the feedback.

  3. Thanks for this description,Ben! You made my day!!
    Wasn’t able to resume for months now, as i did not find the init-ramfs configuration…

    And now it works again! :-))

  4. Hi!

    Finally! Got it to work. I so much prefere UUID over old hda/sda notation. With a 9 disk ATA+SATA+External Controller environment it is so hard to tell when which disk is what device.

    So, also for me, some time after install sdg1 moved to sdi1 but resume parameter in initramfs was not updated.

    For me although it as enough to replace resume parm with current UUID from swap and update-initramfs.

    Lesson learned: try to move from sda/hda references to UUID only.

  5. Thaks a LOT! I am new Ubuntu/Linux user (2days). Created partition and small swap. I had created a new one (2GB), used gparted, LiveCD… everything was ok, only Hibernation not. I read many sites but only Yours has helped me 🙂
    Exactly points 4 & 9 missed in my elaboration. THX

  6. You’re welcome, Bobby. I’m glad it was helpful. Enjoy your new Ubuntu!

  7. After I removed the encryption from my home dir and swap resume failed.
    Thanks to your guide I can hibernate again.

    BTW, perhaps as systems progress I noticed that on Ubuntu 9.10 I could skip
    steps 5,6 and 7. I guess mkswap takes care of the things in those steps.

    Anyway thanks again.

  8. It works even skipping steps 5, 6 and 7.

    For those already formatted a swap space, you can use

    sudo blkid

    to find the UUID of your existing devices.

  9. I have a problem in step 2:

    arikh@arikh-N53SV:~$ cat /etc/fstab
    # /etc/fstab: static file system information.
    #
    # Use ‘blkid -o value -s UUID’ to print the universally unique identifier
    # for a device; this may be used with UUID= as a more robust way to name
    # devices that works even if disks are added and removed. See fstab(5).
    #
    #
    proc /proc proc nodev,noexec,nosuid 0 0
    /dev/sda5 /media/windows ntfs-3g defaults,locale=en_US.utf8 0 0
    # / was on /dev/sda6 during installation
    UUID=28b5fa45-363a-4930-a26b-3b64de9f170a / ext4 errors=remount-ro 0 1
    # swap was on /dev/sda7 during installation
    UUID=7844f1c0-5cf4-479f-832a-254b9fa17eb2 none swap sw 0 0

    arikh@arikh-N53SV:~$ sudo mkswap /dev/sda7
    /dev/sda7: Device or resource busy

    Any idea why I get this error?

    Thanks,
    Arik

  10. @Arik: Does the current UUID for /dev/sda7 match what’s in the fstab file? The comment in the file shows how to display the current UUID. Check it and update fstab if the UUID has changed. Also, make sure swap isn’t already on.

  11. on step 2, when I try “sudo mksawp /dev/sda6” (/dev/sda6 is my partition) it says: “/dev/sda6: device or resource busy”. Any ideas?. Thanks

  12. @Jacob: I am experiencing the same problem with the “device or resource busy” message.

    When I try to apply your recommendation to turn off swap, I get a message “swapoff: /dev/sda1: swapoff failed: Invalid argument”.

    I also noticed that in etc/initramfs-tools/config.d, I do not have a resume file.

  13. I tried all the steps and also did the reboot as Ben suggested before trying hibernate/sleep, but the issue persists. Any inputs? It still powers on like I shut it down when I try to resume it.

  14. I ve got the same issue (almost).

    I ve just solved it, perhaps it can help. :

    ————
    When i try “mkswap /dev/sda4” (step 2) it return “device or resource busy”

    /dev/sda4 do not appear anywhere (blkid, …)
    With gparted, I can’t format directly, partition is marked as “unknown”
    I can delete the partition, then reboot, then format it to swap.

    —Do not follow this steps, just for explanation———–
    At this point, if I reboot and try to hibernate, it do not resume.
    (“option-instat-callback : error-2” during hibernation, as previously)
    Going back to Gparted, partion is marked as “unknown” !

    Again : delete, reboot, format as swap, but don’t try to hibernate
    ————————————————————-

    “mkswap /dev/sda4” (step 2) suceed !

    step 3 succeed : in fstab I replace old by new UUID

    step 4 : the file /etc/initramfs-tools/conf.d/resume do not exist.
    I create it and fill it with “RESUME=UUID=’my new uuid'”

    step 5, 6, 7 : /dev/disk/by-uuid contain already my new UUID, let it like this.
    (Probably done by Gparted ?)

    Step 8 : success

    step 9 : quite long, but succesfull

    Hibernate option have disappeared ! I reboot and it come back.

    Try to hibernate, resume… YES !!!

    ————

    Thank you very much for this guide.
    Sorry for my poor english writing.

    Pac

  15. I am on Xubuntu 11.10 on a Sony Vaio and unfortunately the above steps don’t work for me.

    Tried it a few times and did also make sure to reboot after change before trying to suspend/hibernate.

    Suspend seems to work fine, but on resume I get a full boot, i.e. Vaio logo is shown and then the Grub2 menu.

    Just FYI
    Werner

  16. I have the same problem on Ubuntu 11.10 64bits for an Asus EeePc 1215B.
    The solution work perfectly.
    Thank you.

  17. After restoring a clonezilla image of my Kubuntu 11.10 installation, resume from hibernate was not working. The steps listed here worked perfectly, just had to add a swapoff -a before step 2.

  18. Hi,

    Successfully followed steps 1-9, but ran into an error after trying to update initramfs.

    —————————————————————–
    “update-initramfs: Generating /boot/initrd.img-2.6.38-02063808-generic Warning: No support for locale: en_US.utf8”
    —————————————————————–I

    I thought this might be an issue regarding the fact that I have multiple kernels installed, so I used the -u -k flags to specify the kernel I am running on (no luck).

    Any ideas?

  19. No luck here ether!!
    both my laptop and desktop can’t hibernate
    Laptop: Dell XPS 1530m
    OS: windows7/Ubuntu 11.10 with gnome-desktop-environment

    Tried all the above mentioned steps from the main article.

    desktop:custom i7:2600 with GB z68 chipset
    OS: windows7/Ubuntu 11.10 with gnome-desktop-environment
    with little more complication!
    I have 5x8Gb swap partition.
    So don’t know which one to chose!
    $swapon -s
    “Filename Type Size Used Priority
    /dev/sda11 partition 8302588 0 -1
    /dev/sda6 partition 8302588 0 -2
    /dev/sda7 partition 8303612 0 -3
    /dev/sda8 partition 8303612 0 -4
    /dev/sda9 partition 8303612 0 -5

  20. No luck here either.

    Kubuntu 11.10 64 bit on an HP a1730n desktop.

    This desktop has never been able to wake up from sleep or hibernation; not under Windows (first Vista then 7) nor under any Ubuntu release since I started with it back on Feisty Fawn.

    So it may be that there is something in the hardware, and not with the workaround you posted.

    Thanks anyhow, I learned a few things I did not know.

  21. Great!!!

    I have two swap partitions & /etc/initramfs-tools/conf.d/resume just pointed to the wrong one…

    sudo nano /etc/initramfs-tools/conf.d/resume to update to the correct one did the job – works like a charm now!

    btw: gparted does a good job telling you the UUIDs…

    thx!

  22. Hey,
    thanks a lot ! It finally works !

    I’m using crunchbang on my Asus latop, and now it hibernates and is able to resume.
    Though the screen and pc still lights up when I put the laptop to hibernate – The HDD-LED stops blinking but the power-led etc. still lights up. It’s not a problem, but pretty annoying 🙂

    Thanks for this guide/tutorial !

  23. Finally, it works.
    After applying the above, i still had problems.

    I finally resolved it using the proceedure below:
    Edit /etc/default/grub and set GRUB_CMDLINE_LINUX=”acpi_sleep=nonvs”. On most systems, the ‘GRUB_CMDLINE_LINUX’ parameter will have no value (i.e “”) so just add the above in there and run a ‘sudo update-grub’.

    My system is a Sony Vaio VPCEB1EOE. Hope it helps!

    see — http://askubuntu.com/questions/24048/answer/submit