Dapeng Li's Blog

Saturday, January 16, 2010

 

Hibernate to swap file in Ubuntu 9.1 [still open]


Recently I'm trying to make hibernation work on Ubuntu 9.1 (Karmic) on my Asus N10E.

I'm totally new to Linux and I followed this post to install Ubuntu Netbook Remix and Windows 7 side by side. It's a good tutorial and I followed another link in that post to create a swap file instead of swap partition.

Everything works fine, and I'm pretty amazed by the shutdown speed and suspend/wake up speed, lighting fast indeed. However, hibernation doesn't seem to work, when I chose hibernate, the only thing it does is lock the screen.

I followed this link to check kern.log after trying a hibernation, and found "Swap header not found!" in the log.

I thought I found the cause is the swap file, as in this post, on the second page, another member gave updated information on Ubuntu 9.1, on swap-offset and Grub2.

Here's what I did:

mount | grep " / " (Note your /dev/... on /)
sudo blkid -g
sudo blkid (Note UUID of /dev/... that corresponds to "/", we will use it in resume=UUID= below.)
sudo filefrag -v /swapfile | grep "First block:" (this doesn't work on Karmic)

Then I installed libx86.
sudo swap-offset /mnt/3G.swap to get the offset (my swap file is /mnt/3G.swap)
gksudo gedit /boot/grub/menu.lst & (this doesn't work in Karmic either)

I follow the instruction and created 07_hibernation under /etc/grub.d/
menuentry "Ubuntu 9.10 Hibernation, Linux 2.6.31-14-generic" {
set root=(hd0,3)
search --no-floppy --fs-uuid --set d3b0cf1a-99ca-43c1-a058-d7c38c0b6171
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=d3b0cf1a-99ca-43c1-a058-d7c38c0b6171 ro resume=UUID=d3b0cf1a-99ca-43c1-a058-d7c38c0b6171 resume_offset=1544
initrd /boot/initrd.img-2.6.31-14-generic
}

I replaced UUID and resume_offset from the results of running the commands earlier.
sudo update-grub -y (doesn't work in Karmic)
sudo update-grub
sudo update-initramfs -u

Then I checked /boot/grub/grub.cfg and saw the new boot entry created there.

Reboot.

Unfortunately, boot from the new entry doesn't work for me, I got the display:
"Begin: Running /scripts/local-premount ..."
Then system seems stop and nothing more happens.

Labels:


Archives

October 2004   June 2009   January 2010   December 2011  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]