John Walker's Electronic House

We Want Mohr!

by on Oct.08, 2005, under The Rest

Neil Mohr is officially the Best Person Ever Made.

Officially.

Thank you to all who suggested help for fixing the boot record thingamies. Neil has achieved exactly this, and now I have all my files back!

Now. I’m assuming that some evil took place somewhere inside the scary parts of the computer. Can those of wisdom out there tell me if plugging it back in again is going to have the same thing re-muddle the thing again, and put me back where I started? Is GRUB going to do some untold evil? Is there something in all the confusing “(hda 0,1)” type nonsense in the GRUB info that will muck it all up?

Sorry if I’ve confused everyone with these technical terms.


2 Comments for this entry

  • Rev. S Campbell

    Wow! So it’s true – Christians really CAN bring stuff back from the dead!

    I still keep reading it as that you have all your *flies* back, though.

  • dwm

    Hi,

    I am not one of those mystical ‘those of wisdom’ persons you refer to, but I know a fair bit about GRUB and Linux and I think I can help you out.

    (Before you do anything, however, I really would urge you to backup anything vital you care about from the machine. We are fiddling with some fairly low-level innards here, and I wouldn’t want to be responsible for breaking your computer *and* losing any files you care about.)

    Background:
    PCs boot up in several stages, one by one:
    1: BIOS. The BIOS starts, does various very low-level things (like finding all of your hard drives and beeping a few times). When finished, it will then run the bootloader.
    2: The Bootloader. The bootloader is the very first program run from your hard drive when your machine starts up. It’s installed in a special bit at the very start of the disk, called the Master Boot Record, or MBR. It’s job is very simple — find the operating system, wherever it may be, and run it. And then get’s out of the way.
    3: The Operating System. Windows or Linux, it starts up, loads some drivers, and eventually asks you to login.

    On a Windows box, #2 is normally the fairly invisible bootloader that comes with Windows, and #3 is Windows itself.

    GRUB is also a bootloader. If you install GRUB onto your hard drive as part of a Linux install, it will overwrite the regular Windows bootloader so that (as you found) when you turn your computer on it will dutifully start up your new Linux installation. Which is fine, unless you want Windows back.

    The trick you’ve used to get access to Windows back is simple; the XP CD simply but the regular Windows bootloader back where it had originally left it, overwriting the GRUB upstart that had replaced it. So you now have Windows back. But presumably no Linux.

    Of course, if you put GRUB back as it was, you’ll be back to your can’t-boot-Windows square one position again.

    HOWEVER: Grub is moderately cunning. Once installed, it can be instructed to present a little bootup menu asking you *which* OS you want to run when your computer boots up. To do this you’ll need to edit a GRUB configuration file so that you can teach GRUB about the different operating systems available on your machine. (Sadly, it can’t automagically work it out by itself.)

    The configuration file you’ll need to edit is called “menu.lst”. It’s usually kept in “/boot/grub/”. If you load it up in the local text-editor du jour, you’ll probably see a collection of fairly arcane GRUB commands. (With some equally arcane comments prefixed with ‘#’ all over the place explaining why they’re all there.)

    You don’t need to worry about the stuff that’s there; you just need to add some lines to the end:

    title Run Windows, dammit.
    root (hd0,0)
    chainloader +1
    makeactive

    The bit beginning “root (hd0,0)” is the possibly-tricky bit. You need to get the numbers right. The first number specifies which hard disk has Windows on it, and the second number specifies which disk partition has Windows on it.

    (Computing people count from zero. It’s a bit odd but not too hard to get your mind around. So disk ‘0’ is your first disk. Disk ‘1’ is your second disk. And so on. )

    I can’t tell from here which partition Windows is on. However, it’s probably on the first partition — in which case, the above incantation will work. If not, you should be able to just use a little bit of trial and error to find the right number (it can only be one of 0-3.)

    And that should be it. All being well, when you next boot up GRUB should present a menu asking which OS you want to run. (You might need to press ESC if prompted; depends on how Kubuntu set things up normally.)

    Hope that helps..