LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 01-26-2007, 04:44 PM   #1
pxumsgdxpcvjm
Member
 
Registered: Aug 2005
Posts: 235

Rep: Reputation: 30
Unhappy Telling grub which partition should it boot


Ok. I don't know if this question belongs here, so take my apologies if such is the caso. Anyway, grub is fooling me too much and googling hasn't helped me much. I want grub to boot a certain partition, but it refuses to do it no matter what I try. This is the scenario:

I have two SATA drives and one IDE drive. Windows (2000) and Linux (Debian Etch) live in sda (1 for Windows and 2 for Debian). I boot them nicely by setting root(hd0,0) for Windows and root (hd0,1) for Debian.

This is OK. Now I have a new OS installed at my IDE's first partition (hda1 in Linux), and grub doesn't want to boot it. I tried setting root in grub to hd1,0, hd2,0,hd3,0,hd4,0 and so on. Nothing works. In the best cases (hd1 and hd2), grub complains about error 12, while with hd3 and hd4 it complains about error 21 (which AFAIK means that it couldn't find the drive).

I *can* boot hda1 if I chose that drive as the boot drive in my system's BIOS, but I'd like to integrate the new OS into grub's menu.

I *guess* that it is grub itself who gets fooled, because the bios reports hda to be the first drive (which in grub's own language is hd0), but grub calls hd0,0 the disk it is installed on.

I'm clueless

EDIT: FYI, grub is installed in sda's MBR

Last edited by pxumsgdxpcvjm; 01-26-2007 at 04:47 PM.
 
Old 01-26-2007, 04:59 PM   #2
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
If your third drive is the IDE then it should be refered to as (hd2,0). hd2 is the third drive and 0 is the first partition of that drive. You also need to make sure that the file /boot/grub/device.map contains:

(hd2) /dev/hda

Create a stanza in /boot/grub/menu.lst to boot to that drive and to that partition.
 
Old 01-26-2007, 06:49 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
You can really wind up chasing your tail with GRUB--especially if you change BIOS settings after installing and configuring GRUB.

What is your new OS? If Linux, then you can simply install GRUB from there. You can also install GRUB on that drive--IF you know what GRUB believes to be the numbering. I am very fuzzy on how this all works when you mix SATA and IDE drives.

My personal preference is to put all OSes on one drive, and use all the other dirves for data, backup, or specific directories. This avoids a lot of confusion.
 
Old 01-26-2007, 07:38 PM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
If you want to grab Grub by its horns try read the Grub Manual.

In there you will find the command at Grub prompt
Code:
geometry (hd0)
geometry (hd1)
geometry (hd2)
can instruct Grub to tell you the partitions of all 3 of your disks. From this information you will be able to know where is you Linux, as native Linux has partition ID 0x83, Swap 0x82, NTFS 0x7 etc.

Also if your new OS uses Grub then it must have Grub's menu.lst so you can ask Grub to report to you which partition has it by
Code:
find /boot/grub/menu.lst
You can use "cat" command to display menu.lst so that you can type the commands in as displayed on the screen to boot each system up manually.

The possibilities are endless.

Still confused?

In my signature you can see a link in which I created 145 partitions and wrote the menu.lst before filling everyone of them with an OS. I can certify that Grub does not get fooled and will do exactly it is told. It boots every one of the 145 systems.

Last edited by saikee; 01-26-2007 at 07:44 PM.
 
Old 01-26-2007, 09:00 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,834

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
This "new OS" - Vista by any chance ???.
 
Old 01-27-2007, 04:01 AM   #6
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Grub boots a Vista no difference to a Dos, Windows, BSD or Solaris.
 
Old 01-27-2007, 05:13 AM   #7
pxumsgdxpcvjm
Member
 
Registered: Aug 2005
Posts: 235

Original Poster
Rep: Reputation: 30
Thumbs up

I can finally boot it, but I still think that grub calls hd0 to the drive he lives on no matter what the bios says. This is device.map on /boot/grub:
Quote:
(hd0) /dev/hda
(hd1) /dev/sda
(hd2) /dev/sdb
But these are the commands to boot the OSes installed in /dev/sda1 and /dev/sda2:

Quote:
title Microsoft Windows 2000 Professional
root (hd0,0)
savedefault
makeactive
chainloader +1

title Debian GNU/Linux, kernel 2.6.18-3-686
root (hd0,1)
kernel /boot/vmlinuz-2.6.18-3-686 root=/dev/sda2 ro
initrd /boot/initrd.img-2.6.18-3-686
savedefault
Quite strange that in device.map hd0 is /dev/hda while in boot time hd0 becomes /dev/sda. Should I edit device.map accordingly?

Anyway, the new OS I wanted to boot is MS-DOS 6.22. In the grub world, it lives in hd1. DOS' boot code gets installed on hda's MBR, so this is the grub stuff to boot it:

Quote:
title MS-DOS 6.22
root (hd1)
chainloader +1
Pointing grub to hd1,0 gave me error and I can figure why it did so, but I don't understand why grub doesn't honour his own device.map. Finally, 'savedefault' and 'makeactive' resulted in error n. 12. Without them, DOS boots OK.

Anyway, thank you all for the tips. You are so nicely helpful people

PS: I'm no particularly anti-MS and I love Windows 2000 (which IMO is an OK desktop OS), but I'll NEVER install Vista here. They really screw it up with it.

Last edited by pxumsgdxpcvjm; 01-27-2007 at 05:30 AM.
 
Old 01-27-2007, 05:48 AM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Here is my "speculation" of what happened.

The device.map can be accurate if

(1) you have since changed the disk order either knowingly or unknowingly. The plugging and unplugging of hard disks can cause the Bios to alter the disk order too.

(2) Initially your hda did not have a bootable system and the Bios proceeded to boot the OSs in the second disk sda.

The way Dos boots from "root (hd1)" means you use Grub to boot up the MBR of hd1 and it is this MBR that boots up Dos and not GRub. This is totally acceptable, say the MS's MBR has been installed in hda and it boots whatever primary partition in hda with the booting flag switched on. If Grub doesn't boot by "root (hd1,0)" then perhaps your Dos is in a partition other than 1st partition 0. This is quite possible as I could not image when you installed Win2k and Suse booting from sda your hda was a raw disk at that time without any partition inside but occupying the first bootable disk status.

The makeactive command cannot be applied to the whole disk hd1. I am not entirely sure if savedefault can be accepted for such a booting choice either.

You can show us the output of "fdisk -l" if you want a deeper investigation.

Last edited by saikee; 01-27-2007 at 05:49 AM.
 
Old 01-29-2007, 02:54 PM   #9
pxumsgdxpcvjm
Member
 
Registered: Aug 2005
Posts: 235

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by saikee
If Grub doesn't boot by "root (hd1,0)" then perhaps your Dos is in a partition other than 1st partition 0.
Yep. That was it. I had problems booting my brand new (LOL) DOS because it is not installed on hda1 but on hda3. This comes from dmesg:
Code:
hda: 234441648 sectors (120034 MB) w/2048KiB Cache, CHS=16383/255/63, UDMA(100)
hda: cache flushes supported
hda: hda1 < hda5 hda6 hda7 > hda3
and this is the fdisk -l output for hda:
Code:
Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/hda1              14       14593   117113850    f  W95 Ext'd (LBA)
/dev/hda3   *           1          13      104391    b  W95 FAT32
/dev/hda5              14        5235    41945683+   7  HPFS/NTFS
/dev/hda6            5236       10457    41945683+   7  HPFS/NTFS
/dev/hda7           10458       14593    33222388+   7  HPFS/NTFS
So DOS is installed on hda3, which is the active partition on the disk, and hda1 is an extended partition containing some logical partitions. Quite fun, but this explains my DOS boot drama.

Quote:
Originally Posted by saikee
(1) you have since changed the disk order either knowingly or unknowingly. The plugging and unplugging of hard disks can cause the Bios to alter the disk order too.
I didn't do this. I'm sure that Grub doesn't work as it should. Maybe it is Debian who is in fault. I don't know.

I say this because of this is an almost vanilla Debian. And I remember that when I first rebooted after installing it (just basic system, I apt-getted later for X and KDE), the Debian installer wrote 'root=/dev/hda2' instead of 'root=/dev/sda2' in the Linux entry and 'root(hd1,0)' instead of 'root(hd0,0)' for the Windows 2000 entry. The same happens if I now do a 'grub-install'. I knew how to edit the boot commands and also knew where I installed Debian and Windows, so that saved my butt and made it no problem at all. I guess that this can be fixed by editing device.map properly, but it is Grub (or Debian) who fools itself.

Am I the only one to experience this?

Regards!

Last edited by pxumsgdxpcvjm; 01-29-2007 at 02:56 PM.
 
Old 01-29-2007, 05:14 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,834

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Grub is rarely (never ???) at fault in these things.
Poorply designed and/or implemented (distro) installer. Anaconda is another that doesn't handle multiple OS's on different disks very well.
I prefer to do my own grub builds.
 
Old 01-29-2007, 05:58 PM   #11
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
From my experience if a distro has bugs the installer possibly has the most of it.

Grub seldom gets wrong unless you boot it with an older Grub, say 0.91 on a newer Linux that has been packaged with Grub 0.97.
 
  


Reply

Tags
boot, boot parameters, 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
Unable To Boot To Fedora When Grub Installed in /boot Partition FedoraNewbie Linux - Newbie 4 09-26-2006 04:46 AM
GRUB: How to boot WinXP (NTLDR, NTDETECT.COM & BOOT.INI) from boot partition (EXT2) ? Rayen16 Linux - Software 1 05-25-2006 01:09 PM
Grub/Dual boot - Windows partition restored via dd won't boot pazzport Ubuntu 1 01-06-2006 02:29 PM
Telling Linux what to use as its swap partition timelord726 Fedora 26 01-01-2005 11:19 PM
GRUB using /boot partition for multiple Linux/Windows boot? cpv204 Linux - Newbie 7 04-01-2003 04:54 PM


All times are GMT -5. The time now is 04:35 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration