LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 10-12-2007, 07:47 PM   #1
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Rep: Reputation: 15
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.
 
Old 10-12-2007, 08:10 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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...)
 
Old 10-12-2007, 08:13 PM   #3
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
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.)
 
Old 10-12-2007, 08:17 PM   #4
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks for your reply.

I'm using an Ubuntu live CD right now.

This is my fdisk -l:
Code:
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 View Post
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.
 
Old 10-12-2007, 08:33 PM   #5
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
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.
 
Old 10-12-2007, 09:40 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 10-12-2007, 09:45 PM   #7
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
How do I get into the "grub interactive mode"? I'm pretty much a newbie to Linux and Grub.

I tried "gedit /boot/grub/device.map," but the file came up empty.

Last edited by MegaSvensk; 10-12-2007 at 09:47 PM.
 
Old 10-12-2007, 09:46 PM   #8
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
How do I view menu.lst?
cat /boot/grub/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.

sudo cp /boot/grub/menu.lst /boot/grub/menu-old.lst
sudo gedit /boot/grub/menu.lst

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.
 
Old 10-12-2007, 09:49 PM   #9
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Simon Bridge View Post
cat /boot/grub/menu.lst
I tried that command but I got "no such file or directory."
 
Old 10-12-2007, 10:03 PM   #10
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
From the live mode?
First mount the partition that contains your normal /boot directory

- if the linux root is /dev/hdc2 then:

mount -t ext3 /dev/hdc2 /mnt
ls /mnt/boot/grub

... now you see it?
Code:
$ ls /mnt/boot/grub
default        installed-version  minix_stage1_5     xfs_stage1_5
device.map     jfs_stage1_5       reiserfs_stage1_5
e2fs_stage1_5  menu.lst           stage1
fat_stage1_5   stage2
If you chroot /mnt, the system will list everything where you are used to it. But if you confuse easy, use the grub interactive mode.
 
Old 10-12-2007, 10:07 PM   #11
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
Yeah, I see it now. But I still don't know how to view the menu.lst

Edit:
Never mind, I figured out how to view it.

Last edited by MegaSvensk; 10-12-2007 at 10:10 PM.
 
Old 10-12-2007, 10:18 PM   #12
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
Do you think this will work?
Code:
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.
 
Old 10-12-2007, 10:38 PM   #13
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
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.
 
Old 10-13-2007, 12:23 AM   #14
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
I'm bumping this so that it won't fall off of the first page while I get a few hours of sleep before I have to go to work.
 
Old 10-13-2007, 06:34 AM   #15
MegaSvensk
Member
 
Registered: Sep 2007
Posts: 43

Original Poster
Rep: Reputation: 15
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
reinstalled windows in dual boot,,,grub disappeared,,,help ace.adi Linux - Newbie 3 03-18-2007 12:46 PM
Newbie: Reinstalled windows, can't boot Fedora raheelm Linux - Software 2 05-23-2006 07:07 AM
just won't boot from te right disk since win reinstalled :confused: torsten.t.h Linux - Software 6 05-23-2006 07:05 AM
Windows 2003 server & Fedora / GRUB wont boot win UrbanDEV Linux - Newbie 6 04-28-2004 10:34 AM
Reinstalled Windows 98 lost linux dual boot llefty Linux - Newbie 0 08-01-2003 01:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration