LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 09-07-2007, 09:19 AM   #1
pam196
LQ Newbie
 
Registered: Sep 2007
Posts: 12

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

Done.


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:
Ubuntu=C:\ubuntu.bin.
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,
Phil

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


 
Old 09-07-2007, 09:28 AM   #2
Bariton
Member
 
Registered: Jul 2006
Location: Schloß Holte-Stukenbrock
Distribution: (B)LFS 6.2.0
Posts: 42

Rep: Reputation: 15
Why do you want still to use the window bootmanager? Try using only grub and add a windows-section in menu.lst. For example:
Code:
title Windows
chainloader (hd0,0)+1
Then when installing grub don't say "install (hd1,4)" but
Code:
install (hd0)
 
Old 09-07-2007, 09:34 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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
 
Old 09-07-2007, 09:44 AM   #4
pam196
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Cheers for the quick responses!

Bariton:
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...

pixellany:
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.
 
Old 09-07-2007, 10:01 AM   #5
teek
Member
 
Registered: Jun 2004
Location: The Netherlands; Dordrecht
Distribution: Arch (at the moment)
Posts: 110

Rep: Reputation: 16
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.
 
Old 09-07-2007, 10:02 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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?
 
Old 09-07-2007, 10:12 AM   #7
pam196
LQ Newbie
 
Registered: Sep 2007
Posts: 12

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

pixellany:
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
quiet
savedefault

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
quiet

title Other operating systems:
root

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


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

Last edited by pam196; 09-07-2007 at 10:20 AM.
 
Old 09-07-2007, 10:31 AM   #8
teek
Member
 
Registered: Jun 2004
Location: The Netherlands; Dordrecht
Distribution: Arch (at the moment)
Posts: 110

Rep: Reputation: 16
Quote:
Originally Posted by pam196 View Post
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.

Last edited by teek; 09-07-2007 at 10:36 AM.
 
Old 09-07-2007, 10:39 AM   #9
pam196
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
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...
 
Old 09-07-2007, 10:49 AM   #10
pam196
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
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?
 
Old 09-07-2007, 10:54 AM   #11
teek
Member
 
Registered: Jun 2004
Location: The Netherlands; Dordrecht
Distribution: Arch (at the moment)
Posts: 110

Rep: Reputation: 16
Quote:
Originally Posted by pam196 View Post
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.
 
Old 09-07-2007, 11:10 AM   #12
pam196
LQ Newbie
 
Registered: Sep 2007
Posts: 12

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

Last edited by pam196; 09-07-2007 at 11:16 AM. Reason: typo
 
Old 09-07-2007, 11:21 AM   #13
teek
Member
 
Registered: Jun 2004
Location: The Netherlands; Dordrecht
Distribution: Arch (at the moment)
Posts: 110

Rep: Reputation: 16
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?
 
Old 09-07-2007, 11:26 AM   #14
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,505

Rep: Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079
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
Code:
root (hd1,4)
setup (hd1)
 
Old 09-07-2007, 11:32 AM   #15
pam196
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
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.
succeeded
Running "install /boot/grub/stage1 (hd1) (hd1)1+17 p (hd1,4)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.


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.
 
  


Reply

Tags
grub


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
GRUB loading ... (problem) kojot Fedora 12 09-02-2007 02:42 PM
grub(SuSE)/Lilo(Slackware) chain loader problems The Chain Linux - Newbie 32 10-12-2006 06:24 PM
How can I chain boot GRUB (Fedora) from LILO (Slackware)? DaneM Linux - Distributions 6 07-06-2005 05:25 AM
how to chain load grub on a floppy? zero79 Linux - General 11 08-15-2004 05:51 PM
Chain loading grub from lilo - help! thebeardedladie Linux - General 2 03-09-2003 04:07 PM


All times are GMT -5. The time now is 03:58 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration