Aug 5, 2007

Changing from GRUB to LILO: Ubuntu 7.04

Like some things I write about, I couldn't find a definitive solution for changing from GRUB to LILO in the latest release of Ubuntu (Feisty at the time of this writing). Well, I don't just take things lying down. I found a solution and I will share it with you:

1) Install LILO using apt-get (sudo apt-get install lilo). Follow the prompts until it is finished installing.

2) Edit /etc/fstab (sudo gedit /etc/fstab). Find the line either containing your /boot partition, or your / partition (Whichever one Grub is set to boot off of). Mine is sda1. Comment out the UUID line of the boot partition ONLY. Change it to the 'Old school' format of /dev/sda1, then paste the last parts of the commented section after the 'old school' formatting. It should now look something like this:

# /etc/fstab: static file system information.
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro 0 1
# /dev/sda2
UUID=948b4626-2f62-40c0-bc92-6ee8b69af42e /media/hda2 reiserfs defaults 0 2
# /dev/sda3
UUID=e0430d86-1ae0-4563-9b12-f8b6988e9df2 /media/hda3 reiserfs defaults 0 2
# /dev/sda5
UUID=8af9d362-4535-49e4-a188-32bd74860d87 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0

3) Once that is edited, and saved, reboot your computer and boot up using the Ubuntu Live CD.

4) Once booted up to the live CD, open a terminal. First we need to make sure that /boot or / (Whichever you have set up) is flagged as the active boot partition. To do this, in the terminal type sudo parted and hit enter. This will open the parted shell. In the shell, type print to display your current partitions and their settings. Find the number of the partition you want LILO to boot from (Mine was 1). Type set 1 boot on then enter. Then type quit to exit the parted shell.

(parted) > set 1 boot on

(parted) > quit

5) Now we chroot into the ubuntu install, and configure LILO. Type the following, line by line:

ubuntu@ubuntu:~$ sudo mkdir /mnt/ubuntu

ubuntu@ubuntu:~$ sudo mount /dev/sda1 /mnt/ubuntu/

ubuntu@ubuntu:~$ sudo mount -t proc none /mnt/ubuntu/proc

ubuntu@ubuntu:~$ sudo mount -o bind /dev/ /mnt/ubuntu/dev

ubuntu@ubuntu:~$ sudo chroot /mnt/ubuntu /bin/bash

6) Now we can run liloconfig (sudo liloconfig). When prompted, answer yes to everything (i.e. install boot block to /dev/sda1, and MBR to /dev/sda etc).

7) Now we run lilo -b /dev/sda1 to make our changes stick.

8) Now we unmount everything, and reboot:

ubuntu@ubuntu:~$ sudo umount /mnt/ubuntu/proc

ubuntu@ubuntu:~$ sudo umount /mnt/ubuntu/dev

ubuntu@ubuntu:~$ sudo umount /mnt/ubuntu

ubuntu@ubuntu:~$ sudo reboot

9) When you boot back up, you should have a nice new LILO boot splash staring you in the face!

I found that trying to do this on my running Ubuntu workstation would cause a corruption in the MBR, it was only when I decided to try configuring LILO using the live CD so the boot partition wasn't active that I had success moving to LILO.

If you know an easier method for doing this, please hit me up in the comments!

NOTE: A big shout out to where I found a lot of my information for the correct commands to use.

Don't Forget your Bauer-Power Gear!

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam