making Kubuntu hibernate

it’s my first time to install Kubuntu. and it was a laptop install. everything just works out of the box. well, almost everything. hibernate, one of the most important actions that an OS could do on a laptop, didn’t work. well i’m partly to blame. i didn’t allocate enough swap during the install.

now in case you are having problems trying to make hibernate work on your laptop coz it complains that there is not enough swap space, here’s my advice.

1.) make sure your swap space is as big or over the size of your system memory (RAM). if you have lots of free disk space to spare, make it even twice the size of your total RAM. so say you have 512MB of RAM, make your swap 1GB. this has always been a rule of thumb in Linux. lately though, i have not been practicing this. the advent of faster and bigger memory in the past years has almost made the use of swap obsolete.

2.) set up the swap area. assuming that you’ve already made that partition for swap, its now time that we make it one. here’s what you do,

sudo mkswap /dev/PARTITION

PARTITION is that partition you have allocated for swap. for example the partition on my disk is /dev/sda2.

3.) correct the partition UUID. after you’ve done step 2, there should have been an id given to you that looks something like this – 6672010b-fc75-476a-809e-aae35b81fca9. it is a 32-character string separated by dashes in a 8-4-4-4-12 format. there is also this tool called uuidgen that creates random-based or time-based UUIDs. it may come in handy for you.

change to this directory /dev/disk/by-uuid/. there should be a symbolic link to your partitions . find the one that corresponds to your swap partition and delete that link.

for example,

cd /dev/disk/by-uuid/

ls -l

lrwxrwxrwx 1 root root 10 2007-05-08 03:06 13D7D1EE06EC36BC -> ../../sda1
lrwxrwxrwx 1 root root 10 2007-05-08 03:06 af8a60c2-5430-444a-84e6-af47bf8cfcc3 -> ../../sda2
lrwxrwxrwx 1 root root 10 2007-05-08 03:06 f514d8ed-b42b-462f-a497-d0a1af4cff98 -> ../../sda3

in this scenario, sda2 is my swap. so,

sudo rm af8a60c2-5430-444a-84e6-af47bf8cfcc3

then make a symbolic link using the correct UUID. for example,

sudo ln -s /dev/sda2 6672010b-fc75-476a-809e-aae35b81fca9

ok now you have the correct symbolic link to your swap partition.

4.) edit your /etc/fstab file. using your favorite editor edit the said file.

sudo vi /etc/fstab

edit that line for your swap. it should look similar to this:

UUID=af8a60c2-5430-444a-84e6-af47bf8cfcc3 none swap sw 0 0

change to the appropriate UUID. in my case it i’ll change af8a60c2-5430-444a-84e6-af47bf8cfcc3 to 6672010b-fc75-476a-809e-aae35b81fca9. now the line should look like this after editing,

UUID=6672010b-fc75-476a-809e-aae35b81fca9 none swap sw 0 0

5.) turn on swap.

sudo swapon -a

6.) edit your /etc/initramfs-tools/conf.d/resume file. again, change the UUID to the appropriate one.

sudo vi /etc/initramfs-tools/conf.d/resume

the file should have a line like the one below


7.) update your initramfs image.

sudo update-initramfs -u

after these 7 steps you should be good to go. now go test hibernate! what else are you waiting for? leave everything as it is. let Kubuntu hibernate. then power your laptop. it should boot faster and then you should see that familiar locked KDE desktop.


related post:

Similar Posts:

Notice: This article was published on May 7, 2007 and the content above may be out of date.