It's never a comforting scenario when you go to boot up your system and you get the following screen:
GNU GRUB version 1.99 Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible
device or file completions. grub> _
"Where's the OS?" one might demand. But don't fret, this may not be the end. There are a number of reasons you could be getting this prompt, but it usually all boils down to the fact that GRUB is unable to see any information on how it should load your kernel and operating system.
What is booting?
In computing, booting (also known as a boot-up) is the initial set of operations that a computer system performs after being turned on. When the machine finishes it's Power-On Self-Test (POST), it will look for instructions on how to actually load your Operating System. In the case of a hard disk (which is most common), it will load the code found in the Master Boot Record (MBR), which will generally locate and load the operating system's "Boot Loader" into memory. In the case here, the boot loader is GRUB. The boot loader is then responsible for preping and starting the Operating System.
How does it work?
The GRand Unified Bootloader (GRUB) was initially developed as a boot loader for the GNU/Hurd project. There are two versions of GRUB in common use, though GRUB version 2 is now used by most distributions (and will be the focus here). GRUB will check it's configs for the location of the requested kernel and attempt to load (or strap) that image into memory. Once loaded, GRUB will pass parameters (if any) and transfer control to the kernel. The kernel will then load both the default configuration file and any other modules needed.
So how do we fix it when things go wrong?
Manually booting your operating system from GRUB is actually pretty easy once you know what you need to do. Before trying to actually do anything with GRUB, you should examine what GRUB can actually see in your system. For starters, if you can see the GRUB prompt you know that the MBR is intact, and that GRUB has been properly loaded into memory. Great! Now let's poke around and see which disks may be visible to GRUB. You can start by using the ls command:
(hd0) (hd0,msdos2) (hd0,msdos1)
All of our partitions are showing up here (yours may look slightly different, depending on how things are partitioned). Since it can see our boot volume, let's actually tell it to use that:
Now we can tell it to load or kernel image. (Just note that you must put in the full filename of the image. You can use TAB completion here to help you, especially if you don't remember the name of the file.)
grub> linux /vmlinuz root=/dev/sda2
Next, we need to tell the kernel where it can find it's initialization RAM disk (initrd). Remember to use TAB completion to help you:
grub> initrd /initrd.img
Finally, you can go ahead and boot your system!
For the most part, you should be done. That wasn't so bad, right? LVM gets a little trickier though, as you will need to activate volume groups and specify logical volumes for root partitions (I may cover this in an update to this article).