Jump to content

Multiple Hard Disk config with lilo


Recommended Posts

Last night, I connected a 10GB disk to my USB2 card, and installed Gentoo to it. I'm now wanting to modify the lilo bootloader that is installed on the internal hard disks along with Mandriva.

 

I have /dev/hda which is where lilo is written to the MBR, and am wanting to add an entry to /etc/lilo.conf, so that it will boot gentoo from /dev/sda2.

 

What options do I need to add? I tried last night, but it was trying to find the gentoo kernel in /boot on /dev/hda.

 

The other problem is I cannot use grub. The reason is I'm using software raid, and I tried grub last night, but it completely screwed the bootloader, so I can only use lilo.

Link to comment
Share on other sites

Well, what does your lilo look like so far? Something like

 

image=/dev/sdaX/boot/vmlinuz-kernel-stuff

label=Distro-Name

root=/dev/sdaX

initrd=/dev/sdaX/boot/initrd.img-stuff

append="devfs=mount sda=ide-scsi sda=ide-scsi acpi=off"

read-only

 

Should work.

 

edit: There should be a possibility to use grub. Read this link: http://lists.us.dell.com/pipermail/linux-p...uly/008898.html

Link to comment
Share on other sites

I'll have a look tonight, as I'm not on the system now :P

 

Yeah, I did an install with gentoo with software raid and grub was OK for this. I think it's just because lilo was used at install instead of grub which is why I have the problem now. It couldn't find stage1 or stage 1.5 from when I was trying to install to the MBR.

Link to comment
Share on other sites

OK, this is the problem. Here is what is in /boot on /dev/sda2 when mounted in Mandriva under /mnt/removable1:

 

[root@esprit etc]# ls /mnt/removable1/boot/
boot@  config-2.6.12-gentoo-r6  kernel-2.6.12-gentoo-r6

 

I've not bothered with an initrd kernel, just a normal kernel compile which works fine for gentoo. This is what I added to lilo.conf:

 

image=/dev/sda2/boot/kernel-2.6.12-gentoo-r6
	label="gentoo"
	root=/dev/sda2
	append="resume=/dev/sda1"
	vga=788

 

when I run lilo, this is the error I get:

 

[root@esprit etc]# lilo
Added linux
Added linux-nonfb
Added failsafe
Added 2612-22
Added linux-i686-up-4GB *
Added 2612i686up4G-22
Fatal: open /dev/sda2/boot/kernel-2.6.12-gentoo-r6: Not a directory

 

I'm pretty sure if this said /mnt/removable1 instead, it would work, but unfortunately, the system wouldn't boot then. Any ideas how I can get it to work?

Link to comment
Share on other sites

You have to give the path to your gentoo kernel image through the device mount point, not through the device file. Try this:

 

1. Create a directory in your mandriva /boot and name it "gentoo";

2. Copy kernel-2.6.12-gentoo-r6 from your gentoo /boot to your mandriva /boot/gentoo;

3. Edit your lilo like so:

 

image=/boot/gentoo/kernel-2.6.12-gentoo-r6
	label="gentoo"
	root=/dev/sda2
	append="resume=/dev/sda1"
	vga=788

 

4. With the external hard drive connected and turned on, rerun lilo.

 

It's important that the external drive that you have gentoo on be connected when you run lilo or you will get an error and lilo will refuse to write your changes to the mbr. Since your gentoo root is set as /dev/sda2, lilo will look and see if such a partition exists; if it doesn't find sda2, it will spit out an error and refuse to go on.

 

If you do the above lilo should write but I can't guarantee that you will be able to boot into gentoo. It will depend in large part what drivers are compiled into your gentoo kernel. If you don't have the drivers in that kernel necessary for dealing with an external usb hard drive, the kernel will load and give a kernel panic when it can't find /dev/sda2.

Link to comment
Share on other sites

OK, I'll give this a go tonight when I get home. I configured the kernel to deal with USB hard disks, so hopefully it should be OK.

 

One of my thoughts was copying it over to the mandriva partition, but wasn't sure if there was a better method to save doing this. However, it does seem to make sense to ensure lilo is written correctly.

 

Thanks chaps, will let you know the outcome tonight.

Link to comment
Share on other sites

hokai,

 

Grub and Lilo are two different beasts that work entirely differently. Neither setup is more 'correct' in their operation than the other.

 

LILO, writes the kernel images and any initramfs/initrd to the boot sector with itself. Thus, whatever's in the lilo config when you run 'lilo' is what you will see there. It's not referenced by lilo at all after that. This means it doesnt matter where the kernel image file is at lilo installation, so long as it's accessible. So no need to copy it to your host system, although it would make it easier to install lilo in future if the drive were not connected and mounted to the same spot.

 

Grub, rather, stores filesystem drivers, and it's config file location to the bootsector, so it reads it's config file on boot, and loads it up. This is why GRUB allows you to dynamically modify it at boot time -- the disadvantage is if the config file's location on disk is moved, grub dies.

 

When configuring LILO, you must provide the full path to the image file, as it is mounted. so instead of /dev/sda2/boot/kernel-2.6.12-gentoo-r6, you must use, /mnt/sda2/boot/kernel-2.6.12-gentoo-r6.

However, you said that didnt work (post the error next time), and I'd put my money on that it errored out mounting your root filesystem, or LILO barfed in some form on boot.

 

If it errored out about mounting root filesystem, this is because most kernels do not have USB support inbuilt into either the kernel or initramfs/initrd, instead they load it as modules, after the system has been booted and after root has been mounted. To fix this, either recompile the kernel with USB storage support inbuilt, or if you are using one, generate a new initramfs/initrd containing usb storage and your usb controller (ehci-hcd) using your distro's tools. If you are trying to install mandrake on this drive, reinstall it directly to the drive and it *should* configure the kernel correctly for you. Just check that you arent already using an initramfs/initrd and have forgotten to add it too.

 

As for LILO barfing, I had problems with it booting an external drive directly from it's menu as you're trying. Instead I added a chainloader entry (exactly the same as a windows entry) for that drive, and I told the distro to install the bootloader to the USB drive. 2 bootloaders, slightly hackish, but perfectly safe, and worked more reliably for me.

 

James

Link to comment
Share on other sites

OK, I'll bear that in mind tonight. I did post the error, it was more related to the install of lilo that failed. I've not been able to do it successfully and boot, since it didn't like my entries in the lilo.conf file.

 

But I have some more info now, so maybe I'll get it working tonight :P

Link to comment
Share on other sites

OK, this is my now /etc/lilo.conf:

 

image=/boot/kernel-2.6.12-gentoo-r6
	label="gentoo"
	root=/dev/sda2
	append="resume=/dev/sda1"
	vga=788

 

I've put kernel-2.6.12-gentoo-r6 in the /boot directory on my Mandriva partition, and lilo loaded OK. I've yet to test the reboot, but gonna do that now :P

Link to comment
Share on other sites

I didn't get this to work in the end. I ended up with a kernel panic, so it could have been something to do with the kernel compilation. I'm pretty sure it was compiled with the USB stuff in though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...