User Tools

Site Tools


lilo

everything on this page supplied by:-

https://pastebin.com/b7HMw3Jk

So, you want to install LILO on a USB stick? It's pretty easy if you know what you are doing.

The most important thing to remember is that LILO is designed in such a way that he doesn't read filesystems, but the blocks of data on the storage themselves. Pretty sick, huh?

LILO can read its config from an alternate location and has the option of chrooting into the desired dir to do his shenanigans. Here is the list of things it needs on its root to be configured and written properly.

1) populated /dev: to know where specified devices are at 2) possibly /boot: to write /boot/map and possibly backup of MBR 3) configuration file: to know what to do

When you are done with the installation, you can remove the configuration file from the target device, if it at all was present there. And you of course should umount and remove the /dev from your USB stick before unmounting the whole thing. But don't touch the /boot/map! This is the file where LILO stores its paths to needed files, and you DON'T want it to be missing when the boot starts!

LILO interprets the paths to kernel, initramfs, etc as relative to root IT is working at, not to root of the filesystem the files are stored. So, if you decide to write a config with the paths relative to files on your USB stick, you will need that chroot option.

For that “guide”, or whatever it's called, I decided to do the chroot-to-usbstick-mountpoint approach.

So: 1) Write a configuration file that will work for your system, the important options are:

a) boot=<path> This is the path to the dev node of the device (vanilla LILO doesn't accept such names with a colon in them!) LILO will be installed on.
b) image=<path> This is the path to the kernel image relative to root LILO is working with.
c) initrd=<path> Same thing for initial ram disk
d) There are other important options, but without these 3 properly set (or 2 if you don't use the initrd) you ain't go nowhere.

2) Set up the USB stick, as root:

1. mount <your-usbstick-devnode> <usbstick-mountpoint> # mounting your flash drive
2. mkdir <usbstick-mountpoint>/dev && mount --bind /dev <usbstick-mountpoint>/dev # installing and populating /dev
3. mkdir <usbstick-mountpoint>/boot # Not sure if that is necessary, but never hurts
4. cp <path-to-your-config> <usbstick-mountpoint>/<path-to-your-config-on-the-mp> # store the config

3) Run lilo map and bootsector writer: lilo -C /<path-to-your-config-on-the-mp> -r <usbstick-mountpoint>

If you don't get any errors here, you are good to go. Warnings about lba32 assumed (it's most probably what you want) or complaining that your device is not on the first disk can most probably be ignored.

4) Clean up:

1. rm <usbstick-mountpoint>/<path-to-your-config-on-the-mp>
2. umount <usbstick-mountpoint>/dev && rmdir <usbstick-mountpoint>/dev

5) Unmount your ready-to-boot USB stick: umount <usbstick-mountpoint>

You are done! Have fun!

Footnote: if you want to understand more about what's happening, try to pass -v <number> (e.g -v 3) switch to the lilo. IIRC LILO pays attention to the verbosity level up to 6. Also LILO has awesome documentation (kinda old, but still pretty relevant) provided with its distribution, you may want to have a look at that.

lilo.txt · Last modified: 2025/06/01 07:56 by me