When You Can't Even fsck, How to Reinstall grub

Language butchery by Mr Rich on  9.7.10 @ 21:50

Many thanks go out to people on this one. Credits given at the end.

So you've bricked your machine. You can't even use fsck (note: the command has one letter difference from the word said immediately prior to running it), because you just get that flashing underscore looking thing on a black screen.

Us old timers call that a cursor. When that's all you see when you boot your computer, it's not the only thing that is cursing.

Here's what you do.


I'm not kidding. You are up the proverbial defecation creek without a shovel and only your tongue to guide you if you don't have a boot disk. In days of old, we carried around floppies for such things. These days, you need only a live CD (preferably installed to a flash drive).

If you don't have a Live CD, you have officially learned your first Linux lesson. Go download one for your distribution right now and get it burned (or as stated before, preferably installed to a USB drive).

  1. Boot to your Live CD/USB drive.
  2. Open a terminal.
  3. List out your partitions
  4. Reconfigure grub to to to the partition with /boot.
  5. Reboot

To find your partitions, enter the following into the terminal:


You should see something like this:

/dev/sda2 305592212 256413288 33655720 89% /
/dev/sdb1 480719056 202796 456097060 1% /data

In the example listed above, my swap partition is /dev/sda1, and my root ( / ) partition is /dev/sda2 (yours will probably be different). I don't have /boot on a different partition, so /dev/sda2 is what I am looking for.

Here's what you want to note:
  • sda2 is the second partition on my first hard drive.
  • sdb1 is the first partition on my second hard drive.
  • grub is zero-based, so if I'll need to subtract 1 from both the number of hard drive and the partition to get it configured correctly (see below)

To reconfigure grub, at terminal enter the following:

root (hd0,1)
setup (hd0)

Ok... so where did the numbers come from?

First I entered root (0,1). This told grub that the root partition was on the first hard drive, second partition. Remember I said subtract 1?
  • The root partition was sda2.

  • "a" is the first letter in the English alphabet; subtract 1 and you have 0.

  • "2" indicates the second partition; subtract 1 and you have 1.

Thus, root (hd0,1)

Next I told grub to setup the root partition for booting. If you understood what I explained just previously, then this should make sense:

setup (hd0)

The final thing you need to do is reboot -- making sure you pull out your live CD/USB at the right time to you don't boot to it.


First and foremost, my older brother TK. He taught me rule #1.

Second, my co-worker and colleague, Mr. MB. He sent me a chat the last time I fubar-ed up grub, and it made me remember what to Google for. I owe you (yet another..) beer sir!

Finally, "remmelt" on the Ubuntu forums (although it worked for my OpenSuSe install too): http://ubuntuforums.org/archive/index.php/t-24113.html

Labels: , , ,

Comments: Post a Comment

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?