Forty minutes or so ago, I turned on the computer (actually, Liesl rebooted it out of Windows), and when I selected ‘Linux’ from the boot menu, it wouldn’t boot. Either things went black immediately or it said “GRUB” at the top of the screen and froze. Not good.
At least Windows was still booting. So I did some browsing to remind myself how I had dual booting set up in the first place. This page is a fairly accurate description; it suggests that the boot sector isn’t right. So either a bit went bad on the copy of the boot sector I use or a formerly functional boot sector magically stopped working.
I actually had two copies of the boot sector lying around: the one that actually gets used, in an NTFS partition, and another copy, in a FAT32 partition that exists only to transfer files between Windows and Linux. But I don’t know how to compare files in Windows, so I couldn’t directly test the “bit went bad” hypothesis. So I ended up just copying the version from D: to C:, and rebooting.
Which didn’t work. So either a formally working boot sector has simply stopped working, or something worse has happened.
So: the next step is to generate a new boot sector from the actual contents of /dev/hda7. (And if that fails, reinstall Linux, I guess? Good thing I backed things up a couple of days ago.) But how do I do that? I don’t have anything useful like a bootable rescue CD around; that would be too sensible.
But there’s a Linux distro called Knoppix that boots from a CD; maybe that will do the trick. Easy enough to download an ISO image for that; surely if I stick a blank CD into the drive, Windows will give me an option to write the ISO onto it?
Well, no: it gives me three options for writing music CD’s, and one option for assembling files myself to burn onto a CD, but no option for burning a preexisting image. Can it really be the case that Windows doesn’t come with a tool for that? After some googling, the latter really does seem to be the case. Sigh. But I can find a free program to do it easily enough.
So: burn Knoppix CD, boot from it, it comes up. Yay. I can’t say that I’m thrilled with the design sensibilities, but the functionality is great; I could look at all the filesystems (both Windows and Linux), browse the web, etc. So, at the very least, if I need to reinstall Linux, it will be easy enough to back up my home directory first. And I compare the two saved boot sectors I have; they are identical, as suspected.
So I should generate a new boot sector; what I need is the first 512 bytes of /dev/hda7. Hmm: I’m not root, so I can’t read /dev/hda7. What’s the root password? It turns out that there isn’t one, but you can run root commands by doing sudo. (Among other mechanisms.) So now I have a copy of the boot sector in /tmp.
And it’s different from the one I had been using. Which is good! Now: how do I get it onto my Windows partition? It’s mounted read-only, but the FAQ tells me how to fix that. So now it’s on D: (the FAT32 partition; writing to NTFS from Linux isn’t recommended).
Reboot into Windows, copy it to C:, reboot. And here I am, everything is working fine.
I still don’t know what happened between yesterday and today that cause the old boot sector to stop working. Admittedly, I’ve reinstalled the OS at least once (I think?) since I created the original one, so it’s not a complete shock that the boot sector has changed. But if that were the case, it should have stopped working a long time ago, not yesterday.
Ah well; it’s working now. Yet another sign of the fragility of my computer setup; I’ll improve matters over the course of 2006, honest I will.
Post Revisions:
There are no revisions for this post.
What ISO burner did you wind up using?
Actually, you can write to NTFS all right from Knoppix by using the Captive NTFS drivers (http://www.jankratochvil.net/project/captive/). The install program locates the actual Windows NTFS drivers on your disk (they are licensed to run on your system, after all) and then runs them under Linux in a sandbox. I’ve done this to reset the local administrator password on a Windows box.
The way to compare files on Windows, of course, is to install Cygwin first.
12/26/2005 @ 8:44 pm
ISO recorder v2. Worked quite nicely.
I didn’t know about Captive NTFS; interesting. Yes, I figured out at some point that Cygwin would be a good way to answer that question, but I didn’t get as far as actually installing it, since it wouldn’t have helped with much else in that process.
12/27/2005 @ 3:04 pm
You can set up a new GRUB boot sector with the “setup” command. Check in the GRUB manual under something like “install GRUB natively”; they’ve got step-by-step instructions.
12/29/2005 @ 3:42 pm