I Broke What?

So, in my attempts to try to find some solutions for Evan, I ended up breaking my own computer.

So what did I screw up now and how did I do it?

WARNING: Technical article!

If I had to pick the single most important file on my computer, what would it be?

Easy, the master boot record (MBR). Now for you single-OS users, MBR means nothing, you don’t have to worry about it, because you won’t ever have to deal with it. However, I triple boot my laptop (XP/Vista/Ubuntu), and the ┬áMBR is mega important.

So what is the MBR?

The master boot record is a special file that the user cannot access directly from inside of an operating system (usually). The file is stored on a special place on the hard drive and cannot be accessed directly, it must be accessed with a program. It tells the computer which partitions are labeled what and what they contain. GRUB and LILO are two Unix examples of MBR programs.

So, what broke it?

I booted into XP for the first time for serious reasons in months. I have no use for Windows on my laptop, I can’t do games on it, I only use it for utility purposes, which there aren’t many of those. I was going to see if Thinkpads have a built in recovery application accessible through Windows. Turns out there is, and it’s located in

C:/Program Files/Lenovo

However, I went and looked at the support website and there was a new version of the program available, so I downloaded and attempted to install it. Now, the program installation failed, because it said there was already a previously existing entry.

Cool, I thought, ┬áthe program already exists, I’ll just use it. Well, it turns out something is messed up and the program isn’t there or I suck at looking for it, or whatever. My point is, they don’t tell you they immediately attempt to change your MBR, and effectively SUPER broke it. I got fed up with working in a miserable OS and decided to reboot into Ubuntu.

GRUB_

That’s all my screen said…

GRUB_

Never seen that one before, I had no idea what had happened at the time, I was a bit scared. The computer wouldn’t do anything, pressing buttons did nothing but make the computer bleep and rebooting it, it still just said GRUB_ right after BIOS. Luckily, I knew what GRUB meant so I knew at least the root of the problem, there has to be something wrong with GRUB.

The problem is, I’ve never dealt with repairing or modifying a GRUB installation. After doing a bit of googling, I tried some of the suggestions about modifying some items into my menu.lst file.

Aha! I thought, I found it, while examining the menu.lst it looks like one of the Windows partitions had been set to be defaulted by boot, and it doesn’t have the TRUE MBR, so it wouldn’t work. So I took off the

savedefault

option, not realizing that wouldn’t do a damn thing. After four random edits of my menu.lst and rebooting into

GRUB_

I actually went into panic mode. All of a sudden, my thoughts started racing, I suddenly got a headache and aching in my legs and felt tremendous mental stress, like the world was collapsing on top of me. All of my Java projects (including my current one) were on here and I need it several hours!

I’ve never actually felt like I can’t fix a problem, because I normally have an editor of some type or a working OS to manipulate to make things happen.

All I had now was an Ubuntu LiveCD and a lack of knowledge. Luckily, I also had my Macintosh, which is a brilliant machine in perfect working condition. Utilizing it, I did some research into the problem. The suggestions I found seemed viable, and from what little experience I had from dealing with the previous problem I had (see my last screw up), I knew at least how to do it.

Now granted, when I first tried this, I had screwed up and didn’t really know it, in the LiveCD, I had mounted the partitions that had Ubuntu on it and it was currently in use and couldn’t be

umounted

So the only way this works, is if you have absolutely NO hard drives mounted, and you’re using the LiveCD only.

GRUB is working in the LiveCD, becuase without it, the CD would be worthless. So now I needed to use that to my advantage.

From the LiveCD desktop, I opened up a terminal and started the easiest and quickest repair ever.

ubuntu@ubuntu:~$ grub

grub> find /boot/grub/stage 1

hd(0,3)

grub>root (hd0,3)

grub>setup (hd0)

grub>quit

That’s it… just a couple of commands and I was done. I’ll quickly explain what they mean.

grub

Gets you into the GRUB terminal, from here you can access functions of GRUB.

find /boot/grub/stage1

This will find the stage1 file and tell you what partition is the root partition, or the partition that has the primary OS installed on it and is returned in the format…

hd(#,#)

The format is HardDrive(whichHardDriveNumber, whatNumberPartition). In this case it’s hd(0,3), which indicates it’s the first hard drive (computers don’t start at one), and the fourth partition. In Unix terms, that would be /dev/sda4.

root hd(0,3)

In order for GRUB to know what you want to do, you have to target a root drive first, and since you just requested the find command to tell you, you just flag that drive as root.

setup (hd0)

This is the command that really matters, it’s telling automagic (yes, that’s what it’s called) to read the drive, indicate partitions, generate a menu.lst, and install a fresh GRUB to the MBR.

So that’s it, I rebooted and everything is in perfect working order. I am typing this up from my fixed Ubuntu partition.

Cheers,

Michael

5 Responses to I Broke What?

  1. scottiec809 says:

    Nice problem solving skills. Too bad they never worked in the Math department.

    Ive actually been thinking about putting Ubuntu back onto my laptop, it was on there before but I took it off because I never used it. I’ll have to think about it more.

  2. DSHwasha says:

    did i ever tell you about the three days i spent configuring my dual boot (kubuntu/vista bus)? it was after i got back from Bham. i knew not a lot at all–all i had was the GRUB cd you gave me…and a similar lack of knowledge. i had to free write my menu.lst and use vague context clues from other menu.lsts i found on forums.
    i had many problems with my initial dual boot setup.

    i didnt ues windows for MONTHS. then when i moved into the appartment, i had to go bail back into winders….my kubby doesnt agree with my neighbors wifi, at allllllllll

  3. games says:

    games…

    Pownce, is nifty, and……

  4. rp says:

    Nice job on the tutorial dude, very clear and concise instructions. I had to use them after installing Windows 7.

  5. Michael says:

    I accidentally put a space in /boot/grub/stage 1
    There should be no space there. I’m glad to see this has helped someone out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: