Reinstalled Win XP and repaired Grub, now I can't boot Linux or Windows. Please help.
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Reinstalled Win XP and repaired Grub, now I can't boot Linux or Windows. Please help.
Hi,
I installed Windows XP again last night after trying Vista for a bit. Then I couldn't boot Ubuntu of course, so I did the root (hd0,1) + setup (hd0) like I've done successfully once before.
But this time something must have gone wrong, because when I try to boot Ubuntu I get this error message:
Code:
Error 17: Cannot mount selected partition
And when I try to boot Windows I get this message:
Code:
Error 12: Invalid device specified
Does anyone know how to solve this problem?
Thanks.
Last edited by MegaSvensk; 10-12-2007 at 07:49 PM.
What system were you running when you re-installed GRUB? If you were running from live CD, then the drives might not been seen the same.
If running from live CD---before running GRUB--do "fdisk -l" to see how the system sees your drives. This will determine what to put in the GRUB install commands.
It's handy to keep GRUB on a floppy for situations like this (But I don't always follow my own advice...)
Perhaps your partition numbers have changed after erasing vista?
Compare fdisk -l with /boot/grub/menu.lst (presumably from a live install... so make sure it is the menu.lst on the HDD and not the one on the CD.)
Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2 5738 46082452+ f W95 Ext'd (LBA)
/dev/sda2 5739 36483 246959212+ 7 HPFS/NTFS
/dev/sda5 2 3825 30716248+ 7 HPFS/NTFS
Disk /dev/hdc: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 21773 174890040 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/hdc2 21774 24199 19486845 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/hdc3 24200 24321 979965 82 Linux swap / Solaris
Partition 3 does not end on cylinder boundary.
Quote:
Originally Posted by Simon Bridge
Perhaps your partition numbers have changed after erasing vista?
Compare fdisk -l with /boot/grub/menu.lst (presumably from a live install... so make sure it is the menu.lst on the HDD and not the one on the CD.)
Well, this is what it used to look like so it has changed quite a bit.
Code:
Disk /dev/sda: 300,0 GB, 300090728448 byte
255 heads, 63 sectors/tracks, 36483 cylindrar
Devices = cylindrar av 16065 · 512 = 8225280 byte
Device Boot Start End Blocks Id System
/dev/sda1 * 1 5738 46090453+ 7 HPFS/NTFS
/dev/sda2 5739 36483 246959212+ 7 HPFS/NTFS
Disk /dev/hdc: 200,0 GB, 200049647616 byte
255 heads, 63 sectors/tracks, 24321 cylindrar
Devices = cylindrar av 16065 · 512 = 8225280 byte
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 21135 169758776 7 HPFS/NTFS
Partition 1 does not end on cylinder limit.
/dev/hdc2 21135 21773 5125680 c W95 FAT32 (LBA)
Partition 2 does not end on cylinder limit.
/dev/hdc3 21774 24199 19486845 83 Linux
Partition 3 does not end on cylinder limit.
/dev/hdc4 24200 24321 979965 82 Linux swap / Solaris
Partition 4 does not end on cylinder limit.
How do I view menu.lst?
Last edited by MegaSvensk; 10-12-2007 at 08:34 PM.
Do you think what's causing Windows not to boot is the fact that it was at sda1 before and now it's at sda5? Can I just change grub to boot XP at sda5? If so, how do I do it?
I did remove the FAT32 partition, so Linux has been bumped up from hdc3 to hdc2.
Maybe I just have make some edits to grub to fix this. But the question is how do I do that?
Last edited by MegaSvensk; 10-12-2007 at 08:41 PM.
You can get into the grub interactive mode and enter the "kernel" & "initrd" lines manually. Using autocompletion makes it easy to locate the kernel and initrd file. Then enter the "boot" command to get into your regular linux installation. From there, examine the system. If the devices jive with what you used to boot with, then edit /boot/grub/menu.lst to reflect the changes and run grubinstall.
If the devices are different from what you saw earlier than edit /boot/grub/device.map. I ran into this situation on my desktop where the bios would have /dev/sda & /dev/sdb reversed. After booting I couldn't simply edit menu.lst.
It looks like your partition numbers have certainly changed.
Read grub(8) and update-grub(8), but most people edit the menu.lst file by hand following the conventions already present.
You'll probably only need to point the old linux root device to the correct place. Reboot then run update-grub. But you may want to edit the windows entry too. Note: you only need to edit the default linux entry and remove all others.
title Ubuntu, kernel 2.6.20-16-generic
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=5a285e7d-4d95-412f-85b6-f3c58f06e18c ro quiet splash locale=sv_SE
initrd /boot/initrd.img-2.6.20-16-generic
quiet
savedefault
title Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=5a285e7d-4d95-412f-85b6-f3c58f06e18c ro single
initrd /boot/initrd.img-2.6.20-16-generic
title Ubuntu, memtest86+
root (hd0,1)
kernel /boot/memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda5
title Microsoft Windows XP Professional
root (hd1,0)
savedefault
makeactive
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1
I changed the Linux ones to where the find /boot/grub/stage1 says the root is (before it was 0,2) and I changed XP from sda1 to sda5.
So, I changed it and I rebooted back into the live cd and now I'm trying to run the update-grub command but I get this error:
Code:
No GRUB directory found. To create a template run 'mkdir /boot/grub' first.
To install grub, install it manually or try the 'grub-install' command. ###
Warning, grub-install is used to change your MBR.
I tried cd'ing the grub directory and then running it, but I got the same message.
Edit:
Okay, I managed to run the command but gave me an error about that it couldn't resolve something and then it changed the partition number back to the wrong ones.
Then I just decided to try and boot up without update-grub and when I tried booting linux, it worked perfectly. However, when I tried booting Windows, I got the same Error 12.
Edit again:
I tried running update-grub inside of my real Ubuntu now but it just updated it back the old, erroneous value.
Any ideas on how to get Win XP up and running again. I guess I should change the root value but to what...
Last edited by MegaSvensk; 10-12-2007 at 11:18 PM.
Okay, so I guess I'll just test root (hd1,x) till I get the right one.
Is there any way I can test the path inside of Ubuntu to see if it works without having to reboot over and over?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.