LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Lilo multibooting problem (https://www.linuxquestions.org/questions/slackware-14/lilo-multibooting-problem-676145/)

kcynice 10-13-2008 07:18 PM

Lilo multibooting problem
 
There are total 3 os installed on my disk, windows xp on /dev/hda1,debian on /dev/hda9 and slackware on /dev/hda9. Slackware is my favor. Before my slackware was installed, debian had installed GRUB for bootintg menu witch have debian and xp enterance included. But after i installed my slackware, which use lilo as its loader, only has only 2 choice: Windows and my slackware! So, i followed some guideline to edit /etc/lilo.con to add an entry for debian:
other = /dev/hda9
label = Debian
Table = /dev/hda
But when i use lilo -t to test it, there is an error: The first section of the partition /dev/hda9 doesn't have a bootable signature.
Why and how to fix it?
Thanks.

astrogeek 10-13-2008 07:29 PM

First, you say Debian and Slack are on /dev/hda9, I assume that is a typo...?

T make it go as-is the easy way, boot into Debian how-ever you can (ie, CD boot) and run grub and install it's bootloader on it's own partition ('root partition' in lilo speak - NOT MBR).

Then boot back into Slack and run lilo - it should now recognize the Debian partition as bootable.

slackass 10-13-2008 08:33 PM

The super grub disk will reinstall grub for you.
free download
http://www.supergrubdisk.org/
Then you can just edit the menu.lst.
Or install grub from the slack dvd in the extra folder.
Then run:
grubconfig
you may have to edit the Debian entry to get it to boot Debian.

kcynice 10-13-2008 08:36 PM

Quote:

Originally Posted by astrogeek (Post 3309172)
First, you say Debian and Slack are on /dev/hda9, I assume that is a typo...?

T make it go as-is the easy way, boot into Debian how-ever you can (ie, CD boot) and run grub and install it's bootloader on it's own partition ('root partition' in lilo speak - NOT MBR).

Then boot back into Slack and run lilo - it should now recognize the Debian partition as bootable.

Oh, sorry, it's my fault. my slackware was installed on /dev/hda8 and debian on /dev/hda9. You mean, i should boot my debian os to install grub?

In fact, in my windows xp, i have added an entrance to grub at c:/boot.ini. of course i have download a dos version of grub in the windows partition. So, in lilo's boot menu, if i select windows, it will give me two choice: 'windows xp professional' and 'grub', then select grub, it would find my old grub menu(before i installed my slackware),does this mean my debian has its own bootloader on its partition?.
Although i can boot my debian by this, but i really want to add a choice in lilo's menu as my slackware.

T3slider 10-13-2008 08:44 PM

If you want to use LILO instead of GRUB, you would have to create a kernel stanza similar to Slackware's -- and NOT similar to Windows'. Your current entry:
Code:

other = /dev/hda9
label = Debian
Table = /dev/hda

will ONLY work if GRUB is installed to the superblock of /dev/hda9. This would be chainloading Debian's GRUB from Slackware's LILO (ie you would first see LILO, then select Debian, and it would show you the GRUB prompt where you could then select which kernel to boot). If you want to do it that way, that's fine -- but you would have to follow astrogeek's advice and install GRUB to the superblock of Debian's root partition (/dev/hda9). To clarify: you would reinstall GRUB, but to the superblock of /dev/hda9 and NOT to the MBR (where it was before and where LILO is now).

If you want to get LILO to boot Debian (without using GRUB at all), you would have to add an entry like the following:
Code:

image = /boot/vmlinuz
  initrd = /boot/initrd.gz
  root = /dev/hda9
  label = Debian
  read-only

You would have to change the /boot/vmlinuz line to match the location of Debian's kernel image. Also, you would have to change the initrd line to match the location of Debian's initrd (initial ramdisk) IF it uses one -- if not, just remove that line entirely. If you take this approach, remember that you MUST run `lilo` as root after editing lilo.conf for the changes to take effect.

astrogeek 10-13-2008 08:50 PM

Quote:

Originally Posted by kcynice (Post 3309217)
You mean, i should boot my debian os to install grub?

Yes, if you can boot into Debian from grub in M$ that is fine.

Once in Debian, use it's grub command or setup tool, (sorry, I am not sure how Debian does it), to install a bootloader onto it's own partition, /dev/hda9. In lilo this is the 'boot' parameter, also called the 'root' partition - but NOT the MBR (Slack's lilo bootloader lives there now). Be sure NOT to install anything to MBR or you will then not be able to easily boot back into Slackware.

Then, boot back into Slackware and run lilo -t as you did before and it should recognize the Debian partition as bootable and allow you to add the entry for it.

T3slider 10-13-2008 08:53 PM

Quote:

Originally Posted by astrogeek
Then, boot back into Slackware and run lilo -t as you did before and it should recognize the Debian partition as bootable and allow you to add the entry for it.

Just a note (I'm assuming this is a typo) -- `lilo -t` will only test the installation but will not actually install. Therefore, just `lilo` must be used to write to the MBR. It's nice to run `lilo -t` to see if it should work and THEN run `lilo` to actually write to the MBR.

astrogeek 10-13-2008 08:58 PM

Quote:

Originally Posted by T3slider (Post 3309231)
Just a note (I'm assuming this is a typo) -- `lilo -t` will only test the installation but will not actually install. Therefore, just `lilo` must be used to write to the MBR. It's nice to run `lilo -t` to see if it should work and THEN run `lilo` to actually write to the MBR.

Yes, -t will only test it, but kcynice indicated in the first post that they were aware of that... but guess I should have made it more clear though - thanks.

T3slider 10-13-2008 09:15 PM

Ah, didn't see that. Never mind then. :)

kcynice 10-13-2008 10:14 PM

i still can't configure lilo successfully. I can find grub in my debian partition, there is a menu.lst file which has the following code:

Title Debian GUN/Linux kernel 2.6.18-6-686
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-6-686 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6-18-6-686
savedefault

so, i add a new entrance to my lilo.conf like this:
image = /boot/vmlinuz-2.6.18-6-686
initrd = /boot/initrd.img-2.6.18-6-686
root = /dev/hda1
label = Debian

but i got such error when i run 'lilo -t':
Fatal: Can't open /boot/vmlinuz-2.6.18-6-686:No such file or directory.

it seems that, lilo uses wrong root directory, why?

astrogeek 10-13-2008 11:03 PM

The lilo stanza for Debian is not correct...
 
Quote:

Originally Posted by kcynice (Post 3309279)
i still can't configure lilo successfully. I can find grub in my debian partition, there is a menu.lst file which has the following code:

Title Debian GUN/Linux kernel 2.6.18-6-686
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-6-686 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6-18-6-686
savedefault

so, i add a new entrance to my lilo.conf like this:
image = /boot/vmlinuz-2.6.18-6-686
initrd = /boot/initrd.img-2.6.18-6-686
root = /dev/hda1
label = Debian

But lilo cannot 'see' the Debian partition when you are in Slackware, so it is looking in it's own local /boot/ directory for the Debian kernel and cannot find, hence the error.

I will add some comments on other ways of doing this below, but for now let's pursue this simplest way...

Two things must be satisfied to easily add the Debian boot to the Slackware managed lilo bootloader:

1. There must be a valid bootloader installed in the first 512 bytes of the Debian partition, /dev/hda9, capable of booting Debian when it is called.

2. There must be a valid 'other' stanza in the Slackware MBR bootloader to make the call to the Debian partition bootloader. This is called chain booting by the way.

FIRST:
The easiest way to install the bootloader on the Debian partition is to boot into Debian (ie, from CD or your M$ grub entry) and use it's own grub (or lilo) to install it's own bootloader to it's own partition (NOT MBR). Since you have grub already configured for Debian I suggested using it, but you could just as well use lilo with an entry like this...

#Title Debian GUN/Linux kernel 2.6.18-6-686
boot = /dev/hda9
image = /boot/vmlinuz-2.6.18-6-686
initrd /boot/initrd.img-2.6-18-6-686
root = /dev/hda9
label = Debian

The 'boot' line tells it where to install, the others tell it what to install. Running lilo under Debian with a lilo.conf based on this (you will need message and timeout options, etc.) will install a bootloader to /dev/hda9.

SECOND:
Once the bootloader has been installed to the Debian partition, you need to boot into Slackware and add a chain boot to the Debian partition, like this in your Slackware lilo.conf (in addition to your Slackware entries of course):

#Chain to Debian partition
other = /dev/hda9
label = Debian
Table = /dev/hda

Then run lilo from Slackware to install the MBR bootloader...

Now when you boot you will get the Slackware and M$ options along with the Debian option. If you choose Debian it will use the bootloader from /dev/hda9 to boot Debian.

As I said that is the easy way that should keep you safe from ending up with an unbootable system.

Now, you CAN add a more complex Debian boot directly from Slackware by temporarily mounting the Debian partition and using a lilo stanza that points to the mount point (something like this - but this is not intended to be copied and pasted!)...

image = /mnt/tmp/boot/vmlinuz-2.6.18-6-686
initrd = /mnt/tmp/boot/initrd.img-2.6-18-6-686
map = /mnt/tmp/boot/map_deb
root = /dev/hda9

The important thing to note is that lilo must have access to the kernel and initrd files when it installs - not just the device path like /dev/hda9. It actually uses the physical location on the spinning disk to generate the bootloader because at boot time it has no knowledge of any filesystem or path - it loads the kernel by absolute location on the media.

I use both methods - 'all-in-MBR' and 'chain loading', and chain loading is much easier to manage and less likely to result in an unbootable system. I am also a lilo fanboy :-) and find it much easier to manage when changing OSs and partition mapping and dare I say, more reliable than grub, but that is just my opinion. BUT - lilo requires some knowledge of how it all works... time well spent learning!

Hope this helps, remember the steps, 1 - Install Debian bootloader on /dev/hda9 , 2 - Add 'other' = /dev/hda9 to slackware lilo.conf and install - guaranteed to work...

kcynice 10-13-2008 11:14 PM

but now, i have just modified my original slack entrance,i modified root /dev/hda8 to /dev/hda9 and installed lilo by 'lilo' command with no error. Unfortunately, i restart my computer, i select slackware entrance and boot my debian successfully. But the new problem is that, i have no way to enter my slackware again!
If i still want to use lilo and slackware, should i enter debian and install lilo in debian?

astrogeek 10-13-2008 11:21 PM

Quote:

Originally Posted by kcynice (Post 3309319)
but now, i have just modified my original slack entrance,i modified root /dev/hda8 to /dev/hda9 and installed lilo by 'lilo' command with no error. Unfortunately, i restart my computer, i select slackware entrance and boot my debian successfully. But the new problem is that, i have no way to enter my slackware again!
If i still want to use lilo and slackware, should i enter debian and install lilo in debian?

I am not sure what you mean, but if you just changed root=/dev/hda8 to root=/dev/hda9 then you are very likely booted into your Debian filesystem with your Slackware kernel... run uname to verify your kernel and look at your filesystem to verify where you actually are.

It doesn't work like that.

Verify what you have running and post back... but don't make any changes until you are sure what effect it will have.

astrogeek 10-14-2008 12:02 AM

Make no changes until you know what the effect will be...
 
kcynice, I have to go off for now and will not be back for about 12 hours.

From your last post and description of your system, I suspect that your boot is now 'confused' - I know I am.

As long as your partitions are not changed and nothing is moved or reinstalled you can recover and have your multiboot system - but if you change bootloader parameters without good understanding of their effect you could end up with an unbootable system.

Please re-read my previous post and Google for some lilo info and read the man pages to try to get your understanding of it on more solid ground. But resist the temptation to try things if your system is still bootable until you have a clear path to get it straightened out again.

Until tomorrow...

kcynice 10-14-2008 12:07 AM

my original slackware entrance in lilo.conf is:

image = /boot/vmlinuz
root = /dev/hda8
label = Linux
read-only

as i said, my debian lays on /dev/hda9. I just modified 'root = /dev/hda8' to 'root = /dev/hda9'. After i restarted my system, i entered the original choice, i found it seems like debian because the bash prompt string was the debian's. I don't know how to do it now.

It seems that i use slackware's kernel but use debian's partition.


All times are GMT -5. The time now is 10:02 AM.