LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   GRUB install problems... (post windows install on ubuntu) (http://www.linuxquestions.org/questions/linux-software-2/grub-install-problems-post-windows-install-on-ubuntu-706303/)

sersdf 02-20-2009 04:30 PM

GRUB install problems... (post windows install on ubuntu)
 
sorry if this is in the wrong forum...
Hey guys. Fairly new user to Ubuntu though I've used it a few times over the years to save my data from Windows crashes.
Have been using latest Ubuntu build (8.10) exclusively for 3 weeks. Till I just reinstalled Windows XP...

Lost GRUB, so I can't boot into Ubuntu. I'm posting this off my Live! CD (Ubuntu 8.10). Followed the first two sets of instructions at:
https://help.ubuntu.com/community/Re...tallingWindows
But couldn't get either to work. I've included the terminal outputs below. Any help would be sooo appreciated. Thanks.

using the 1st method given:

grub> find /boot/grub/stage1
(hd0,7)

grub> root (hd0,7)

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,7)/boot/grub/stage2 /bo
ot/grub/menu.lst"... failed

Error 22: No such partition

****
so I tried the 2nd method offered on the page. using the second method (I used >>> to include my commentary):

ubuntu@ubuntu:~$ sudo -i
root@ubuntu:~# fdisk -l
omitting empty partition (5)

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x14cb14cb

Device Boot Start End Blocks Id System
/dev/sda1 * 1 146 1172713+ 7 HPFS/NTFS
/dev/sda2 147 12161 96510487+ f W95 Ext'd (LBA)
/dev/sda5 147 219 586309+ 82 Linux swap / Solaris
/dev/sda6 220 11023 86783098+ 7 HPFS/NTFS
/dev/sda7 11024 12161 9140953+ 83 Linux

>>>ok, so my Linux partition root is on sda7 and my boot is sda1. Does it matter that the tutorial has the boot partition as Linux while mine is NTFS? Moving on...

root@ubuntu:~# mount -t ext3 /dev/sda7 /mnt/root
mount: /dev/sda7 already mounted or /mnt/root busy
mount: according to mtab, /dev/sda7 is already mounted on /mnt/root

>>> I already mounted the root drive in an earlier attempt. So this is fine.

root@ubuntu:~# ls /mnt/root
bin dev home lib mnt root sys var
boot etc initrd.img lost+found opt sbin tmp vmlinuz
cdrom grub initrd.img.old media proc srv usr vmlinuz.old

>>> just proving all is well

root@ubuntu:~# mount -t ext3 /dev/sda1 /mnt/root/boot
mount: /dev/sda1 already mounted or /mnt/root/boot busy
mount: according to mtab, /dev/sda1 is mounted on /media/disk

>>> I already mounted the boot drive in an earlier attempt. So this is fine.

root@ubuntu:~# ls /mnt/root/boot
abi-2.6.27-11-generic memtest86+.bin
abi-2.6.27-7-generic System.map-2.6.27-11-generic
config-2.6.27-11-generic System.map-2.6.27-7-generic
config-2.6.27-7-generic vmcoreinfo-2.6.27-11-generic
grub vmcoreinfo-2.6.27-7-generic
initrd.img-2.6.27-11-generic vmlinuz-2.6.27-11-generic
initrd.img-2.6.27-7-generic vmlinuz-2.6.27-7-generic

>>> just proving that all is well

root@ubuntu:~# sudo grub-install --root-directory=/mnt/root /dev/sda
The file /mnt/root/boot/grub/stage1 not read correctly.

>>> now, should sda have been hda there? What is wrong with this stage1 file that it fails in both the methods? I even downloaded the grub installer and manually put stage1 and stage 2 into the root folder of the boot partition, but it still doesn't work. I'm baffled.

Like I said, any insight would be so appreciated. Thanks, guys.

mostlyharmless 02-23-2009 06:32 PM

Quote:

Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,7)/boot/grub/stage2 /bo
ot/grub/menu.lst"... failed

Error 22: No such partition
Use
grub> find /boot/grub/stage2
grub> find /boot/grub/menu.lst
to verify these files locations as well.


Quote:

ok, so my Linux partition root is on sda7 and my boot is sda1. Does it matter that the tutorial has the boot partition as Linux while mine is NTFS? Moving on...
Sometimes; there's a Windows use of the boot partition that grub uses for stage2. I'll try to find the reference...

yancek 02-23-2009 10:31 PM

Quote:

Till I just reinstalled Windows XP...

Lost GRUB,
Pretty much always happen with a windows install, overwrites whatever is in the mbr, whether another windows OS or other.

The find command output below does not look right. Your fdisk output only shows partitions up to sda7 which would be (hd0,6) in Grub.
Quote:

grub> find /boot/grub/stage1
(hd0,7)
Your Grub install should be:
root (hd0,6)
setup (hd0)
quit

You don't have a boot partition, you only have one Linux partition which is the root partition on sda7. You don't have any boot files on sda1, you should have stage1 of Grub in the mbr of sda which is not on a partition.
The change above should work if you have posted correct info from fdisk.

CJS 02-24-2009 07:08 AM

Quote:

Originally Posted by sersdf (Post 3451670)
Code:

root@ubuntu:~# fdisk -l
omitting empty partition (5)
 
Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x14cb14cb
 
  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        146    1172713+  7  HPFS/NTFS
/dev/sda2            147      12161    96510487+  f  W95 Ext'd (LBA)
/dev/sda5            147        219      586309+  82  Linux swap / Solaris
/dev/sda6            220      11023    86783098+  7  HPFS/NTFS
/dev/sda7          11024      12161    9140953+  83  Linux


As shown highlighted above, any time you get an "omitting empty partition (X)" error from fdisk, that's unfortunately a sure sign your partition table is corrupt. Grub is extremely sensitive to any problems with the HDD's partition table, so that is most likely why you are having problems with the Grub commands right now. In your particular case, since you don't have any overlapping partitions, most likely the cause of fdisk's error is that one of the EBRs (Extended Boot Records) points to another EBR that doesn't exist any more (the EBRs are associated with your logical partitions). This is actually a common problem that can occur after reinstalling Windows, and I believe it is because there are at least two different standards for how to set up extended partitions and the logical partitions that go inside of them; Windows probably uses the more restrictive standard, whereas most Linux partitioning tools use the other standard that allows more freedom in setting up the extended partition. Therefore, the Windows partitioner can't correctly deal with the logical partitions that have been set up in linux in some cases, and Windows ends up corrupting the partition table with its own rules. But the good news is that problem is usually easy to fix, so how about doing the following command:
Code:

sudo fdisk /dev/sda
Press "w" and then enter, and that will most likely fix the problem. What that does is simply rewrite your current partition table with all the original partition values, except fdisk is smart enough not to include the non-existent EBR. Next reboot your Live CD (it is important to reboot), and please post the new output of:
Code:

sudo fdisk -lu
sudo grub
grub> root (hd0,6)
grub> setup (hd0)
grub> quit

And we can work from there if you want.

sersdf 02-27-2009 07:59 AM

hey guys. thanks for the replies. since my issue was time-pressing, i tried tons of solutions. eventually i was booting with the super grub disc, which yielded some bootup issues in linux. but when i removed the disc, Grub opened beautifully, and all OSes loaded perfectly.... super grub ftw.

nevertheless, i super appreciate your help, and i definitely learned a bit reading them. see ya 'round the forums.


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