Jump to content
Sign in to follow this  
V.T. Eric Layton

An Interesting GRUB Issue

Recommended Posts

Here's a little background for everyone...I am running Slackware as my primary operating system and Arch as my secondary (backup) operating system on my main computer (ericsbane05). I also have installations of MS Windows XP, CentOS, and Debian on a separate hard drive.SATA looks like this on my system:SATA0 channel = /dev/sda, /dev/sdbSATA1 channel = /dev/sdc, /dev/sr1SATA2 channel = vacant, vacantOriginally, these drives were in ericsbane03 and 04 with one exception. I only had two SATA drives and one EIDE drive then. The EIDE drive was removed when building this new system and replaced with the drive /dev/sdc that you see above on the SATA1 channel (/dev/sr1 is a DVD R/W, by the way).Arch Linux's GRUB controls /dev/sda's MBR and is the main bootloader for all operating systems on this system. Here's what my menu.lst looks like:

<snip># IMPORTANT --> Arch GRUB sees /dev/sda as hd0, but /dev/sdb as hd2 (should be hd1).## (1) Slackware64-13.37title  Slackware Primaryroot   (hd0,0)kernel /boot/vmlinuz root=/dev/sda1 roinitrd /boot/initrd.gz## (2) Arch64title  Arch Linux Secondaryroot   (hd0,4)kernel /boot/vmlinuz26 root=/dev/sda5 roinitrd /boot/kernel26.img# (3) MS Windows XP/SP3title MS WIN XP Proroot (hd2,0)map (hd0) (hd2)map (hd2) (hd0)chainloader +1# (4) CentOS64 5.6title	CentOS Tester01root	(hd2,5)kernel	/boot/vmlinuz-2.6.18-238.9.1.el5 root=/dev/sdb6 roinitrd	/boot/initrd-2.6.18-238.9.1.el5.img<snip>

You can see that Arch's GRUB thinks that /dev/sdb is (hd2), when in fact, it should be (hd1). This was like this originally because of the hybrid EIDE/SATA setup that I had on previous systems. Now that I'm running pure SATA, I'd like to get this fixed. Here's what I've done so far:1) I manually edited /boot/grub/device.map to look like this:

(fd0)	/dev/fd0(hd0)	/dev/sda(hd1)	/dev/sdb(hd2)	/dev/sdc

It was originally incorrect, but this didn't fix the issue. GRUB was still seeing the drives incorrectly. I then deleted all files from the /boot/grub directory and used pacman to uninstall GRUB completely. I then reinstalled GRUB and created a new menu.lst with the correct /dev to (hd) conversions. It looks like this now:

<snip># (1) Slackware64-13.37title  Slackware Primaryroot   (hd0,0)kernel /boot/vmlinuz root=/dev/sda1 roinitrd /boot/initrd.gz## (2) Arch64title  Arch Linux Secondaryroot   (hd0,4)kernel /boot/vmlinuz26 root=/dev/sda5 roinitrd /boot/kernel26.img# (3) MS Windows XP/SP3title MS WIN XP Proroot (hd1,0)map (hd0) (hd1)map (hd1) (hd0)chainloader +1# (4) CentOS64 5.6title	CentOS Tester01root	(hd1,5)kernel	/boot/vmlinuz-2.6.18-238.9.1.el5 root=/dev/sdb6 roinitrd	/boot/initrd-2.6.18-238.9.1.el5.img<snip>

The entries for Windows and CentOS reflect the new (and correct) device.map in /boot/grub. After all this, I reinstalled GRUB to the MBR like this:

# grub-install /dev/sda

Unfortunately, GRUB is still seeing /dev/sdb as (hd2). I can get all my operating systems to boot just fine by using the wrong (hd) strings in menu.lst, but I'd really like to get GRUB to work the way it's supposed to. I'm sure there is something simple here that I'm missing. Any help would be appreciated.Thanks,~Eric

Share this post


Link to post
Share on other sites
Here's a little background for everyone...I am running Slackware as my primary operating system and Arch as my secondary (backup) operating system on my main computer (ericsbane05). I also have installations of MS Windows XP, CentOS, and Debian on a separate hard drive.SATA looks like this on my system:SATA0 channel = /dev/sda, /dev/sdb~Eric
Passing by and saw this ... I don't understand how you get two disks on one SATA connector? Not clear what you mean by "channel" maybe. Here, I'd find as 'sda' whatever device is connected to the first socket, and sdb would be the device attached to the 2nd socket, etc. This is respected by a half-dozen different distros. If you are really taking about an ide master & slave, is it legal to call that a "SATA channel"? I have 2 boxes here with mixed ide + sata devices, but so far have seen no issues with grub.Edit: I wonder -- does your mobo (cmos) allow you to specify a drive that has been removed? That might account for a phantom drive that would cause grub to see an (hd2,x) -- that is, a third disk.Edit-2: when linux is running, what does an #fdisk -l show? Edited by burninbush

Share this post


Link to post
Share on other sites

On a mobo (and in the BIOS), SATA is arranged into separate channels. Each channel usually allows two devices. This new mobo has 3 SATA channels on it.I have no EIDE hard drives on this system. All three drives are SATA. Oh, and because of the libATA module built in to the Linux kernel since 2.6.x, the kernel sees ALL hard drives (EIDE or SATA) as SATA.It's not a mobo or BIOS issues. This has occurred on two different mobos with hybrid drive setups and pure SATA (the current) setup. I've only had this issue with Arch, though. When Debian was my secondary (and MBR controlling) operating system, its GRUB did not have this issue.Oh, and here's my fdisk -l output:

Disk /dev/sdb: 250.0 GB, 250000000000 bytes255 heads, 63 sectors/track, 30394 cylinders, total 488281250 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0009e140   Device Boot	  Start		 End	  Blocks   Id  System/dev/sdb1	*	  16384	51216383	25600000	7  HPFS/NTFS/exFAT <-- MS Windows XP C partition/dev/sdb2		51232768   102432767	25600000	7  HPFS/NTFS/exFAT/dev/sdb3	   102453181   488270159   192908489+   5  Extended <-- swap/dev/sdb5	   102453183   106550639	 2048728+  82  Linux swap/dev/sdb6	   106565823   137289599	15361888+  83  Linux <-- CentOS //dev/sdb7	   137304783   188501039	25598128+  83  Linux/dev/sdb8	   188516223   219239999	15361888+  83  Linux <-- Debian //dev/sdb9	   219255183   270451439	25598128+  83  Linux/dev/sdb10	  270466623   301190399	15361888+  83  Linux <-- tester //dev/sdb11	  301205583   352401839	25598128+  83  Linux/dev/sdb12	  352417023   383140799	15361888+  83  Linux <-- tester //dev/sdb13	  383155983   434352239	25598128+  83  Linux/dev/sdb14	  434367423   488270159	26951368+  83  Linux <-- storageDisk /dev/sdc: 250.1 GB, 250059350016 bytes255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0002cd1d   Device Boot	  Start		 End	  Blocks   Id  System/dev/sdc1		   16065   102414374	51199155   83  Linux <-- Slackware backups/dev/sdc2	   102430440   204828749	51199155   83  Linux <-- Arch backups/dev/sdc3	   204844815   488392064   141773625	5  Extended/dev/sdc5	   204860880   307259189	51199155	b  W95 FAT32 <-- MS Windows backups/dev/sdc6	   307275318   409673564	51199123+  83  Linux <-- tester backups/dev/sdc7	   409689693   488392064	39351186	b  W95 FAT32 <-- common storageDisk /dev/sda: 250.1 GB, 250058268160 bytes255 heads, 63 sectors/track, 30401 cylinders, total 488395055 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x24812481   Device Boot	  Start		 End	  Blocks   Id  System/dev/sda1   *	   16065	51215219	25599577+  83  Linux <-- Slackware primary operating system //dev/sda2		51247350   153645659	51199155   83  Linux/dev/sda3	   153661725   488392064   167365170	5  Extended/dev/sda5	   153661788   204860879	25599546   83  Linux <-- Arch secondary operating system //dev/sda6	   204877008   307275254	51199123+  83  Linux/dev/sda7	   307307448   311403959	 2048256   82  Linux swap <-- swap/dev/sda8	   311420088   488392064	88485988+  83  Linux <-- archives

Share this post


Link to post
Share on other sites

Yours,

# (3) MS Windows XP/SP3title MS WIN XP Proroot (hd2,0)map (hd0) (hd2)map (hd2) (hd0)chainloader +1

From the Arch wiki,

If Windows is located on another hard disk, the map command must be used. This will make your Windows install think it is actually on the first drive. Assuming that your Windows partition is on the first partition of the second drive:title Windowsmap (hd0) (hd1)map (hd1) (hd0)rootnoverify (hd1,0)makeactive #if you use Windows7 this line should be commented outchainloader +1
Don't know if that is relevant. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...