- Computers & Software
Finding UUIDs numbers
Being an experimentalist and willing to try things out, I had made an image (ISO) of my Ubuntu system, and wanted to place it in a virtual system. Now the original is mixed on a dual operating computer with Windows XP. So the Hard drives and partitions are mixed. Putting this in a virtual system, I would have to simplify this. So several hurdles were encountered.
Thus we are going to have new UUID numbers for identifying the drives and partitions, besides just the partition problem. Now there are other ways encountering UUID number problems , for any number of reasons: Adding an extra hard disk, a new partition, or corruption of Grub/drive, copying an identical system on different drives/new partitions. The result is a boot problem in Linux - UUID # does not exist, or some other message like "Gave up waiting for root device". Your boot then stops (and one goes oh no).
Odds are on your install of Linux you used a LiveCD, if you still have the disk/USB (it's on) than all is well. If not, and you have access to another computer download a Linux LiveCD of your favorite distro, and burn it.
What is an UUID number?
Before beginning UUID is an abbreviation standing for: Universally Unique IDentifier. This unique number is for software to distinguish various components/or information (whether software or hardware related) uniquely.
So UUID is a unique identifier number given to a hardware or anything for that matter such that the odds for another device having the same number are extremely rare. UUIDs are a 16-byte (128-bit) number or 216 × 8 = 2128 = 25616 or about 3.4 × 1038. Or 3.4 with 38 zeros after it, ( a trillion has 12 zeros, a billion 9 zeros).
It will look something like this: ba214f51-2597-44c2-b1d2-ef4f9b10d8460000. A 36 character number composed of a 32 Hexadecimal number + 4. For computers it resolves any naming conflicts that could occur, by assigning devices/partitions a unique number. Just follow the link if you want to know more about UUIDs.
The main thing in Linux for the Grub to work, it uses UUIDs to identify the root partition of your operating system, losing or corruption of this number results in it stopping the boot process. So how do we recover it?
Finding the UUID number.
We are going to continue with the problem I had, which would be similar to most cases with missing or wrong UUIDs. If your hard drive is readable and not at fault, and grub failed due to UUID than this solution may work for you.
First we will be using a LiveCD or USB device with LiveCD installed on it. Next enter your BIOS and insure that the CDROM or USB is going to be your boot device. Boot your computer, and enter the LiveCD operating system, "don't select install the system". Navigate to the menu list find your terminal service. For ubuntu users its under applications - accessories - terminal.
In your terminal enter the commands:
sudo blkid (results are in the photo below). Listed are the two partitions /dev/sda1 (my root and home partition) and /dev/sda5 (swap). see photo 1
Photo 1 - Finding UUIDs
Another Command line.
Another command you can use (see photo 1):
ls -l /dev/disk/by-uuid
Here we get information of another order: the owner/permissions, date/time last accessed, and which device each UUID goes for, in my case it's sda1 and sda5.
So now what?
Once you get the information on the UUID, you now edit your grub/menu.lst. In this case in your terminal enter:
sudo gedit (or whatever the editor is on your LiveCD). This puts you in the root mode, which you need to modify and save your grub. There are several locations you must modify in menu.lst, for the boot to be proper. Now open your file manager/browser(in ubuntu it's Nautilus) to find the grub/menu.lst and drag and drop on gedit or use the open in gedit and navigate to this location:
YOUR Disk - /boot/grub/menu.lst. (Note: don't use the file system if using LiveCD, use the drive which your operating system is on. Which in my case is the 8.2 GB media) See Photo 2.
Photo 2 - Finding Grub/Menu.lst
Also note there will be other entries such as Recovery mode and older kernels, these will have to be corrected to with the proper UUID. The easiest way is to copy the UUID from the terminal, and past in the proper locations.
Save edited menu.lst. Quit (use restart function) the LiveCD and remove it. Now you will test your new Grub menu. If no other faults it should boot with the correct UUIDs.
After creating an exact copy of my regular Ubuntu system, and some manipulations using Mondo Expert mode (had to eliminate and reorder the fstab file) plus correct the UUID numbers, it works perfect in Virtualbox ( some minor tweaking is still needed but not critical). The UUID was my major stop in booting. and once corrected everything booted wonderfully.
Photo 3 - Grub/Menu.lst
Now the final Act - the corrections.
The two locations in menu.lst that you need to put the new UUID are at the "Kopt=" and after the "End Default Options".
title Ubuntu 8.04, kernel 2.6.24-19-generic
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=a3b6361f-95b8-4561-9f93-f60114c0bf63 ro quiet splash
initrd /boot/initrd.img-2.6.24-19-generic quiet
In the photo the locations are marked, however for demo purposes I temporary cut out all the other fill so you can see what you are looking for in the menu.lst. (see photo 3)