Installing Lilo on Red Hat Enterprise Linux 4
There are a lot of reasons to run GRUB. We feel there are also a lot of reasons to run LILO. If you do install LILO, the boot process will instantly become traditional. Red Hat hides much of the boot process by default, including the SELinux messages. Yes, sure, you could reconfigure it, but the fact remains that simply installing LILO will give you more information about the boot process. Another advantage is that we often create a variety of utility/recovery systems. We have found that LILO can be compiled from source on virtually every system we have tried to compile it on, including uClibc. We also swap hardware around a lot in our lab, and one advantage of LILO is that it rewrites a lot of information that will make a system failing with a GRUB boot work again. Perhaps the number one reason, though, to be fair to GRUB is that we know LILO. We have used LILO for over 10 years. For that matter, LILO is much more mature, and has been used in many, many situations. It has been around a lot longer than GRUB. We have tried GRUB occasionally, or had to administer systems with GRUB because we did not want to change the default configuration; however, on our own systems, we often come back to LILO after some horribile problem. GRUB, probably is better for most people, so be careful about this. You can seriously mess up your system if you don't know what you are doing. Read our terms of use. Before you go messing with your bootloader, do make sure you can boot and mount your filesystem from a recovery disk or CD first. OK. On with how to install this. You can get the source here:
http://freshmeat.net/projects/lilo/
Let's try and compile:
[root@srv-1 src]# ls
lilo-22.7.src.tar.gz
[root@srv-1 src]# tar -xzf lilo*.gz
[root@srv-1 src]#
[root@srv-1 lilo-22.7]# make
gcc -O -Wall -g `if [ -f /usr/include/linux/version.h ]; then
as86 -0 -a -w -l first.lis -o first.o first.s
make: as86: Command not found
make: *** [first.o] Error 127
[root@srv-1 lilo-22.7]#
|
We need as86. You can get this here:
http://freshmeat.net/projects/bin86/
Let's compile and install as86 and related utilities:
[root@srv-1 bin86-0.16.17]# make
set -e ; for d in ld as; do \
(cd $d && make "LIBS=" "CFLAGS=-O2 -D_POSIX_SOURCE" "LDFLAGS="
"BINDIR=/usr/local/bin" "LIBDIR=/usr/local/lib" "CC=cc" all;); \
done
make[1]: Entering directory `/usr/local/src/bin86-0.16.17/ld'
cc -O2 -D_POSIX_SOURCE -DREL_OUTPUT -c dumps.c -o dumps.o
cc -O2 -D_POSIX_SOURCE -DREL_OUTPUT -c io.c -o io.o
.
.
.
< as86_encap.sh > tmp
chmod +x as86_encap
make[1]: Leaving directory `/usr/local/src/bin86-0.16.17/as'
[root@srv-1 bin86-0.16.17]#
[root@srv-1 bin86-0.16.17]# make install
set -e ; for d in ld as; do \
(cd $d && make "LIBS=" "CFLAGS=-O2 -D_POSIX_SOURCE" "LDFLAGS="
"BINDIR=/usr/local/bin" "LIBDIR=/usr/local/lib" "CC=cc" all;); \
done
make[1]: Entering directory `/usr/local/src/bin86-0.16.17/ld'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/src/bin86-0.16.17/ld'
make[1]: Entering directory `/usr/local/src/bin86-0.16.17/as'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/src/bin86-0.16.17/as'
install -m 755 -s as/as86 /usr/local/bin/as86
install -m 755 -s ld/ld86 /usr/local/bin/ld86
install -m 755 -s ld/objdump86 /usr/local/bin/objdump86
install -m 644 man/*.1 /usr/local/man/man1
ln -sf objdump86 /usr/local/bin/nm86
ln -sf objdump86 /usr/local/bin/size86
[root@srv-1 bin86-0.16.17]#
|
Let's try compiling LILO again:
[root@srv-1 lilo-22.7]# make
.
.
.
as86 -0 -a -w -l first.lis -o first.o first.s
ld86 -0 -s -o first.img first.o
dd if=first.img of=first.b bs=32 skip=1
16+0 records in
16+0 records out
|
Looks good. Let's run the QuickInst routine to install and configure LILO:
[root@srv-1 lilo-22.7]# ./QuickInst
QuickInst configures LILO and installs it on your hard disk. It should only be
used for first-time installations, _not_ to update or modify an existing
installation of LILO. It will _not_ generate a valid installation with versions
of LILO below 22.
The installation procedure can be interrupted by pressing ^C at any time. When
at a prompt, a sub-shell can be invoked with the exclamation mark.
Continue ? [yes]
A directory /boot already exists. If you're installing a new version of
LILO now, QuickInst has to replace the old files with the new ones.
Replace old files ? [yes]
Making LILO ...
if [ -x /usr/bin/bcc -o -x /usr/local/bin/bcc ]; then \
make diagnostic; \
make dosexe; fi
Installing LILO ...
if [ -x /usr/bin/bcc -o -x /usr/local/bin/bcc ]; then \
make diagnostic; \
make dosexe; fi
if [ ! -d $ROOT/sbin ]; then mkdir $ROOT/sbin; fi
if [ ! -d $ROOT/etc ]; then mkdir $ROOT/etc; fi
if [ ! -d $ROOT/boot ]; then mkdir $ROOT/boot; fi
if [ ! -d $ROOT/usr/sbin ]; then \
mkdir -p $ROOT/usr/sbin; fi
if [ ! -d $ROOT`if [ -f /usr/bin/manpath ]; then manpath | sed "s/:.*//";
else echo /usr/man; fi` ]; then mkdir $ROOT`if [ -f /usr/bin/manpath ];
then manpath | sed "s/:.*//"; else echo /usr/man; fi`; fi
if [ ! -d $ROOT`if [ -f /usr/bin/manpath ]; then manpath | sed "s/:.*//";
else echo /usr/man; fi`/man5 ]; then \
mkdir $ROOT`if [ -f /usr/bin/manpath ]; then manpath | sed "s/:.*//";
else echo /usr/man; fi`/man5; fi
if [ ! -d $ROOT`if [ -f /usr/bin/manpath ]; then manpath | sed "s/:.*//";
else echo /usr/man; fi`/man8 ]; then \
mkdir $ROOT`if [ -f /usr/bin/manpath ]; then manpath | sed "s/:.*//";
else echo /usr/man; fi`/man8; fi
if [ -f diag1.img ]; then \
cp -f diag1.img $ROOT/boot; fi
if [ -f diag2.img ]; then \
cp -f diag2.img $ROOT/boot; fi
if [ ! -L $ROOT/boot/boot.b -a -f $ROOT/boot/boot.b ]; then \
mv $ROOT/boot/boot.b $ROOT/boot/boot.old; fi
if [ -f $ROOT/boot/boot-bmp.b ]; then \
mv $ROOT/boot/boot-bmp.b $ROOT/boot/boot-bmp.old; fi
if [ -f $ROOT/boot/boot-menu.b ]; then \
mv $ROOT/boot/boot-menu.b $ROOT/boot/boot-menu.old; fi
if [ -f $ROOT/boot/boot-text.b ]; then \
mv $ROOT/boot/boot-text.b $ROOT/boot/boot-text.old; fi
if [ -f $ROOT/boot/chain.b ]; then \
mv $ROOT/boot/chain.b $ROOT/boot/chain.old; fi
if [ -f $ROOT/boot/os2_d.b ]; then \
mv $ROOT/boot/os2_d.b $ROOT/boot/os2_d.old; fi
if [ -f $ROOT/boot/mbr.b ]; then \
mv $ROOT/boot/mbr.b $ROOT/boot/mbr.old; fi
if [ -f os2_d.b -a 1 = 0 ]; then \
cp os2_d.b $ROOT/boot; fi
if [ 1 = 0 ]; then \
cp boot-text.b boot-menu.b boot-bmp.b chain.b mbr.b $ROOT/boot; fi
if [ ! -L $ROOT/boot/boot.b -a 1 = 0 ]; then \
ln -s boot-menu.b $ROOT/boot/boot.b; fi
if [ 1 = 1 ]; then \
rm -f $ROOT/boot/boot.b; fi
cp mkrescue $ROOT/sbin
cp lilo $ROOT/sbin
strip $ROOT/sbin/lilo
cp keytab-lilo.pl $ROOT/usr/sbin
cp manPages/lilo.8 $ROOT`if [ -f /usr/bin/manpath ]; then manpath |
sed "s/:.*//"; else echo /usr/man; fi`/man8
cp manPages/mkrescue.8 $ROOT`if [ -f /usr/bin/manpath ]; then manpath |
sed "s/:.*//"; else echo /usr/man; fi`/man8
cp manPages/lilo.conf.5 $ROOT`if [ -f /usr/bin/manpath ]; then manpath |
sed "s/:.*//"; else echo /usr/man; fi`/man5
if [ -d $ROOT/dosC/boot -a -f lilo.com ]; then \
cp lilo.com $ROOT/dosC/boot; fi
/sbin/lilo must now be run to complete the update.
(Disk devices live in /dev)
Gathering configuration data ...
Please specify the name of the device where the LILO boot sector should be
stored. (Suggested locations are the Linux root partition or the MBR of your
first drive).
Device name (no default) /dev/hda
You are about to install LILO on your MBR. If there are other operating
systems on your hard disk, LILO will act as a boot manager for them. You
have to specify each operating system in your LILO configuration. (More
about this later.)
Please specify the name of the kernel image file you want to boot by default.
You may list the /boot directory with: !ls /boot/vm*
|
We are using the stock Red Hat kernel, so we have an initial ramdisk:
Default kernel (no default) /boot/vmlinuz-2.6.9-5.0.5.EL
Does this kernel need an inital ramdisk? [no] yes
Initial ramdisk (no default) /boot/initrd-2.6.9-5.0.5.EL.img
|
We also want to boot a recovery partition:
Define additional kernels ? [no] yes
Specify the names of additional kernels now. Use "done" (without the quotes)
to stop adding kernels.
Kernel (no default) /boot/recovervmlinuz
Does this kernel need an inital ramdisk? [no]
Kernel [done]
If you want to boot other operating systems than Linux from your hard disk,
you should configure them now. LILO will take over the entire boot process,
so any currently installed partition switchers or boot managers will stop
to work. (If this scares you, just hit ^C and read the manual.)
Define additional operating systems (e.g. MS-DOS) ? [no]
Ready to install LILO's boot sector on your hard disk.
Type !cat /etc/lilo.conf if you want to check the configuration file.
Test LILO installation now ? [yes]
Added linux *
Added recovervmlinuz
The boot sector and the map file have *NOT* been altered.
Install LILO now ? [yes]
You see now the output of the map installer with verbose progress reporting
enabled. It will list all items that are installed for booting. Additionally,
if there are have been warnings, they will be repeated again.
LILO version 22.7, Copyright (C) 1992-1998 Werner Almesberger
Development beyond version 21 Copyright (C) 1999-2005 John Coffman
Released 12-Apr-2005 and compiled at 07:53:21 on May 15 2005.
Reading boot sector from /dev/hda
Using MENU secondary loader
Calling map_insert_data
Boot image: /boot/vmlinuz-2.6.9-5.0.5.EL
Mapping RAM disk /boot/initrd-2.6.9-5.0.5.EL.img
Added linux *
Boot image: /boot/recovervmlinuz
Added recovervmlinuz
Writing boot sector.
Backup copy of boot sector in /boot/boot.0300
Done.
[root@srv-1 lilo-22.7]#
|
Here is the automatically created lilo.conf:
[root@srv-1 etc]# cat /etc/lilo.conf
# LILO configuration created by QuickInst 22.5 Sun May 15 08:03:22 PDT 2005
boot = /dev/hda
prompt # always expect prompt
timeout = 150 # wait 15 seconds
vga = normal # force sane state
lba32 # 'linear' is deprecated
delay = 30 # delay 3 seconds if there is a stored command line
#serial = 0,1200n8 # uncomment to use COM1 too
read-only # initailly mount roots r/o
root = current # use "current" root
image = /boot/vmlinuz-2.6.9-5.0.5.EL
label = linux
initrd = /boot/initrd-2.6.9-5.0.5.EL.img
image = /boot/recovervmlinuz
[root@srv-1 etc]#
|
We modified this, and re-ran lilo:
[root@srv-1 etc]# cat /etc/lilo.conf
boot = /dev/hda
prompt # always expect prompt
timeout = 150 # wait 15 seconds
vga = normal # force sane state
lba32 # 'linear' is deprecated
delay = 30 # delay 3 seconds if there is a stored command line
#serial = 0,1200n8 # uncomment to use COM1 too
read-only # initailly mount roots r/o
image = /boot/vmlinuz-2.6.9-5.0.5.EL
label = linux
initrd = /boot/initrd-2.6.9-5.0.5.EL.img
root=/dev/VolGroup00/LogVol00
image = /boot/recovervmlinuz
label = recovery
root=/dev/sda3
[root@srv-1 etc]#
[root@srv-1 /]# /sbin/lilo
Added linux *
Added recovery
[root@srv-1 /]#
|
That is all you need to do. Note that one other advantage to this is that there is little chance that you will accidentally update your kernel. You need to edit /etc/lilo.conf and re-run lilo to get the new kernel updated. Be careful when running up2date. In our experience, the old kernel stays, even if you run up2date and update the kernel, but do be careful.
|
|