-   Linux - Newbie (
-   -   Grub _ Chain-loading problem (

pam196 09-07-2007 08:19 AM

Grub _ Chain-loading problem
I have recently attempted to install Ubuntu Linux and have it dual boot off XP's ntldr. I have run through several howto's and read a fair amount on forums to try and get this working myself; but am failing at getting grub chain loaded from ntldr. My disk geometry and fdisk output are at the bottom of this post.

I installed Grub by running the following commands:

sudo grub
grub> root (hd1,4)
grub> setup (hd1,4)

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 (hd1,4)"... failed (this is not fatal)

Running "embed /boot/grub/e2fs_stage1_5 (hd1,4)"... failed (this is not fatal)

Running "install /boot/grub/stage1 (hd1,4) /boot/grub/stage2 p /boot/grub/menu

.lst "... succeeded


I'm guessing the non-fatal error is actually fatal?
The command I'm using to create the boot file is:

dd if=/dev/hdb5 of=./ubuntu.bin bs=512 count=1

I then edited the boot.ini on my Windows partition and added a line:
I get this as a choice in the OS menu, and when I select it all I see is:
Grub _
I believe this is part of the contents of the ubuntu.bin file, and that Grub is not actually loading at all from (hd1,4) and not reading my menu.lst file which is where I installed it to.

Has anyone got any ideas where I'm going wrong with this setup? I'm not looking to replace ntldr with Grub...hence this setup.

Many Thanks,

The output below has been edited in that i have removed my SATA drives from it, as I dont believe they are relevant to the problem (and it would take up a large amount of post space). My BIOS is set to boot from IDE.
Current Disk Setup:

~$ sudo fdisk -lu

Disk /dev/hda: 40.0 GB, 40020664320 bytes

16 heads, 63 sectors/track, 77545 cylinders, total 78165360 sectors

Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 63 78164351 39082144+ 7 HPFS/NTFS

Disk /dev/hdb: 80.0 GB, 80026361856 bytes

255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors

Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System

/dev/hdb1 63 156296384 78148161 5 Extended

/dev/hdb5 * 126 71682029 35840952 83 Linux

/dev/hdb6 71682093 75874994 2096451 82 Linux swap / Solaris

/dev/hdb7 75875058 156296384 40210663+ b W95 FAT32

grub> geometry (hd1)

drive 0x81: C/H/S = 9729/255/63, The number of sectors = 156301488, /dev/hdb

Partition num: 4, Filesystem type is ext2fs, partition type 0x83

Partition num: 5, Filesystem type unknown, partition type 0x82

Partition num: 6, Filesystem type is fat, partition type 0xb

Bariton 09-07-2007 08:28 AM

Why do you want still to use the window bootmanager? Try using only grub and add a windows-section in menu.lst. For example:

title Windows
chainloader (hd0,0)+1

Then when installing grub don't say "install (hd1,4)" but

install (hd0)

pixellany 09-07-2007 08:34 AM

The one thing that I see is that--after making the file "ubuntu.bin", you need to copy it into the Windows partition. (in the same folder as boot.ini, I think)

note, in your dd command, I'm not sure you want or need to have the "./" in front of ubuntu.bin

pam196 09-07-2007 08:44 AM

Cheers for the quick responses!

I'm a little tentative about writing Grub into my MBR - mainly because I just don't want to interfere with the Windows installation which is on a seperate disk. It's a road I'll go down once I've exausted all other routes (I have now backed up my current MBR as I mull over using Grub as the primary bootloader). This post is the last chain salon for ntldr - perhaps not the best idea me posting this on a linux qs website then... :)

The ubuntu.bin file was copied to the windows partition (must have missed that bit out in my post). The ./ is not needed, but almost certainly not the cause of the problem as the file was written to the destination I was expecting.
I'm almost certain my ubuntu.bin file is being read during the boot as that's the only thing that is going to show the "Grub _" line i.e. Windows does not know about Grub.

teek 09-07-2007 09:01 AM

You can also install grub in the MBR of the disk windows isn't on (hdb for example) then set in the bios to boot the second harddisk that way you won't have to mess your windows mbr and if you mess up you can just set the bios to boot hda again.

pixellany 09-07-2007 09:02 AM

I am trying to get ready for work and think at the same time....not a pretty sight..;)

Have you created/edited your /boot/grub/menu.lst file in the Ubuntu partition?

pam196 09-07-2007 09:12 AM

I think I'll give that a go before i write Grub into my main disk MBR - sounds like a good suggestion on that front! Though ultimately dual booting off ntldr is the best option for me (shared PC etc, and my girlfriends not overly PC literate - might be an akward one trying to talk her through changing the boot options in the BIOS because I left it booting Ubuntu).

I've opened up the menu.lst file created by the ubuntu install and it knows about my Windows partiton etc and looks fine to me regarding the location of the ubuntu installation.

title Ubuntu, kernel 2.6.20-15-generic
root (hd1,4)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=7b4069e7-a197-4fcb-a99c-d250a45758ab ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic

title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root (hd1,4)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=7b4069e7-a197-4fcb-a99c-d250a45758ab ro single
initrd /boot/initrd.img-2.6.20-15-generic

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

title Other operating systems:

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Microsoft Windows XP Professional
root (hd0,0)
chainloader +1

My gut feeling is that Grub is not finding hd(1,4) partition.

teek 09-07-2007 09:31 AM


Originally Posted by pam196 (Post 2884429)
might be an akward one trying to talk her through changing the boot options in the BIOS because I left it booting Ubuntu).

Its not if you get it to boot windows from there, its how I did it for years with a computer which somehow always stopped booting windows as soon as I messed with the mbr of the windows disk. Having 2 disks gives you a spare mbr to play with ;).

Edit: Maybe you can also post your /etc/fstab , you know you also should add 1 to the partition right?

Edit2: you know when you install grub on a secondairy disk you need to add this:

map (hd0) (hd1)
map (hd1) (hd0)

to your menu.lst/grub.conf... Also, that reverses the drive indicators; Grub finds the drive it's on to be hd0,0 although it isn't and you tell grub that by this statement.

pam196 09-07-2007 09:39 AM

ah ha - like the thinking! Definitely worth looking into straight away as it cant cause any harm with the current setup, and trusting it works straight off I can boot Windows also from the second disk. Will post the /etc/fstab once I'm up and running in ubuntu in a moment, I'm not sure what you mean by adding one to the partition. I know hdb5 is referred to as hd1,4 in Grub...

pam196 09-07-2007 09:49 AM

Booting of the ubuntu install cd, the output from more /etc/fstab is:

unionfs / unionfs rw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0
/dev/hdb6 swap swap defaults 0 0

I'm guessing its not got the info about hdb5 since I'm booted from the CD?

teek 09-07-2007 09:54 AM


Originally Posted by pam196 (Post 2884460)
I know hdb5 is referred to as hd1,4 in Grub...

That's right and yes, that is the fstab of the live cd but I see already that it should be fine.

By the way, you could also use "grub-install /dev/hda" (or hdb) to install grub with one command, some stuff is then done automagically.

pam196 09-07-2007 10:10 AM

OK, I've tried to setup hd1 as the main MBR. To do so I booted Ubuntu from CD, and typed the following commands:

sudo grub
root (hd1)
setup (hd1)

(also tried setup (hd1,0))

it errors on the setup command - Error 17: Cannot mount selected partition.

The hd1 disk does not have a primary partition, its an extended partition with logical drives. I understood this was not a problem for Linux from what I read on a website.

teek 09-07-2007 10:21 AM

I don't know this for sure, hope someone else does... but in gentoo you have to be inside the installed Linux environment because some stuff has to be written to /boot/grub for grub to work. Don't know how it is for ubuntu, if "grub-install" doesn't work I'm sorry to tell you that I'm out of options.

Can't you boot your existing Ubuntu with the live cd?

syg00 09-07-2007 10:26 AM

Look at your first post - you used "root (hd1,4)" there; why did you change ???. I would expect the following to work; presumes Feisty (7.04) as it uses UUID - else you'll have some cleanup to do with device addresses

root (hd1,4)
setup (hd1)

pam196 09-07-2007 10:32 AM

grub> setup (hd1)
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 (hd1)"... 17 sectors are embedded.
Running "install /boot/grub/stage1 (hd1) (hd1)1+17 p (hd1,4)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded

Cheers for the input syg00, looks like from the above output it may well have cleared up the issue. BTW I am using Fiesty Fawn.

Looks a darn site better than it has done before!

Thanks for your help too Teek, you put me on the right path. I'll post back and let you all know whether its fixed.

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