How to replace Grub with LILO on Ubuntu 7.04? ~ Ask The Admin

Sunday, August 05, 2007

How to replace Grub with LILO on Ubuntu 7.04?

Greetings ladies and gents. I have recently embarked on a series of alternative to Ghost testing. I finally ended up using an open source Ghost-like program called PING. Anyway, when testing out my newly created image using PING, I found that GRUB got corrupted after the re-image. I had to fix my corrupt GRUB boot loader using these steps. After reading online I found that imaging, even using commercial applications like Symantec Ghost will corrupt GRUB.

Well, that got me thinking, would things change if instead of using GRUB as my boot loader, perhaps I would use LILO instead? Now here is where I am stuck. I want to replace GRUB with LILO on my Ubuntu 7.04 system, but each time I try I end up with a corrupted MBR, and I have to fix GRUB again to get my system to boot. When I try to boot all I get is a screen that says MBR FA:

Does anyone know of a sure fire way to replace GRUB with LILO on Ubuntu 7.04?

Let's get some comments going up in this joint!!

-El Di Pablo

Solution also by El Di Pablo.

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#UUID=fded2ced-53ea-4dfa-bdb3-e4fd0b7a4fd3 # /dev/sda2UUID=948b4626-2f62-40c0-bc92-6ee8b69af42e /media/hda2 reiserfs defaults 0 2# /dev/sda3UUID=e0430d86-1ae0-4563-9b12-f8b6988e9df2 /media/hda3 reiserfs defaults 0 2# /dev/sda5UUID=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 go 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 2 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/ubuntuubuntu@ubuntu:~$ sudo mount /dev/hda7 /mnt/ubuntu/ubuntu@ubuntu:~$ sudo mount -t proc none /mnt/ubuntu/procubuntu@ubuntu:~$ sudo mount -o bind /dev/ /mnt/ubuntu/devubuntu@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/procubuntu@ubuntu:~$ sudo umount /mnt/ubuntu/devubuntu@ubuntu:~$ sudo umount /mnt/ubuntuubuntu@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 bigpond.net.au where I found a lot of my information for the correct commands to use.