Error encountered when adding Ubuntu to LILO
Fatal: Setup length exceeds 31 maximum; kernel setup will overwrite boot loader
I have run into a similar problem when dual booting:
-->Slackware 13.1 (kernel upgraded to 2.6.38)
-->Ubuntu 11.10 (kernel 3.0)
My theory to explain the solution provided in "SECTION 2 - My Solution" is that you cannot load a system
running "kernel 3.0.x" using a boot loader for a system running "kernel 2.6.x" .
SECTION 1 - Problem Definition:
--------------------------------
1) Installed Slackware 13.1 on /dev/sda1 with swap on /dev/sda2
2) Installed Ubuntu 11.10 on /dev/sda3 with swap on /dev/sda4
3) Grub was installed by default on MBR after installation of Ubuntu, but unfortunately GRUB could not load my Slackware properly
4) Used Slackware 13.1 CD 1 to boot my system into Slackware and re-run liloconfig to reconfigure LILO boot loader
5) Created an ubuntu directory in Slackware /boot directory (/boot/ubuntu)
6) Copied vmlinuz-3.0.0-12-generic from Ubuntu 11.10 partition /dev/sda3 into Slackware /boot/ubuntu directory
7) In "/boot/Ubuntu" directory, used mkinitrd to make a ramdisk for the Ubuntu 11.10 "mkinitrd vmlinuz-3.0.0-12-generic" which created a file called "initrd.gz"
8) Re-run liloconfig in expert mode and added the lines:
#--------------------lilo.conf (snippet)------------------------
# Linux bootable partition config begins
image = /boot/vmlinuz
root = /dev/sda1
label = Slackware
read-only # Partitions should be mounted read-only for checking
# Linux bootable partition config ends
# Linux bootable partition config begins
image = /boot/ubuntu/vmlinuz
initrd=/boot/ubuntu/initrd.img
root = /dev/sda3
label = Ubuntu
read-only # Partitions should be mounted read-only for checking
# Linux bootable partition config ends
#--------------------lilo.conf (snippet)------------------------
9)Rerun lilo
10) Error message "Fatal: Setup length exceeds 31 maximum; kernel setup will overwrite boot loader"
An important thing to note is that *Slackware entry was added by lilo but not *Ubuntu entry
*****************************************************************************
MY SOLUTION: I used GRUB to dual boot both Slackware 13.1 and Ubuntu 11.10
*****************************************************************************
SECTION 2 - My Solution
------------------------
1) In Slackware, used "mkinitrd" to make a ramdisk (initrd.gz) for "vmlinuz"
i.e. in directory /boot --> "mkinitrd vmlinuz" which created a file called "initrd.gz"
!remember! - if you already have an initrd.gz file then copy to somewhere else before it is overwritted with the new initrd.gz
2) Mounted Ubuntu partition in Slackware and copied "vmlinuz" and "initrd.gz" to /dev/sda3 (ubuntu partition) into the "/boot/slackware" directory for Ubuntu
!note a! - a folder called "slackware" was created in Ubuntu "boot" directory where the "vmlinuz" and "initrd.gz" for Slackware 13.1 was placed, i.e. "/boot/slackware"
!note b! - you can also copy it on a flash disk or cd-rom disk if you don't know how to mount the Ubuntu drive or don't have support for ext3 in your Slackware kernel
3) Rebooted machine
4) Using Ubuntu boot cd, loaded into livecd
5) Mounted Ubuntu drive "/dev/sda3" in "/mnt" directory while booted from livecd
i.e. "sudo mount /dev/sda3 /mnt"
"MOTD: sudo, sudo, sudo, yyyyyyyuuuuuccccckkkk!!!"
LOL!
6) Linked "/dev" directory of Ubuntu loaded from livecd to "/dev/" directory in "/dev/sda3" which is already mounted as "/mnt/dev"
i.e. "sudo mount --bind /dev/ /mnt/dev"
7) Linked "/sys" directory of Ubuntu loaded from livecd to "/sys/" directory in "/dev/sda3" which is already mounted as "/mnt/sys"
!note! - if you skip this step then Ubuntu will whine that it cannot read the partition table
8) Changed root device from Ubuntu running on live cd to Ubuntu partition (/dev/sda3) mounted on "/mnt"
i.e. "sudo chroot /mnt"
9) Went to the grub configuration directory (/etc/grub.d)
i.e. "cd /etc/grub.d/"
10) Created a file called "50_Slackware"
11) Made the file created "50_Slackware" executable
i.e. "sudo chmod 755 50_Slackware"
12) Opened the file "50_Slackware" with a text editor and added the following lines
---------------------copy-paste begin---------------------
#!/bin/sh -e
echo "Adding Slackware Linux to GRUB 2"
cat << EOF
menuentry "Slackware 13.1" {
set root=(sd0,1)
linux /boot/slackware/vmlinuz
initrd /boot/slackware/initrd.gz
}
EOF
---------------------copy-paste end---------------------
!notes! the lines:
a) echo "Adding Slackware Linux to GRUB 2" -> line echoed when reloading grub configuration
b) menuentry "Slackware 13.1" -> what you will see in the actual grub menu after reboot
c) set root=(sd0,1) -> my slackware is on /dev/sda1 --> sda1--> a = 0, 1=1 --> (sd0,1)
d) linux /boot/slackware/vmlinuz --> location of "vmlinuz" for slackware as done in step 2) above
e) initrd /boot/slackware/initrd.gz -->location of "vmlinuz" for slackware as done in step 2) above
13) Save file and exit from text editor
14)Update grub (this is needed to update the "grub.cfg" file)
i.e. "sudo update-grub"
15) Re-install grub on the MBR (Master Boot Record) of your hardisk (in my case the hard disk is /dev/sda which has /dev/sda1 for slackware and /dev/sda3 for ubuntu)
"sudo grub-install /dev/sda"
16) You should see output messages saying that Ubuntu was added and Slackware 13.1 was found and added
17) Reboot your machine making sure to remove the live cd when computer has rebooted
18) Behold! Thy Grub screen looketh kewl havin' Slackware 13.1 listed
19) Enjoy!
20) LOL!
--------------------------MOTD----------------------------
"Do you cheat on your wife?" asked the psychiatrist.
"Who else?" answered the patient.
----------------------------------------------------------