Click to See Complete Forum and Search --> : Configuring Grub


raid517
06-09-2003, 07:52 PM
Hi, I have just pretty much finished installing Gentoo Linux. After countless hours of compiling I'm almost there.
However now has come the time when I must configure grub. The only problem is the instructions given are somewhat confusing to a relative Linux n00b.

For quick reference my partition table/fstab is as follows (II'd appreciate it if someone could tell me if this looked correct for fstab too)

/dev/hda1 /mnt/hda1 NTFS 0 0
/dev/hdb2 /boot ext3 noauto,noatime 1 1
/dev/hdb1 / ReiserFS noatime 0 0
/dev/hdb3 swap sw 0 0
/dev/hdb5 /mnt/hdb5 ext2 noatime 0 0
/dev/hdb6 /mnt/hdb6 NTFS 0 0
/dev/fd0 /mnt/floppy vfat 0 0
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
dev/sda /mnt/sda NTFS 0 0
proc /proc proc defaults 0 0

I have been told in Grub speak, since the naming convention is slightly different that this means:

hda1 (hd0,0)
hdb1 (hd1,0)
hdb2 (hd1,1)
hdb3 (hd1,2)
hdb5 (hd1,4)
hdb6 (hd1,5)

So when I run Grub and try to get it to write to my MBR I which I expect is hda1 (or in grub (hd0,0) since that is the partition that holds Windows XP which provides my current MBR, I get:

grub> root (hd1,0)
Filesystem type is reiserfs, partition type 0x83

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

Error 15: File not found

So I haven't the slightest clue what's going on here. If its relevant I'm installing Gentoo from within the Knoppix Live CD. So 'm not sure if my WinXP NTFS hdd (the one I usually boot from) is actually mounted where Gentoo can see it. (In this case it should be, or so I assume, /mnt/gentoo/hmnt/hda1 or from gentoo's perspective /mnt/hda1 (Gentoo's chroot prompt doesn't know its being run from within another OS).

I figured that maybe if I could unmount hda1 from knoppix mnt/ hda1 I might be able to mount it in the correct gentoo directory, ie gentoo /mnt/hda1.
But when I ran the umount commands I got :

umount /dev/hda1 -f
umount2: Device or resource busy
umount: /dev/hda1: not mounted
umount: /mnt/hda1: Illegal seek

(I insterted the -f command top try to force the system to dump the disk after several normal attempts where I kept getting the "device busy message").

So the bottom line is I'm stuck. I've come through every bit of the Gentoo install (and if you know Gentoo you'll know that isn't easy) and have hit a bit of a brick wall. Until I fix this I cant progress.

At the end of the day I don't care what boot loader I use, so long as it works.

So if someone can come up with a lilo.conf file based on the above table this would be a significant help.

All advice is welcome.

Regards,

Q

RabidPenguin
06-09-2003, 08:00 PM
Have you tried /sbin/grub-install /dev/hda ?

marcogor
06-09-2003, 08:04 PM
Try the command setup (hd1,1) from within the grub program.

GRUB looks for stage 1 stage 1.5 and stage 2 which are in the /boot partition.

raid517
06-09-2003, 09:11 PM
Well ok, I opted to go with Lilo instead, as I'm a little (not much though) more familiar with it.

This is what I did with my lilo.conf file... (Note my fstab/partition layout above).

# $Header: /home/cvsroot/gentoo-x86/sys-apps/lilo/files/lilo.conf,v 1.3 2002/09/30 00:55:18 woodchip Exp $
# Author: Ultanium
# Start LILO global section
menu-scheme=Wb
boot = /dev/hdb2
prompt
#boot=/devices/discs/disc0/disc
map = /boot/System.map
#compact # faster, but won't work on all systems.
lba32
#if lba32 do not work, use linear
#linear
#if you always want to see the prompt with a 15 second timeout:
#timeout=150
delay = 50
vga = normal # Normal VGA console
# End LILO global section
# Linux bootable partition config begins
image = /boot/bzImage
root = /dev/hdb1
#root = /devices/discs/disc0/part3
label = Gentoo
read-only # read-only for checking
# Linux bootable partition config ends
# DOS bootable partition config begins
other = /dev/hda1
#other = /devices/discs/disc0/part1
label = WindowsXP
table = /dev/hda
# DOS bootable partition config ends

Then I ran lilo but the response i got was:

lilo
Warning: /dev/hdb2 is not on the first disk
Fatal: open /boot/bzImage: No such file or directory

So having compiled a kernel earlier, and being pretty damn sure I had built this bzImage file, I did a search for it and found it in /usr/src/linux-2.4.20-gentoo-r5/arch/i386/boot

so I copied this to /boot and ran lilo again and got

lilo
Warning: /dev/hdb2 is not on the first disk
Added Gentoo *
Added WindowsXP

So does this mean that lilo is now installed and its safe to reboot?

And why the warning about /dev/hdb2? This is my 25 GB ReiserFS / partition. I want it to be on the second disk. Will this be a problem?

Also when the install process is complete the docs tell you to:

etc-update

So when I do this I get:

Scanning Configuration files...
The following is the list of files which need updating, each
configuration file is followed by a list of possible replacement files.
1) /etc/crontab
/etc/._cfg0000_crontab
Please select a file to edit by entering the corresponding number.
(-1 to exit) (-3 to auto merge all remaining files)
(-5 to auto-merge AND not use 'mv -i'): .

I'm afraid I have no idea what this is asking me to do. Which option should I select?

Q

copeja
06-09-2003, 09:42 PM
Which hard drive are you booting off of ?
The lilo warning is that it wrote the boot
record to hdb2 which is the second partion on the second drive or primary slave if you are booting from hda it will not work and I doubt it will work if you are booting from hda2.
Your liloconfig has boot=hdb2 if you are booting from hdb it should be boot=hdb
and if you are booting hda boot=hda
try that and see if lilo runs with out errors

raid517
06-09-2003, 10:02 PM
Well my partition table/fstab file looks like this:

/dev/hda1 /mnt/hda1 NTFS 0 0
/dev/hdb2 /boot ext3 noauto,noatime 1 1
/dev/hdb1 / ReiserFS noatime 0 0
/dev/hdb3 swap sw 0 0
/dev/hdb5 /mnt/hdb5 ext2 noatime 0 0
/dev/hdb6 /mnt/hdb6 NTFS 0 0
/dev/fd0 /mnt/floppy vfat 0 0
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
dev/sda /mnt/sda NTFS 0 0
proc /proc proc defaults 0 0

/dev/hda1 is my WinXP pro disk, the one I've been booting off before... (Using XP's native boot loader).

hdb1 is my / ReiserFS partition containing pretty much everything except my kernel

hdb2 is my boot partition.

hdb3 as you can see is my swap

hdb5 is a persistant knoppix back up/rescue partition.

hdb6 is just a big spare back up NTFS Logical partition.

dev/sda Should be for a 120 Gig usb 2.0 NTFS external drive. But I'm not sure if it will work yet.

So what are you saying I should do?

Replace hdb2 (given that previously I only had WinXP booting from hda or from what I can see here in Knoppix (wich I'm using to install gentoo) hda1) with hdb?

Your advice is welcome...

Q

raid517
06-09-2003, 10:33 PM
Umm... Ok I think I got it now, that first line just tells lilo where to install itself right? So this time I chose hda and it went through without any glitches... Is this right? It may sound crazy but i've put so much effort into building this distro (I'm sure you will know that Gentoo is an almost wholly source based distro) that I don't want to reboot until I'm 100% sure i've done everything correctly.

Hopefully i'm getting a bit closer now.

Q

BTW, do you know of a file located anywhere which will automatically tell the system which window manager to use and which GUI, like Gnome, KDE etc...? I'm sure I saw it somewhere. But i can't for the life of me remember where I saw it.

copeja
06-09-2003, 11:47 PM
If you have run lilo -v and you did not get any errors it should boot to lilo on hda and you pick the system you want to load.
The file for the desk top manger in Debian is located at /etc/X11/ and the file is called default-display-manager. You have to set your run level init 5 in Debian to boot to graphical log in.

raid517
06-10-2003, 12:10 AM
Well it didn't work. There must be something screwy about the way my fstab file is done. The Boot process started but ceapped out with the message.

VFS: unable to mount root fs

My fstab file is exactly as follows:

# /etc/fstab: static file system information.
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.10 2002/11/18 19:39:22 azarah Exp $
#
# noatime turns of atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency). It's safe to drop the noatime options if you want and to
# switch between notail and tail freely.

# <fs> <mountpoint> <type> <opts> <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/hda1 /mnt/hda1 NTFS 0 0
/dev/hdb2 /boot ext3 noauto,noatime 1 1
/dev/hdb1 / ReiserFS noatime 0 0
/dev/hdb3 swap sw 0 0
/dev/hdb5 /mnt/hdb5 ext2 noatime 0 0
/dev/hdb6 /mnt/hdb6 NTFS 0 0
/dev/fd0 /mnt/floppy vfat 0 0
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
/dev/sda /mnt/sda NTFS 0 0
proc /proc proc defaults 0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink). Adding the following
# line to /etc/fstab should take care of this:
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will use almost no
# memory if not populated with files)

tmpfs /dev/shm tmpfs defaults

My partition table is as I stated above:

/dev/hda1 /mnt/hda1 NTFS 0 0
/dev/hdb2 /boot ext3 noauto,noatime 1 1 # {My boot partition)
/dev/hdb1 / ReiserFS noatime 0 0 # (My Root partition)
/dev/hdb3 swap sw 0 0 # (My swap partition)
/dev/hdb5 /mnt/hdb5 ext2 noatime 0 0 # (My rescue partition).
/dev/hdb6 /mnt/hdb6 NTFS 0 0 # (a spare storage partition)
/dev/fd0 /mnt/floppy vfat 0 0 # (My floppy disk)
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0 #( CDRom)
dev/sda /mnt/sda NTFS 0 0 (NFTF USB 2.0 HDD)
proc /proc proc defaults 0 0 #(not sure what this is).

Is there something wrong with the way I have constructed my fstab file?

Q

copeja
06-10-2003, 12:50 AM
You need to tell lilo where your boot partition is
image = /boot/bzImage I am not sure if this will work it should read image=/dev/hdb2/bzimage or you could put a link from root partition I have attached a copy of my liloconfig

boot = /dev/sda
change-rules
reset
read-only
menu-scheme = Wg:kw:Wg:Wg
lba32
prompt
timeout = 80
#message= /boot/message
image = /vmlinuz
root = /dev/sda1
label = Debian
initrd=/initrd.img

image = /boot/vmlinuz-2.4.18-686-smp
root = /dev/sda1
label = Debian2.4.18
initrd = /boot/initrd.img-2.4.18-686-smp


image = /boot/vmlinuz-2.4.18-bf2.4
root = /dev/sda1
label = safedeb
optional

image = /boot/vmlinuzsuse8.1
label = SuSE
root = /dev/sdc3
vga = 791
append="acpi=off"
initrd = /boot/initrdsuse8.1
optional


image = /boot/vmlinuz.shipped
label = SuSEsafe
root = /dev/sdc3
vga = 791
append="ide=nodma apm=off acpi=off vga=normal nosmp maxcpus=0 disableapic 3"
initrd = /boot/initrd.shipped
optional



image = /boot/vmlinuz-2.4.19-16mdksmp
root = /dev/sdb1
label = Mandrake
initrd = /boot/initrd-2.4.19-16mdksmp.img
optional


image = /boot/vmlinuz-2.4.18-5smp
root = /dev/sdb2
label = Redhat
initrd = /boot/initrd-2.4.18-5smp.img
optional

other = /dev/hda1
label = windows

image = /boot/memtest.bin
label = memtest86

raid517
06-10-2003, 02:26 AM
So does this look right, knowing everything that I have outlined above. Just some confirmation that I have completed all these steps correctly would be much appreciated.

# $Header: /home/cvsroot/gentoo-x86/sys-apps/lilo/files/lilo.conf,v 1.3 2002/09/30 00:55:18 woodchip Exp $
# Author: Ultanium
# Start LILO global section
menu-scheme=Wb
boot = /dev/hda
prompt
#boot=/devices/discs/disc0/disc
map = /boot/System.map
install=/boot/boot.b
#compact # faster, but won't work on all systems.
lba32
#if lba32 do not work, use linear
#linear
#if you always want to see the prompt with a 15 second timeout:
#timeout=150
delay = 50
vga = normal # Normal VGA console
# End LILO global section
# Linux bootable partition config begins
image = /dev/hdb2/bzimage
root = /dev/hdb1
#root = /devices/discs/disc0/part3
label = Gentoo
read-only # read-only for checking
# Linux bootable partition config ends
# DOS bootable partition config begins
other = /dev/hda1
#other = /devices/discs/disc0/part1
label = WindowsXP
table = /dev/hda
# DOS bootable partition config ends

Its just that if this is right its still crapping out with a message

Kernel panic Unable to mount root fs on 0:3:41

Thaks again for all your advice. :)

Q

copeja
06-10-2003, 03:08 AM
when you did your kernel did you make a vmlinuz and a bzimage if you did you have to show both to lilo
image = /boot/vmlinuz-2.4.18-686-smp this is the kernel
initrd = /boot/initrd.img-2.4.18-686-smp
this is the image of the kernel.
In Debain the kernel is linked from /boot to / and the image statement is image = /vmlinuz they also link the initrd statement from /boot to / the statementis
initrd=/initrd.img
kernel panic is caused by the system booting off the image and not finding the kernel which is in the /boot folder

raid517
06-10-2003, 03:24 AM
Well this is the compile instruction I was given:

make dep && make clean bzImage modules modules_install

Its not the way I usually do it. (That is one step at a time) but it seems to cut out a lot of need for any interviening steps.

The vmlinuz part is new to me, I just followed a step by step guide that I gleaned from talking to other people. The vmlinuz part of the process hasn't come up yet - until you mentioned it that is. :)
However I have found a potential problem I wasn't aware of before. I opted chroot back into my Gentoo install and recheck my file system support options in the kernel. There I found I had compiled several crucial compoments into the kernel as modules, as oposed to compiling them as a part of the kernel. Both ReiserFS and Ext3 were all listed as modules, which might account for the fs file system kernel panic... :o

But all said and done it was a good job I discovered this. So in your view then, given all of the details above, would you say I have gotten my lilo.conf and my fstab exactly as it should be? I would like to be certain of this, then I might know a little better how to do things in future.

Once more your views are extremely appreciated.

Regards,

Q

raid517
06-10-2003, 03:40 AM
Hi just a sub note to say i don't know if its significant, but I have found a file in boot called: vmlinuz-2.4.20-gentoo-r5. Should I include this in Lilo config as well?

Q

Raoul_Duke
06-10-2003, 05:21 AM
Gentoo only needs the bzImage to boot.......as long as it's in your /boot partition and grub/lilo is configured right you should be fine!

Of course, having the correct filesysems compiled in the kernel will help boot-up ;)

raid517
06-10-2003, 05:39 AM
Well there's still something screwy going on. I recompiled the kernel with full support (not modules) for all my chosen file systems.

I edited fstab to look like this:

/dev/hda1 /mnt/hda1 NTFS defults 0 0
/dev/hdb2 /boot ext3 noauto,noatime 1 2
/dev/hdb1 / ReiserFS noatime 0 1
/dev/hdb3 swap sw 0 0
/dev/hdb5 /mnt/hdb5 ext2 noatime 0 0
/dev/hdb6 /mnt/hdb6 NTFS defaults 0 0
/dev/fd0 /mnt/floppy auto defaults 0 0
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
/dev/sda /mnt/sda NTFS defaults 0 0
proc /proc proc defaults 0 0

As was recommended by several people I have spoken to now.

I edited my lilo.conf to look like this:
# $Header: /home/cvsroot/gentoo-x86/sys-apps/lilo/files/lilo.conf,v 1.3 2002/09/30 00:55:18 woodchip Exp $
# Author: Ultanium
# Start LILO global section
menu-scheme=Wb
boot = /dev/hda
prompt
#boot=/devices/discs/disc0/disc
map = /boot/System.map
install=/boot/boot.b
#compact # faster, but won't work on all systems.
lba32
#if lba32 do not work, use linear
#linear
#if you always want to see the prompt with a 15 second timeout:
#timeout=150
delay = 50
vga = normal # Normal VGA console
# End LILO global section
# Linux bootable partition config begins
image = /dev/hdb2/bzimage
root = /dev/hdb1
#root = /devices/discs/disc0/part3
label = Gentoo
read-only # read-only for checking
# Linux bootable partition config ends
# DOS bootable partition config begins
other = /dev/hda1
#other = /devices/discs/disc0/part1
label = WindowsXP
table = /dev/hda
# DOS bootable partition config ends

So given all the advice I've taken I would think this would have to be right by now... Or maybe I've missed something? I sure can't see it anymore if I have...

Q

raid517
06-10-2003, 07:23 AM
Never mind. In a fit of anger because I wasn't getting anywhere I just scrubed the whole lot, nearly 4 days solid work and opted to try again. Only thing is now when I try to unpack the gentoo live CD stage 1 tarball I get a ton of errors saying that 1000's of directories its looking for are missing and therefore it cant unpack. So now I can't even get past the first step anymore lol...

Oh I don't know... maybe I should have just stuck to RedHat...

Q