Click to See Complete Forum and Search --> : Weird Grub Error


raid517
02-19-2004, 05:43 AM
Hi I am trying to imstall Grub - as lilo appears to have had some problems with the latest versions of kernel 2.6.

Overall this should be fairly easy to do, however it isn't working out that way.

Every time I try to install Grub on my MBR (or anywhere else for that matter, I get a weird error message saying:


grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found

grub>


What does this mean and how do I fix it?

I've installed grub lots of times before and haven't ever come accroos this.

GJ

Hayl
02-19-2004, 08:04 AM
it means that it can't find the stage files.

what distro are you using?

raid517
02-19-2004, 09:23 AM
I'm using Mepis - which is a mix of debian stable and debian experimental (or not so experimental to most other non Debian users).

In any case I had a look and I found the stage files it was looking for at /usr/lib/grub/i386-pc. Although why the deb installer didn't point grub there is a mystery. In any case I moved them to where grub said it was looking for them and it seemed to install sucessfully.

Or so I thought.

My current boot arangement is that I have two harddisks. The first is divided up into three partitions, hda1 Windows XP, hda2 1024MB Linux Swap, hda3 Linux EXT3. The second disk is simply a large NTFS storage partition - so we can pretty much discount that.

Well anyway at the grub promt, once grub had installed sucessfully I did as I often have done in gentoo and told grub to install itself on my mbr.

To be exact what I actually did was:

grub> root (hd0,2)

grub> setup (hd0)

grub> exit.

Then I wrote my grub.conf file as follows:

default 0
# How many seconds to wait before the default listing is booted.
timeout 30
# Nice, fat splash-image to spice things up :)
splashimage=(hd0,0)/grub/debian.xpm.gz

title=Linux 2.6.3

# Partition where the kernel image (or operating system) is located
root (hd0,2)
kernel (hd0,2)/vmlinuz-2.6.3-rc4 root=/dev/hda3

title=Windows XP
root (hd0,1)
chainloader +1

My /boot partition is located on hda3 - and this contains all of my kernel images, system map etc.

The problem is that even after doing this, when I reboot, all I get is the grub promt again - that is the part where you enter the root partition and the location of the kernel image.

I have thought about this long and hard and I'm sorry to say that I'm stumped. I really can't see where I have gone wrong.

Is there any chance that you, or anyone here might be able to tell me what if anything I have missed?

Kind regards,

GJ

mdwatts
02-19-2004, 12:53 PM
Originally posted by raid517

Is there any chance that you, or anyone here might be able to tell me what if anything I have missed?


Looks fine. Do you require a initrd to preload modules on boot?

raid517
02-19-2004, 02:54 PM
Yeah - I thought I got it right too - I mean grub is hardly rocket science. But it is still a tad weird that it won't boot.

I don't know if I 'need' an initrd. But I do know I want one.

The problem with Debian is that it has it's own way of compiling kernels - which I'm not very familiar with. The bottom line is that when it's finished it creats a .deb file of the completed kernel image which you then double click on to install. Personally I still prefer the Gentoo way (although Gentoo does have a nice tool called genkernel that takes the pain out of kernel compilation - which would be nice if it were ported to other distros) although I'm not sure if it is possible to do kenel compiles like this in debian.

During this install process Debian makes and installs its own initrd. The problem is that creating an initrd this way is only possible via source downloaded from official Debian mirrors - so if like me you like to play with new source now and then - you can't use this method to make an initrd.

So I am not at all sure if there is another way to make an initrd, or if using another method would work.

Moreover I'm not sure if this has anything to do with why grub won't boot my selected kernel images.

I read somewhere that I should run update-grub after I install it - and I have just done this - and this gave me the following output:

update-grub
Searching for GRUB installation directory ... found: /boot/grub .
Testing for an existing GRUB menu.list file...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) y
Found kernel: /boot/vmlinuz-2.6.3-rc4
Found kernel: /boot/vmlinuz-2.6.2-1-k7
Found kernel: /boot/vmlinuz-2.4.22
Updating /boot/grub/menu.lst ... done

Obviously this did something and I looked at the file it said it made and it spotted all of my (well only three really) kernel images but what the purpose of this file is - or if or how it relates to why grub wouldn't boot originally is still a bit of a mystery to me.

Having tried about 6 times now and having reverted back to lilo (which also refuses to boot my 2.6x kernel because it says that the version of llibdevmapper installed with it is incompatabile with the kernel version I am using) I'm not too keen on messing about any more until I get a clearer idea of what's going on, or how to resolve the difficulties I am experiencing..

Any input anybody can offer would therefore be much appreciated.

GJ

Hayl
02-19-2004, 03:00 PM
- you don't have to compile using the debian method
- you don't need an initrd unless you are making a driver you need to access your root with partition a module, which is silly. i have never used and initrd.

just do:

make dep && make clean bzImage modules modules_install

then copy the bzImage over to /boot alond with the System.map (renamed with the kernel version at the end)

then edit grub or lilo config, rerun lilo if that is what you are suing

reboot

PS: genkernel sux, it makes the same kernel for everyone regardless of the hardware you have or don't have - totaly non-customized. it is evil and whoever made it should be shot immediately.

raid517
02-19-2004, 03:18 PM
Lol... That's just purists speak - from gentoo folks who believe everything should be done by hand. Its actually not bad if you do genkernel --config which takes you to menuconfig and you can deselect anything you don't want. All it then does is completely automate the remainder of the process for you. In the end it comes down to whether you prefer adding things or taking things away. Splitting hairs really.

Now all I have to do is figure out why Grub is giving me such a hard time.

GJ

mdwatts
02-19-2004, 03:20 PM
Usually you only require a initrd (initial ramdisk) if the boot/root partition filesystem support (ext3, ReiserFS etc.) is build as a module and not build right into the kernel.

raid517
02-19-2004, 03:24 PM
I wonder if you guys have got any thoughts on Grub though?

As I said, you wouldn't think it would be so hard to figure out.... There's not that much to it...

GJ

mdwatts
02-19-2004, 03:37 PM
So Grub will only boot the 2.4 kernels and not the 2.6?

Have we established what distro/version and Grub version you are using?

Oh I see Debian. Is everything up to date?

Hayl
02-19-2004, 03:51 PM
Originally posted by raid517
Lol... That's just purists speak - from gentoo folks who believe everything should be done by hand. Its actually not bad if you do genkernel --config which takes you to menuconfig and you can deselect anything you don't want. All it then does is completely automate the remainder of the process for you. In the end it comes down to whether you prefer adding things or taking things away. Splitting hairs really.

no, seriously, it is evil ---- ever seen The Exorcist ? :) JK

raid517
02-19-2004, 04:26 PM
Originally posted by mdwatts
So Grub will only boot the 2.4 kernels and not the 2.6?

Have we established what distro/version and Grub version you are using?

Oh I see Debian. Is everything up to date?

No, grub won't boot anything. After doing update-grub and rebooting I get taken to a menu that contains all of my kernel images.

However it isn't using the splash image I pointed grub.conf to. It's just a basic looking boot selection list.

Moreover no matter where I tell grub to install to (hd0,0) my MBR (hd0,2) my / partition, or whatever, when I hit enter at the boot prompt, I get an error message about bit being unable to mount the disk and that it cannot recognise the file system. (Which is ext3). It also says (again despite whatever choices I make) that the root of the disk is hd0,0. Basically no matter what I do I cannot change this.

I only have one guess as to the causes of , and that is that grub is not using the grub.conf file I created in /boot/grub in order to determin the correct partition selection. Instead it appears to be using the menu.list file generated by update-grub.

Since this list looks as follows:

## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.3-rc4
root (hd0,0)
kernel /boot/vmlinuz-2.6.3-rc4 root=/dev/hda3 ro
savedefault
boot

title Debian GNU/Linux, kernel 2.6.3-rc4 (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.3-rc4 root=/dev/hda3 ro single
savedefault
boot

title Debian GNU/Linux, kernel 2.6.2-1-k7
root (hd0,0)
kernel /boot/vmlinuz-2.6.2-1-k7 root=/dev/hda3 ro
initrd /boot/initrd.img-2.6.2-1-k7
savedefault
boot

title Debian GNU/Linux, kernel 2.6.2-1-k7 (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.2-1-k7 root=/dev/hda3 ro single
initrd /boot/initrd.img-2.6.2-1-k7
savedefault
boot

title Debian GNU/Linux, kernel 2.4.22
root (hd0,0)
kernel /boot/vmlinuz-2.4.22 root=/dev/hda3 ro
savedefault
boot

title Debian GNU/Linux, kernel 2.4.22 (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.4.22 root=/dev/hda3 ro single
savedefault
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

Then I have to assume that this is what is always causing grub to always point to (hd0,0) as my root partition. Which means whatever this file is, update-grub misinterprited my partition table and automatically set hd0,0 as my root partition.

Hmm... I just thought of that... Let me just edit this menu.list file and change my root partition to 0,2 and see what happens.

I'll let you know shortly.

GJ

mdwatts
02-19-2004, 04:29 PM
I thought you had

root (hd0,2)

in the previous Grub config you posted. :confused:

knute
02-19-2004, 04:41 PM
The 2.6 kernel initrd images in debian are larger than 4096 (default) so you need to include the ramdisk option in your boot parameters.
Not sure the exact size of the 2.6.3, but I'd guess that it's not over 5000.

This is what the message that it can't mount the fs means. If you look in the output right before it fails, there should be something about the ramdisk and the size <somenumber>/4096.

This <somenumber> is the size of the initrd, and can be put into your boot parameters as ramdisk= if you are worried about system resources.

HTH

raid517
02-19-2004, 04:48 PM
Yeah I did, but for some reason grub is refusing to use grub.conf for partition selection. Instead it insists on using this file called menu.list that was generated by update-grub. I guess update-grub must be some sort of grub auto configuration tool. From what I can see it appears to try to probe your partition table and write an appropriate menu.list file based on what it finds. Unfortunately it appears to have misidentified my /root partition - instead choosing the most unlikely partition of all which was my Windows XP hda - so it's no wonder it couldn't mount the partition when looking for a linux kernel image.

But having said that, I still think it's odd, because in the two years I have been messing about with linux, I have never come accross this menu.list before.

Maybe some of you guys have heard of it?

GJ

raid517
02-19-2004, 04:52 PM
Originally posted by knute
The 2.6 kernel initrd images in debian are larger than 4096 (default) so you need to include the ramdisk option in your boot parameters.
Not sure the exact size of the 2.6.3, but I'd guess that it's not over 5000.

This is what the message that it can't mount the fs means. If you look in the output right before it fails, there should be something about the ramdisk and the size <somenumber>/4096.

This <somenumber> is the size of the initrd, and can be put into your boot parameters as ramdisk= if you are worried about system resources.

HTH

That kind of rings a bell. So I do need an initrd? How do I do that? I mean I know some of you guys say it isn't needed, but I'm sure it can't hurt.

GJ

knute
02-19-2004, 04:59 PM
As far as I knew, the menu.lst file was always the main one, and that some distros used grub.conf, and had a symlink in there or something.

As for the initrd image, it's already included if you used a deb to set up your kernel.

change this:
title Debian GNU/Linux, kernel 2.6.3-rc4
root (hd0,0)
kernel /boot/vmlinuz-2.6.3-rc4 root=/dev/hda3 ro
savedefault
boot
to this:
title Debian GNU/Linux, kernel 2.6.3-rc4
root (hd0,0)
kernel /boot/vmlinuz-2.6.3-rc4 ramdisk=5000 initrd=/initrd.img root=/dev/hda3 ro
savedefault
boot

Dang it! I'm at work atm, and can't remember the exact way that I have it listed in my /boot/grub/menu.lst file.

I know that the ramdisk= line should help, but I'm not sure about the initrd part.

I'll be home in about 4 hours, so I'll check it out, and make any corrections necessary if I'm wrong. :)

HTH

raid517
02-19-2004, 05:09 PM
Thanks mate.

I managed to fix grub by pointing menu.list to the correct partitions. However when I booted the 2.6 kernel I got exactly that error you mentioned.

Unfortunately I'm not installing from a .deb as they are a little behind the curve on these things - and they don't have 2.6.3 yet.

If you can come up with any firm suggestions on how to overcome this issue, your input would be most welcome.

You guys have been great.

Thanks...

GJ

knute
02-19-2004, 05:12 PM
Since you got the exact error, did you add the ramdisk option to your boot option parameters?

The ramdisk option increases the size of the ramdisk, so that there is enough room for the initrd to load.

raid517
02-19-2004, 05:50 PM
Yes I did mate I wrote it exactly as you suggested. (Although to me - perhaps mistakingly that instruction looks like is pointing grub to an initrd which I haven't made yet and don't know how to). After doing so and booting this is what happend:

VFS Cannot open root device hda3 or unknown-block (0,0) Please append correct "root=" boot option.
Kernel panic: VFS unable to mount root fs on unknown-block(0,0).

Now to my eyes that looks like its saying it is still trying to mount /(hd0,0) which is my Windows XP partition. The question is why?

I guess maybe if I repost my menu.list maybe you guys might be able to spot something?

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 5

# Pretty colours
color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
##
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default optons below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specifiv kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
# kopt=root=/dev/hda3 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery mode) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.3-rc4
root (hd0,2)
kernel /boot/vmlinuz-2.6.3-rc4 root=/dev/hda3 ro
savedefault
boot

title Debian GNU/Linux, kernel 2.6.3-rc4
root (hd0,0)
kernel /boot/vmlinuz-2.6.3-rc4 ramdisk=5000 initrd=/initrd.img root=/dev/hda3 ro
savedefault
boot

title Debian GNU/Linux, kernel 2.6.2-1-k7
root (hd0,2)
kernel /boot/vmlinuz-2.6.2-1-k7 root=/dev/hda3 ro
initrd /boot/initrd.img-2.6.2-1-k7
savedefault
boot

title Debian GNU/Linux, kernel 2.6.2-1-k7 (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.2-1-k7 root=/dev/hda3 ro single
initrd /boot/initrd.img-2.6.2-1-k7
savedefault
boot

title Debian GNU/Linux, kernel 2.4.22
root (hd0,2)
kernel /boot/vmlinuz-2.4.22 root=/dev/hda3 ro
savedefault
boot

title Debian GNU/Linux, kernel 2.4.22 (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.4.22 root=/dev/hda3 ro single
savedefault
boot

title Windows XP
root (hd0,0)
savedefault
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

What exactly is this error saying - and if it is trying to mount an NTFS partition - what file is it that is telling it to do this?

GJ

mdwatts
02-19-2004, 05:54 PM
Each operating system in /boot/grub/menu.lst should look something like this

title SuSE 9.0 (Production)
kernel (hd1,4)/boot/vmlinuz-2.4.21-166-smp4G root=/dev/ataraid/d0p5 acpismp=force apm=power_off idebus=66 ide0=autotune
initrd (hd1,4)/boot/initrd-2.4.21-166-smp4G

You need (hd#,#) on the initrd line.

knute
02-19-2004, 06:04 PM
Actually, you have 2 images with the same title, and are looking on different roots (hd0,2) and (hd0,0) respectively.

The second one with the ramdisk options in it is looking on (hd0,0). :rolleyes:
If you change it to (hd0,2) you should be good to go. :D

raid517
02-19-2004, 07:15 PM
Well spotted - and a valient effort - unfortunately though I am still getting the same error.

I have simplified my menu.lst file so that it now looks like this:


title Debian GNU/Linux, kernel 2.6.3-rc4
root (hd0,2)
kernel /boot/vmlinuz-2.6.3-rc4 ramdisk=5000 initrd=/initrd.img root=/dev/hda3 ro
savedefault
boot

title Debian GNU/Linux, kernel 2.6.2-1-k7
root (hd0,2)
kernel /boot/vmlinuz-2.6.2-1-k7 root=/dev/hda3 ro
initrd /boot/initrd.img-2.6.2-1-k7
savedefault
boot

title Debian GNU/Linux, kernel 2.6.2-1-k7 (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.2-1-k7 root=/dev/hda3 ro single
initrd /boot/initrd.img-2.6.2-1-k7
savedefault
boot

title Debian GNU/Linux, kernel 2.4.22
root (hd0,2)
kernel /boot/vmlinuz-2.4.22 root=/dev/hda3 ro
savedefault
boot

title Debian GNU/Linux, kernel 2.4.22 (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.4.22 root=/dev/hda3 ro single
savedefault
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

As you can see, there is no reference whatsoever anymore to partition 0,0 - so it really is a major puzzle what this error is and what is causing it.

GJ

knute
02-19-2004, 11:10 PM
I want to start by apologizing to you. It was my bad that this is happening because I didn't remember how initrd had to go into the menu.lst. I think that's what's causing it.

Here's a copy of the pertinent part of my /boot/grub/menu.lst:
# For booting GNU/Linux
title Debian-2.6.1-k7
root (hd0,0)
kernel /vmlinuz root=/dev/hda1 mem=128M ramdisk=4168 vga=9
initrd /initrd.img.old


# For booting GNU/Linux
title Debian-2.6.2-1-k7
root (hd0,0)
kernel /vmlinuz root=/dev/hda1 mem=128M ramdisk=4168 vga=9
initrd /initrd.img


Yeah. the initrd line is on one by itself. And it's basically just modified minimally from the /usr/share/doc/grub/examples/menu.lst file.

Again, I apologize for misplacing that one option. :(

raid517
02-20-2004, 06:10 AM
Thanks I'll give that a try... But i'm still slightly confused.

In this line:

kernel /boot/vmlinuz-2.6.3-rc4 root=/dev/hda3 mem=128M ramdisk=4168 vga=9

You have the kernel and root entries on the same line.

Is this right?

GJ

raid517
02-20-2004, 06:20 AM
Ohh... this just isn't happening.

Here is the way I have things at the moment:

title Debian GNU/Linux, kernel 2.6.3-rc4
root (hd0,2)
kernel /boot/vmlinuz-2.6.3-rc4 root=/dev/hda1 mem=128M ramdisk=4168 vga=9
initrd /boot/initrd-vmlinuz-2.6.3-rc4.img
savedefault
boot

title Debian GNU/Linux, kernel 2.4.22
root (hd0,2)
kernel /boot/vmlinuz-2.4.22 root=/dev/hda3 ro
savedefault
boot

title Debian GNU/Linux, kernel 2.4.22 (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.4.22 root=/dev/hda3 ro single
savedefault
boot[

### END DEBIAN AUTOMAGIC KERNELS LIST

I'm still getting the error message about :

VFS Cannot open root device hda3 or unknown-block (0,0) Please append correct "root=" boot option.
Kernel panic: VFS unable to mount root fs on unknown-block(0,0).

Why, despite everything we have tried here, is it still trying to mount my 0,0 NTFS partition?

GJ

knute
02-20-2004, 01:03 PM
Root option in my kernel parameters:

The reason that was there was because I kept getting the message that the root device couldn't be found, so when I put the root parameter in, it cleared it up. The root parameter in the kernel line is different than the root parameter for grub. They basically do the same thing, but the difference is who/what they are telling this information to.



Ok, your other issue is that the root option in your kernel parameter is /dev/hda1 or (hd0,0); whereas /dev/hda3 would be (hd0,2).

Also, if you have more than 128Mb of ram, you will want to change the mem line accordingly.
And if your screen comes up with something about scanning or whatnot, it's due to the vga line. I use the console on occasion, so I have linux come up in runlevel 2, then I startx from there (long story, but for me it's just easier).

HTH