LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-20-2009, 04:30 PM   #1
sersdf
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Rep: Reputation: 0
Unhappy 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.
 
Old 02-23-2009, 06:32 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
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...
 
Old 02-23-2009, 10:31 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,499

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
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.
 
Old 02-24-2009, 07:08 AM   #4
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Quote:
Originally Posted by sersdf View Post
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.
 
Old 02-27-2009, 07:59 AM   #5
sersdf
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
  


Reply



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
GRUB problems on dual XP+Ubuntu install NC8000 internal+multibay scotchfx Ubuntu 1 07-23-2007 02:08 AM
Ubuntu/Kubuntu post install problems bigjohn Linux - Newbie 1 12-18-2006 05:39 AM
ubuntu post install ptawe Ubuntu 5 03-24-2006 02:35 PM
problem wit GRUB..post 6.0 install JusCrzn Linux From Scratch 6 12-24-2004 12:25 PM
grub 17 error post debian install teh_zero Linux - Newbie 1 11-16-2004 04:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:12 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