LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-17-2008, 08:56 AM   #1
mclinkor
Member
 
Registered: Nov 2005
Posts: 63

Rep: Reputation: 15
df and fdisk conflict and grub therefore won't boot or run setup


So, I rebooted my Gentoo server (a PIII with 2 IDE HDDs) a couple of days ago only to find that the computer wouldn't boot. Instead, grub would get go to mounting stage 1 and then initially threw an error of the like "Error 6: Mismatched or corrupt version of stage1/stage2". I've been playing around with it and now it simply hangs on mounting stage 1.

Googling around made me suspect that the problem was caused by the fact that my root/boot/swap drive is the slave drive. Consequently, I also tried switching the master/slave config on the HDDs (wasn't a problem before, but maybe an update in grub made it an issue (seems like a long shot, but that's the best I could come up with)).

Anyway, I put in the livecd with the intention of simply reinstalling my grub.conf to the MBR. I did the standard mount my drives, chroot into my installation, and run grub. I tried:

root (hd0,0)
setup (hd0)

[now that I had my boot drive as the master (ie /dev/hda)]

Anyway, the root command works fine, but the setup command gives the Error 6 command again.

I then also attempted (after exiting the grub shell):
grub-install /dev/hda
and it tells me something like: Device /dev/sdb3 does not exist

I then ran df, mount, fdisk -l, and ls /dev. Results are as follows:
df: screwed up: a collection of sdx's and hdx's
mount: same as df
fdisk -l: as it should be: ie hda1, hda2, hda3, hda4, hdb1 exist (boot, swap, root, data1, data2 respectively)
ls /dev: same as fdisk

Another point of interest is that my drives used to be recognized as sdx's and now they seem to be recognized as hdx's (or maybe I'm just going crazy).

Also, I checked fstab and it had the sdx's (from the old config), so I tried modding that file to make it what it should be as well.

So, in summary, there are two problems:
-screwy mapping of my drives
-grub won't boot or setup the MBR

I'm assuming these problems are related since I didn't have either of them before (and to my knowledge all I've done is run standard periodic updates and reboot, so configuration shouldn't have changed since it was working last). But, I suppose they don't have to be related.

Anyone have any ideas what's going on?
 
Old 10-17-2008, 09:06 AM   #2
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Did you run the grub-install command while you were still chrooted in your Gentoo partition? Another way to use that grub-install command to accomplish the same thing is to mount your Gentoo partition on say /mnt, and then do:
Code:
sudo grub-install --root-directory=/mnt /dev/hda --recheck
Where "hda" should be the drive where you want to install Grub to the MBR, and Grub will then point to whichever partition that was mounted on /mnt for its boot files. Let me know how that goes.

Last edited by CJS; 10-17-2008 at 09:08 AM.
 
Old 10-17-2008, 09:06 AM   #3
mclinkor
Member
 
Registered: Nov 2005
Posts: 63

Original Poster
Rep: Reputation: 15
I should add one thing"

my /boot/grub/devices.table (I think that's the file (I don't have access to my server at this moment and obv can't ssh in)) is the following:

(fd0) \dev\fd0
(hd0) \dev\hda
(hd1) \dev\hdb

Which I believe also to be correct.
 
Old 10-17-2008, 09:09 AM   #4
mclinkor
Member
 
Registered: Nov 2005
Posts: 63

Original Poster
Rep: Reputation: 15
Yeah, I did the grub-install while chrooted

I will check the grub-install with your parameters and the fdisk -lu when I get back to my room.

Although, I must say, I haven't had success in the past (ie the last 36 hours) in general with the --recheck since it generally gives me "grub not found on block device" or something similar...nonetheless I'll check again when I get back and post my results.

Thanks
 
Old 10-17-2008, 09:19 AM   #5
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
I forgot to mention that probably the reason why the grub-install failed while you were chrooted is if you didn't mount /dev to the partition you chrooted into (you may also need to mount /proc, it doesn't hurt for completeness). In other words, if you have Gentoo mounted on say /mnt, you would need to do:
Code:
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
Prior to chrooting into /mnt. That's why you could get the error you got, namely "Device /dev/sdb3 does not exist", because /dev was not mounted. But since the grub-install command has the --root-directory option, there shouldn't be any need to set up a chroot environment and run grub-install from there; it's of course up to you though.
 
Old 10-17-2008, 09:50 AM   #6
mclinkor
Member
 
Registered: Nov 2005
Posts: 63

Original Poster
Rep: Reputation: 15
I've been doing:

# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev

before chrooting in each time

I can try the different options that you suggested if you think that will make a difference (I've been using the above simply because that's what the Gentoo Install Guide suggested)
 
Old 10-17-2008, 09:58 AM   #7
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Hmmm... I'm a little suprised then why grub-install failed if you had those mounted before chrooting. If you want to try using that method again, then for completeness I would first mount all system related directories and see if that makes any difference:
Code:
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /tmp /mnt/tmp
I should mention that it may seem like mounting /tmp is superfluous, but actually it is critical whenever you try to run a GUI app from a chroot environment, so it couldn't hurt to mount it even if grub-install may not need it.

Also, when you chroot, I would run fdisk -l again to make sure you are using the correct hda vs sda drive notation, since you mentioned that seemed to be ambiguous before.

Last edited by CJS; 10-17-2008 at 10:02 AM.
 
Old 10-17-2008, 03:16 PM   #8
mclinkor
Member
 
Registered: Nov 2005
Posts: 63

Original Poster
Rep: Reputation: 15
ok, so I found what was causing the problem.

I went to /dev/mtab and found that there were a bunch of incorrect mounts there (ie with the sdx's). I deleted those and was able to get:
grub-install to run
going into grub shell and then running root and setup still gives the below error 6 though, so I'm not sure what's up with that.

Anyway, I now get back to the point where I get grub to run properly. However, some sort of error happens during the booting process. Unfortunately, I cannot read what the problem is since there is something wrong with the video output during the first section of the boot process (this was a problem before too, but wasn't a problem since the video issue resolved itself halfway through the boot process (presumably when it loaded a driver for the vid card)).

Anyway, if you have any thoughts, let me know. Otherwise, I guess this thread is closed based on the topic of the thread and I'll open up a new one once I get a better idea of what's going on.

It may be related to the error 6 problem, but I will need to find a way to read the text on the screen to be sure.
 
Old 10-17-2008, 03:26 PM   #9
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Definitely getting the Grub error 6 is not a good sign, and could very well be related to your current booting problem like you mention. How about completely purging the grub package, reinstall it, run the grub-install command again (that should rewrite the stage1/stage2 files to the grub directory with the new package files), and then run the "root" and "setup" commands just to see if they can complete without error. I've seen strange Grub problems like yours that can sometimes be solved by following those steps, and I think it would be worth trying in case that has anything at all to do with your current boot problem.
 
Old 10-17-2008, 03:47 PM   #10
mclinkor
Member
 
Registered: Nov 2005
Posts: 63

Original Poster
Rep: Reputation: 15
aha, so this is interesting...

The error I was getting was that it wasn't a valid root device (ie /dev/hda3) For the heck of it, I tried /dev/sda3 and ta-da (ie when booting). So it seems that the LiveCD requires hdx and the computer sees sdx. So, now that I'm unsure of what's going on or how to fix it, I at least know what the problem is.

btw, it failed when checking the root filesystem since it obviously cannot open the hdxs (as all my files reference)

(btw, I fixed the old error by adding /dev/hda3 to my mtab and no more error 6).

If you have any ideas, let me know; otherwise, I'll just start googling around with this.
 
Old 10-17-2008, 03:54 PM   #11
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
It sounds like what you are looking for is how Grub maps its drives in the device.map file in the Grub directory. If you have any references to /dev/sdX or /dev/hdX in your grub.conf file, then on start up Grub will look inside the device.map file to figure out which (hdX) corresponds to /dev/hdX or /dev/sdX. So if the computer worked with sdX, I'm guessing if you look in your device.map file you will see that all the drives are sdX and not hdX.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lilo and Grub conflict, installed Slackware but cant run the Helix Live CD mongoosecage Slackware 2 06-25-2008 09:22 PM
Optimum partition sizes (fdisk?) for multiple boot setup digital8doug SUSE / openSUSE 8 08-30-2006 01:33 AM
Setup Dual boot with no grub but.... Hunter69 Fedora - Installation 1 03-03-2005 12:58 AM
Grub setup problem (/boot/grub/stage1 not found) davidas Debian 2 04-28-2004 08:13 PM
grub setup to dual boot XP and RH9 eraaen Linux - Newbie 3 02-27-2004 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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