Resizing swap partition breaks Ubuntu 9.04 resume

Filed under: Linux — lars @ 09:51:11 am

I recently had to increase the size of my Ubuntu swap partition after putting some more RAM in my netbook, as hibernate would no longer work correctly.  (I find it appalling that Ubuntu uses the swap partition for hibernation - it means that hibernation always runs the risk of not working if you are using lots of RAM, and it also means that when you resume almost all your RAM is swapped out so your system is incredibly sluggish!  One day I will try TuxOnIce...)

Resizing the swap partition was an easy trick, just booting off an Ubuntu 9.04 LiveCD and using the Gnome Partition Editor.  But this changes the UUID of the partition, and as a result a bunch of Ubuntu configuration files need to be changed to reflect this new UUID.  (Although this bug has apparently been fixed in newer versions).

To get hibernate and resume working again was a bit of a faff around.  Here are the steps that I took - I don't promise they're all required:

  1. Find out the new UUID of your swap partition by running the following command (replace /dev/sda5 with your own swap partition!):
    sudo blkid /dev/sda5
  2. Update /etc/fstab with this new UUI.  This should allow your system to swap onto the new partition. eg:
    UUID=f0e784ed-e140-4d73-87a3-8ef047012b9f none        swap     sw              0          0
  3. Update /etc/initramfs-tools/conf.d/resume with the new UUID.  This is supposed to make resume work properly.  Eg:
    RESUME=UUID=f0e784ed-e140-4d73-87a3-8ef047012b9f
  4. Reinstall initramfs-tools - might not be required but I did it - with the following command:
    sudo apt-get install --reinstall initramfs-tools
  5. Ask initramfs to update your initramfs images for all your kernel versions with the command:
    sudo update-initramfs -u -k all
  6. At this point, I was still having trouble - hibernate appeared to work but resume would not, a normal clean boot would occur, though I did notice the text "waiting for resume device" (or similar) on bootup.  The fix was to edit /boot/grub/menu.lst and make sure my kernel command-line arguments included this new UUID for resume.  (My existing menu.lst appeared to omit resume entirely).  Eg:
    BOOT_IMAGE=/boot/vmlinuz root=UUID=... resume=UUID=f0e784ed-e140-4d73-87a3-8ef047012b9f ro vga=0x315 quiet splash

And it finally worked...

Comments

No Comments for this post yet...

    Leave a comment

    Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>


    Options:
    (Line breaks become <br />)
    (Set cookies for name, email & url)




    powered by  b2evolution