Remember the old days in Windows where something would happen to the disk during boot up…the ominous *beep* disk not found Abort, Retry, Fail message would pop up? Usually you were just stuck hoping it was an IDE cable that had come loose. And what exactly did “Fail” mean anyways? I already knew it had failed, why tell it to fail again! Although Linux rarely has true hard disk boot issues, every now and then you do run into a hibernation start up issue. I experienced this directly on my Ubuntu laptop. To avoid the time-loss that I experienced tracking back what was going on I thought I’d post a quick tip…nothing fancy…on how to get your Linux box up and running if it fails to come out of hibernation:
The frustrating error you might see:
swapon: cannot stat /dev/disk/by-uuid/: No such file or directory
The problem here is during hibernation your swap partition is flagged “persona non grata”…meaning it is corrupt and fails to be recognized and turned on when booting. This is the way I corrected my issue:
1. Grab your media disk and insert it into the CD and bounce the box. While the box is booting up, when you see the GRUB menu hit ESC and boot into single user mode.
2. Utilizing fdisk find your swap partition (you wrote this down when you first deployed your box right?): #fdisk /dev/sda
*note* Your disk may differ. You may not have a sata drive. In that case your disk would say /dev/hda.
3. Once you are in the fdisk menu hit the ‘p‘ key to ‘print’ the partition table. You’ll see the table come up and aptly enough you’ll see a label on one of the partitons called (funny enough) “swap”. If you don’t see the word swap look for the type identifier for swap in Linux…it is 82.
4. Write down that partition number…example: /dev/sda2
5. Press ‘q‘ to quit fdisk and drop back down to the console.
6. Enter the following commands:
swapoff /dev/sda’x’ (where ‘x’ is your swap partition number)
mkswap /dev/sda’x’
update-initramfs -u
7. Reboot normally and your box should recover from the corrupt swap and you are off to the races.
This will work on Ubuntu. On other distrobutions you may need to tweak how you get to single user and command structure. However, hopefully this will help you get on the track you need.
Further review of why your swap got corrupted may be warranted. Check for the latest hardware drivers and power management software issued by your distribution. Hibernation controls are getting better. Hope this helps if you do find yourself in this particular situation.