Ubuntu ate my XP bootage
May 9, 2007 5:11 PM   Subscribe

Ubuntu ate my WinXP via Grub: help me induce vomiting?

After an apparently botched Ubuntu installation, I now only have Ubuntu boot options visible in the GRUB bootloader. From inside Ubuntu, I can see that all of my Windows XP data and NTFS partitions are alive and well (thankfully).

How do I get back into windows?

Backround: XP on disk 0, NTFS data partition and Ubuntu partitions on disk 1. The Ubuntu installation is totally expendible.
posted by onshi to Computers & Internet (16 answers total) 1 user marked this as a favorite
 
If you could, would you post the contents of your /boot/grub/menu.lst file for us to peruse.

You're looking for some lines that look like:

title Microsoft Windows XP
root (hd0,0)
makeactive

If they aren't there, that might be the start of your problems.
posted by Jimbob at 5:21 PM on May 9, 2007


can you do "cat /boot/grub/menu.lst" and post the output here?

And do "sudo fdisk -l" (will not harm anything) and also post that output here?

That should give us enough info to work from.
posted by jellicle at 5:23 PM on May 9, 2007


Oh, also after you've made whatever changes you need to make to menu.lst, I think you have to run:

sudo update-grub
posted by Jimbob at 5:23 PM on May 9, 2007


The Ubuntu installation is totally expendible.
How do I get back into windows?


First, install or boot to the Windows Recovery Console.

Then, use the FIXMBR command on the console to reinstall Windows' bootloader to your Master Boot Record. This removes (most of) grub, and will make it difficult to boot back into Ubuntu.

Or, if you want to try to salvage the installation, if you add the following lines to your menu.lst file (in /boot/grub , usually), you might be able to dual-boot normally. This assumes Windows is installed on the first partition of your first drive (which is usually true):

After this line: ### END DEBIAN AUTOMAGIC KERNELS LIST

add these lines:
title Microsoft Windows XP
root (hd0,0)
makeactive
chainloader +1
posted by toxic at 5:28 PM on May 9, 2007 [1 favorite]


Response by poster: jellicle: here goes...

From menu.lst...

title Ubuntu, kernel 2.6.20-15-generic
root (hd1,4)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=2591af96-3b19-4701-ae0e-77bcbe1f0d5c ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root (hd1,4)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=2591af96-3b19-4701-ae0e-77bcbe1f0d5c ro single
initrd /boot/initrd.img-2.6.20-15-generic

title Ubuntu, memtest86+
root (hd1,4)
kernel /boot/memtest86+.bin
quiet


And from fdisk...

Disk /dev/sda: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 5 40131 de Dell Utility
/dev/sda2 * 6 18846 151340332+ 7 HPFS/NTFS
/dev/sda3 18847 19452 4867695 db CP/M / CTOS / ...

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 42315 339895206 7 HPFS/NTFS
/dev/sdb2 42316 60801 148488795 f W95 Ext'd (LBA)
/dev/sdb5 42316 60551 146480638+ 83 Linux
/dev/sdb6 60552 60801 2008093+ 82 Linux swap / Solaris
posted by onshi at 5:32 PM on May 9, 2007


Response by poster: toxic: I've edited the file, but as a Linux know-nothing, I don't now how to save over the un-edited, write-protected version of the file. What would the appropriate command be to copy the edited file (in the same directory) over the old one?
posted by onshi at 5:35 PM on May 9, 2007


Response by poster: So, /dev/sda2 is the windows partition I'd like to boot from.
posted by onshi at 5:36 PM on May 9, 2007


onshi, to copy to this. Say, for example, the new file you've made is called "menu.new"

sudo cp menu.new /boot/grub/menu.lst
posted by Jimbob at 5:37 PM on May 9, 2007


I don't now how to save over the un-edited, write-protected version of the file.

Use the command chmod +rw filename to make the file writeable for all users.
posted by rancidchickn at 5:38 PM on May 9, 2007


So, /dev/sda2 is the windows partition I'd like to boot from.

Then replace (hd0,0) with (hd0,1) in my lines above. What do you have on sda1?

Jimbob is right with the command to copy one file over another (protected) one. rancidchickn's solution will work, but is a VERY bad practice, because it is a potential security problem.

In the future, when editing protected files (files owned by root), you should use sudo to start your editor... like this: "sudo nano /boot/grub/menu.lst"
posted by toxic at 5:42 PM on May 9, 2007



To edit protected files use sudo. Always make a backup of your bootloader first. In this case, you'll probably use:

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.backup

sudo gedit /boot/grub/menu.lst"

If you have a dell it often comes with a hidden diagnostic/recovery partition built in. In that case, your windows install will be at (hd0,1), rather than (hd0,0).

Here's the relevant section from my Ubuntu/XP dual boot system:
------------------------------
title Windows XP
root (hd0,1)
makeactive
chainloader +1

title Dell Diagnostics
root (hd0,0)
makeactive
chainloader +1
---------------------------------------
posted by chrisamiller at 5:42 PM on May 9, 2007


Okay, that's sort of a weird configuration, and I suppose that the Ubuntu installer failed to properly recognize your existing Windows installation.

So what you need to do is: as root, edit the /boot/grub/menu.lst file. "sudo vi /boot/grub/menu.lst" will work, if you know vi, a basic text editor. If you don't know vi, try "sudo gedit /boot/grub/menu.lst" or "sudo kedit /boot/grub/menu.lst" (at least one of those graphical editors should be installed).

Now that you're editing the file, add this at the end of it:

title Boot Microsoft Windows XP
root (hd0,1)
savedefault
makeactive
chainloader +1

I find it odd that your menu.lst file doesn't have a bunch of stuff in it about a Debian automagic kernels list. What happens when you run "sudo /usr/sbin/update-grub"? Does the contents of the menu.lst file change (cat it again)?

But anyway, adding those lines should let you boot Windows.
posted by jellicle at 5:47 PM on May 9, 2007


Another note:
This stuff is all extensively covered over at the Ubuntu Forums

In my experience, a few searches on that site will turn up an answer to damn near any question you have about Ubuntu.
posted by chrisamiller at 5:47 PM on May 9, 2007


Response by poster: Thank you all for your help, I edited the file and can boot into Windows with impunity. It does seem like the funky extra partitions (thanks, Dell!) were the problem.
posted by onshi at 5:55 PM on May 9, 2007


It does seem like the funky extra partitions (thanks, Dell!) were the problem.

To be clear, the extra partition shouldn't have caused the problem with your install. It just creates a problem when you manually edit your grub menu.

I can't tell you exactly why the install went awry, but glad to hear that you're back up and running now.
posted by chrisamiller at 7:04 PM on May 9, 2007


Response by poster: chrisamiller: I was thinking that the Ubuntu install looked at my first HD and couldn't make sense of the partitioning there, hence the absence of a Windows boot option.
posted by onshi at 12:44 PM on May 10, 2007


« Older Help me germinate my citrus seeds!   |   Flash drive won't reclaim free space from deleted... Newer »
This thread is closed to new comments.