LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   how-to properly edit lilo to boot 2nd linux partition (https://www.linuxquestions.org/questions/slackware-14/how-to-properly-edit-lilo-to-boot-2nd-linux-partition-698001/)

agrestic 01-17-2009 05:05 PM

how-to properly edit lilo to boot 2nd linux partition
 
Hi. Currently lilo.conf (relevant parts) looks like this:
Code:

append=" vt.default_utf8=0"
boot = /dev/sda
lba32
# Linux bootable partition config begins
image = /boot/vmlinuz
  root = /dev/sda1
  label = Slackware
  read-only

image = /boot/vmlinuz
  root = /dev/sda3
  label = Ubuntu
  read-only

The actual vmlinuz for ubuntu is (from the Slack partition) /ubuntu/boot/vmlinuz-2.6.27-9-generic. I tried that, but the computer froze while trying to load ubuntu; had to hold down the power button on the case. Same happened when I tried "/boot/vmlinuz-2.6.27-9-generic".
But while trying the above, in code tags, ubuntu started to boot without a gui, the screen flickered at the login prompt. There were 2 errors, or failures: something to do with "/sbin/mount.ntfs" failing to load, and the nvidia kernel module failing. It froze while displaying a low-resolution warning about not being able to load the nvidia driver. I have to either use the case's power button to shut down & restart, or Ctrl+Alt+Del before the low-res warning pops up.
Here's fstab:
Code:

/dev/sda2        swap            swap        defaults        0  0
/dev/sda1        /                ext3        defaults        1  1
/dev/sda3        /ubuntu          ext3        defaults        1  2
#/dev/cdrom      /mnt/cdrom      auto        noauto,owner,ro  0  0
/dev/fd0        /mnt/floppy      auto        noauto,owner    0  0
devpts          /dev/pts        devpts      gid=5,mode=620  0  0
proc            /proc            proc        defaults        0  0
tmpfs            /dev/shm        tmpfs      defaults        0  0

As an aside, I added the lba32 option because when I first tried /sbin/lilo it gave me the lba32 warning. Also, each time I edited lilo.conf, i ran /sbin/lilo. So idk what i'm doing wrong here.
Thanks for your time.

*****
EDIT: Regarding ubuntu entry. I read this post https://www.linuxquestions.org/quest...o-lilo-140452/ and thought I should change a couple things. I changed the 1st line to "image = /ubuntu/boot/vmlinuz-2.6.27-9-generic" & added "initrd = /ubuntu/boot/initrd.img-2.6.27-9-generic" below the 'label' line, but running /sbin/lilo gave me this warning:
Code:

Added Slackware *
Warning: The initial RAM disk is too big to fit between the kernel and
  the 15M-16M memory hole.  It will be loaded in the highest memory as
  though the configuration file specified "large-memory" and it will
  be assumed that the BIOS supports memory moves above 16M.
Added Ubuntu ?
One warning was issued.

The BIOS can't be too old -- Dell Inspiron 530 2.4Ghz quad. Should I try to reboot anyway?
Thanks.

kilgoretrout 01-17-2009 05:32 PM

IIRC Ubuntu uses an initrd so you have to have an initrd line in its lilo entry for starters. Note, slack doesn't use an initrd by default, ulike most other distros. The ubuntu entry should look something like:

Code:

image = /ubuntu/boot/vmlinuz
  root = /dev/sda3
  initrd = /ubuntu/boot/initrd.img
  label = Ubuntu
  read-only

I'm assuming that ubuntu has soft links, vmlinuz and initrd.img, to the actual ones which is pretty much standard. You can check that by running:

# ls -l /ubuntu/boot/

astrogeek 01-17-2009 05:40 PM

Hi agrestic,

What is happening is that you are telling lilo to boot the buntu partition (/dev/sda3) using the Slackware kernel image which is /boot/vmlinuz at the time you run /sbin/lilo.

When you run lilo it translates the kernel image location into an absolute device independent location on the drive, because at boot time there is no such thing as /boot/vmlinuz and lilo has no knowledge of any filesystem.

So, you must use a path to the actual kernel image that lilo can find when you run /sbin/lilo, NOT when it is booting.

One way to do this, assuming the buntu kernel is on /dev/sda3 at /boot/vmlinuz and that you are running lilo while booted into Slackware on /dev/sda1, is to mount /dev/sda3 at some location like /mnt/tmp, then use the following lines in lilo.conf:

Code:

image = /mnt/tmp/boot/vmlinuz
  root = /dev/sda3
  label = Ubuntu
  read-only

Then when you run /sbin/lilo it will find the physical location on the drive for the buntu kernel and be able to load that at boot time.

Please note that this also assumes that buntu assigns the same partition order as Slackware, should not normally be a problem but be aware of it.

This should get you going quickly, but a better way would be to chain boot into buntu. To do that you would need to be able to boot into buntu and install it's own lilo to /dev/sda3 root partition, then add this to the Slackware lilo.conf:

Code:

other = /dev/sda3
label = Ubuntu

Then the MBR installed by Slackware lilo will be able to chain boot to the sda3 partition and find the boot record installed by buntu and boot it from there. This is usually the best way of booting multiple Linuxes IMO.

agrestic 01-17-2009 05:45 PM

Quote:

Originally Posted by kilgoretrout (Post 3412315)
# ls -l /ubuntu/boot/

Looks like I was posting an update as you answered. Great timing, eh? :) Thanks for the response.

astrogeek 01-17-2009 05:51 PM

Quote:

Originally Posted by agrestic (Post 3412324)
Looks like I was posting an update as you answered....

And I was posting as... well...

Changing the kernel path as you wrote in your EDIT does what I was suggesting in the first method of my own post.

As for the initrd thing, that would be naturally 'avoided' by the chain boot method as buntu would use it's own setup as normal but would simply place them in the boot sector of it's own root partition instead of the MBR, so it would see no problems. That is why I like chain booting - each Linux manages it's own boot record install except the first which manages the MBR. But whatever works best for you!

agrestic 01-17-2009 05:55 PM

Quote:

Originally Posted by astrogeek (Post 3412320)
One way to do this....is to mount /dev/sda3 at some location like /mnt/tmp, then use the following lines in lilo.conf:

Code:

image = /mnt/tmp/boot/vmlinuz
  root = /dev/sda3
  label = Ubuntu
  read-only


Thanks. Since /dev/sda3 is already mounted on /ubuntu, I should mount it like
Code:

$ mount -o bind /ubuntu /mnt/tmp
...right? :)
Quote:

Originally Posted by astrogeek (Post 3412320)
...a better way would be to chain boot into buntu. To do that you would need to be able to boot into buntu and install it's own lilo to /dev/sda3 root partition, then add this to the Slackware lilo.conf:

Code:

other = /dev/sda3
label = Ubuntu

Then the MBR installed by Slackware lilo will be able to chain boot to the sda3 partition and find the boot record installed by buntu and boot it from there. This is usually the best way of booting multiple Linuxes IMO.

Awesome; many thanks. Once I get it running, that's the first thing I'll do.

agrestic 01-17-2009 06:03 PM

Jahahaha! Wunderbar! I didn't even have to see that ugly ubuntu start-up graphic -- straight to the desktop. :D Thanks again! Now to install LILO.

astrogeek 01-17-2009 06:12 PM

Quote:

Originally Posted by agrestic (Post 3412332)
Thanks. Since /dev/sda3 is already mounted on /ubuntu, I should mount it like
Code:

$ mount -o bind /ubuntu /mnt/tmp

Or just change the image line in lilo.conf to /ubuntu/boot/vmlinuz if that is where it is mounted under Slackware.

[EDIT]
Just to be complete, when you are booted into buntu and ready to install it's boot record to it's own root partition, just edit it's lilo.conf and change...
Code:

boot = /dev/sda

to...

boot = /dev/sda3

Then run it's own /sbin/lilo and you should be all set!
[/EDIT]

agrestic 01-17-2009 06:35 PM

Quote:

Originally Posted by astrogeek (Post 3412350)
[EDIT]
Just to be complete, when you are booted into buntu and ready to install it's boot record to it's own root partition, just edit it's lilo.conf and change...
Code:

boot = /dev/sda

to...

boot = /dev/sda3

Then run it's own /sbin/lilo and you should be all set!
[/EDIT]

Thanks, that's where I am now. ubuntu has lilo installed, but I had to create lilo.conf w/ correct permissions; running /sbin/lilo -b /dev/sda3 gave me
Code:

Warning: LBA32 addressing assumed
Fatal: No images have been defined.

Looks like I'll have to write lilo.conf myself. :)

astrogeek 01-17-2009 06:42 PM

Quote:

Originally Posted by agrestic (Post 3412376)
Looks like I'll have to write lilo.conf myself. :)

HA! I assumed lilo was configured under buntu. But no problem.

I am not a buntu user but it should have something like liloconfig or probably a GUI tool for generating an initial lilo.conf - or you can write one yourself very easily... just be sure not to install to MBR or you will wipe your Slackware boot record... but easy enough to recover as you can see now

Have fun!

agrestic 01-17-2009 07:09 PM

Yeah, they use grub by default. I just used parts of the slackware lilo.conf, made sure (like you said) that boot = /dev/sda3. You're right about liloconfig; however, i couldn't use it b/c my fstab is still showing sda1 as windoze instead of slackware. I replaced XP a few hours ago cause my game Oblivion kept crashing. That's ok though; Oblivion runs under wine. :D
Anyhow, /sbin/lilo in ubuntu gave me that RAM warning; but when I updated slack's lilo.conf like you said it gave no more warnings.
Now I have what I wanted and learned a little about chainloading and bootloaders in the process; so I'm feelin' fat and happy. :)
Thanks again.

astrogeek 01-17-2009 07:26 PM

Quote:

Originally Posted by agrestic (Post 3412410)
Now I have what I wanted and learned a little about chainloading and bootloaders in the process; so I'm feelin' fat and happy. :)
Thanks again.

Glad to hear you got it going, and you are welcome!

FWIW, with the other = /dev/sda3 line in your Slackware lilo.conf, installed to the MBR, it really doesn't care what is installed on /dev/sda3 as long as it has a boot record. Consequently, you can install grub to the root partition from buntu and still happily boot to buntu from grub chained from the lilo MBR.
But it won't help with the weight problem, I've tried... ;)

agrestic 01-27-2009 11:52 AM

Quote:

Originally Posted by astrogeek (Post 3412421)
...it won't help with the weight problem, I've tried... ;)

Haha! Touche!


All times are GMT -5. The time now is 08:57 PM.