Default Grub Boot Commands for Ubuntu 7.10



I recently formatted my laptop and installed Windows first, using half of the hard drive, and then installing Ubuntu 7.10 on the other half. It had been a while since I tried Ubuntu – it has a come a long way – but that is another story.

The install worked fine, however at the end, it just sort of hung while installing grub. GREAT. I reboot and it kicks me to a (grub) standard prompt.

It took me a while to figure this out, but you can manually boot Ubuntu via the grub prompt. The tricky part is finding out the right commands since your system is totally inaccessible.

You can find your available hard drive name by typing:

1
> root (   <tab>

pressing tab will list your available hard drives and partitions and hopefully your Ubuntu ext3 partition.

Continue setting the root boot partition. This includes your partition with all /boot files. For example, mine was installed onto the root / filesystem, and not a separate filesystem.

1
2
> root (hd0,2)
>

This sets your root that grub uses.

You then need to set the kernel. Use:

1
> kernel /boot/vmlin <tab>

Tab will show you the available files to use. Also you can use this at any level to explore your filesystem. So for example:

> kernel /boot/vmlinuz-2.6.15-20-386

But wait before you hit enter!

You will get a pivot root error – the kernel doesn’t know where the rest of your file system is. In a file called device.map in your /boot directory, this location should be specified. In my case, it is listed as /dev/sda3. This is important for your kernel. Fortunately, GRUB has a ‘cat’ command you use to get the text output of this file. We also set this to a read-only filesystem – Ubuntu takes care of setting it back to rw when it boots.

So the final kernel line is:

1
2
> kernel /boot/vmlinuz-2.6.15-20-386 root=/dev/sda3 ro
>

Now we need to set the initrd file – hopefully you by now know to use to find this if you do not know it off of the top of your head:

1
2
> initrd /initrd.img-2.6.15-20-386
>

And finally, type ‘boot’ to begin the boot process:

1
> boot

Hopefully ubuntu will boot for you now without problems. Again, if you get a pivot root or ‘unable to mount root VFS’ error – you need to check the root=/dev/sda3 line part of the grub commands. This means that the kernel could not find your main filesystem.

Once you are logged into Ubuntu – use the following command to regenerate menu.lst for you. Once this is rebuilt, you will be presented with the normal Grub menu and you won’t need to follow the process above!

1
sudo update-grub
  • ec354

    Thanks. This is really helpful because somehow I deleted the normal grub menu and I was trying to find a way to boot Ubuntu manually.

  • ec354

    Thanks. This is really helpful because somehow I deleted the normal grub menu and I was trying to find a way to boot Ubuntu manually.