Configuring Lilo on Debian and QEMU

by Mike Levin SEO & Datamaster, 07/28/2010

At this point, I’m actually going to shut down and copy out the hard drive file for the ultimate undo. So far, I’ve done that three times. I have:

harddisk-formatted.raw harddisk-base.raw harddisk-kernel.raw

This way, I can rename any of them back to harddisk.raw, drop it into the QEMU directory, and go back to that state. After doing that, all you have to do is type this command to boot again:

qemu -hda harddrive.raw -cdrom knoppix.iso -boot d

We promote ourselves to superuser again by typing:

sudo su

And we mount the hard drive again by typing:

mount /dev/sda1 /mnt/sda1

Before we chroot over to this location again, there are a couple more commands we need to type to ensure that the devices will be available for running Lilo:

mount -o bind /proc /mnt/sda1/proc mount -o bind /dev /mnt/sda1/dev

Now we can chroot:

chroot /mnt/sda1

Okay, it’s time to manually make a /etc/lilo.conf file. I tried running liloconfig again now that the kernel files are in place, but no luck. I use vi as my text editor, but vi is probably a bit too intimidating for folks new to Linux at this point. There’s an editor called nano that works a lot more like text editors that non-Linux people are used to. So, type:

nano /etc/lilo.conf boot=/dev/sda root=/dev/sda1 image=/boot/vmlinuz-2.6.32.6 label=Linux Ctrl+o [Enter] Ctrl+x

This will effectively create the file from scratch. Now type the following lines. Ctrl+o actually saves. It’s labeled “WriteOut” but don’t let that fool you. It’s save, although you will have to hit the Enter key afterwards to confirm the file name. And then Ctrl+x quits nano.

Now, type:

lilo -v -v

Lilo will execute and scroll a bunch of stuff past you. A few warnings may be issued, but that’s fine. It will look like this if it worked: Configuring Lilo on Debian

While the system is actually bootable now (the boot sector has been written to), it will not be worth actually doing the reboot yet, because the /etc/fstab (file system table) is not set up yet, telling the overall operating system what drives it has, and no user has been set up yet, and root doesn’t have a password, so you won’t be able to log in. And finally, there’s still no network configuration file.