Of all the errors messages and problems I have encountered over the years with Linux, there are few that I found more frightening than this one:
No such device: UUID=ca40b0c0-3068-4808-bea2-9b439d31e1c2
Grub Rescue >
Even with a kernel panic, your system at least started to boot, but when you get hit with the “Grub Rescue” prompt, it means your system could not even get past the bootloader. Nevertheless, as scary as it feels to suddenly have no access to anything on your computer, it is actually fairly easy to fix.
Grub (or Grub2) is a bootloader that many Linux distributions use to get the startup process going. You can use it to easily dual boot a system, but if you only have one OS, you will probably never see it. Under normal circumstances, you will also probably never see a grub error. Problems arise when you start tinkering with partitions or disks. It is then possible for grub to misplace your boot partition.
To fix this issue, you first need a way to look at your drives and partitions to make sure everything is still there. In this situation, it is rare for there to be any data loss, but you still need to find out where your data is. You can do that with a rescue CD, Live CD, or Live USB flash drive. Ideally, it should be the same version of Linux you are currently running, but it does not have to be.
Boot to the live distribution and open a terminal window. Before proceeding, it is important to know the device names for your drives. Run the following command as root:
Look for the drive you use to boot your OS. It should have a “*” next to its name.
Device Boot Start End Blocks Id System
/dev/sda1 * 1 29637 238053376 83 Linux
In this example, it means that /dev/sda is the drive you need to use, and the partition /dev/sda1 is bootable.
In some situations, all you have to do is reinstall grub with the following commands:
sudo grub-install --recheck /dev/sdX
(replacing X with the appropriate letter)
Reboot, and if you get your normal startup back, you are finished. If not, you might need to go through the process of purging and reinstall grub itself.
Purging and Reinstalling Grub
The Linux server experts at UK domains company 34SP.com suggest using chroot to access your drive directly and reinstall grub. Follow this procedure:
1. Mount your system partition:
mount /dev/sdXX /mnt
2. If your /boot directory is a separate partition, mount that as well. If not, skip to the next step.
mount /dev/sdYY /mnt/boot
3. Mount all of the critical virtual file systems (You will need these to complete the installation)
for i in /dev /dev/pts /proc /sys; do mount -B $i /mnt$i; done
4. This may or may not be necessary, but you should make sure you have networking capabilities:
cp /etc/resolv.conf /mnt/etc/resolv.conf
5. Use chroot to enter into your system:
6. Now update your package manager (apt-get is used in this example) – This also tests for a network connection.
7. Purge Grub completely:
apt-get purge grub grub-pc grub-common
8. Reinstall grub:
apt-get install grub-common grub-pc
At this point, you will be presented with menu options:
It will ask you to add options to the kernel line. Unless you have something specific, you can skip this. Next, it will ask for your installation drive. Select the correct one (It should be /dev/sdX and not /dev/sdXX – the drive, not a partition on the drive). Select it and press the space bar. This should put a “*” next to it. Select OK and press Enter. It should then complete the grub installation.
9. Update grub:
10. Exit chroot
(or press CTRL+D)
11. Unmount your virtual file systems:
for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done
12. Unmount anything else:
13. Reboot your system:
If all is right in the world, you will now have a working system with all of your data intact. If you still get the grub rescue prompt, try the process again to make sure you completed all of the steps. If you get other problems or have missing data, you should check your drive for errors and seek additional help. For more grub ideas and fixes, see this Ubuntu documentation.