LILO (LInux LOader) Configuration 11.. PPuurrppoossee _L_i_n_u_x can boot using different mechanisms. Booting involves reading and placing in memory a kernel file (often called zImage or vmlinuz), then executing it. While this sounds simple, there are always some quirks to deal with. This is why booting an Operating System is a sort of ``black art.'' Unlike many boot loaders shipped with some other commercial OSs, _L_I_L_O is fully documented and is by far one of the most versatile loaders. We will first describe what is involved, and then tell you what can be done with all of it. 22.. LLIILLOO pprriinncciipplleess Without getting too deep, let's just explain what booting a PC entails. 22..11.. TThhee FFiirrsstt IInnhhaabbiittaanntt:: tthhee BBIIOOSS When a PC starts, the first program to load is the _B_I_O_S, which is resident in _R_O_M. After initializing most hardware in your PC, it attempts to load a tiny program. Normally, this program is either located in the first sector of the floppy or the first sector of the first hard drive. This program is called the _M_a_s_t_e_r _B_o_o_t _R_e_c_o_r_d or _M_B_R for short. 22..22.. FFrroomm tthhee MMBBRR ooff tthhee hhaarrdd ddrriivvee ttoo tthhee OOSS The _M_B_R of the hard drive, using the BIOS, does one of two things. The first possibility (like the MBR included with DOS) is that it locates the active partition and loads the first sector of _t_h_a_t partition. This sector contains a tiny program, which knows a little more about the internals of the _O_S living in that partition. It will proceed to load either basic components of the system or a more sophisticated boot loader which will finish the job of booting. Alternatively, the MBR of the hard drive can load information directly from one of the partitions, and use that to load an OS on any partition. LILO can be configured this way. The OS/2 boot loader and Partition Magic are two other well-known bootloaders, that do the same thing. 22..33.. TThhee ffllooppppyy''ss bboooott sseeccttoorr The boot sector of a floppy may be compared to the boot sector of the active partition. It normally proceeds to load the OS living on the floppy. 22..44.. AAnndd LLIILLOO _L_I_L_O is fairly flexible, and here's why. +o It can be installed either as a replacement for the _M_B_R or as the boot sector of a partition. Then, it can still boot _L_i_n_u_x and most other OS's from any partition on any drive. +o It can be installed on the boot sector of the floppy and still perform its normal task, booting almost anything on the hard drive(s). +o Beside the boot sector, LILO has no hidden files, nor does it use any special partition. Furthermore, its configuration files can be installed in any partition, even those partitions unrelated to _L_i_n_u_x (like a subdirectory of a _D_O_S partition). +o It can boot several different kernel configurations and/or different kernels. +o It can boot more than one _L_i_n_u_x installation. +o It can boot Linux on any drive. 22..55.. LLIILLOO,, LLiinnuuxx,, aanndd tthhee wwoorrlldd When installing _L_i_n_u_x on a system with several OS's (besides _L_i_n_u_x), use this rule of thumb: install and configure booting for all the other OS's first. They are typically less flexible. It will then be easier to set up LILO to boot all the other OS's. 33.. LLIILLOO ccoonnffiigguurraattiioonn ddiiaalloogg Now that you know a little more of what _L_I_L_O can do, let's see how you can configure it using _L_i_n_u_x_c_o_n_f. The main configuration dialog is split into sections. Here is an introduction to each section. 33..11.. GGlloobbaall ffeeaattuurreess This section deals with how to install _L_I_L_O. 33..11..11.. DDiissaabblliinngg LLIILLOO If you boot your _L_i_n_u_x system without _L_I_L_O, you may find _L_i_n_u_x_c_o_n_f a little annoying as it tries to make sure _L_I_L_O is properly set up. You can disable _L_I_L_O support from _L_i_n_u_x_c_o_n_f at any time. However, this only affects _L_i_n_u_x_c_o_n_f. This does nothing else. It won't UN-install _L_I_L_O. It just says ``stop checking LILO'' to _L_i_n_u_x_c_o_n_f. 33..11..22.. IInnssttaallll bboooott sseeccttoorr oonn _L_I_L_O is brought to life at boot time by running a tiny program, called the bboooott sseeccttoorr. This program must be installed in a strategic location. The pop-up list of this field offers you a list of choices in order of preference. If _L_i_n_u_x is the aaccttiivvee partition, it does not matter much. If it is not, or your _L_i_n_u_x partition is not on the first hard drive, you must install the boot sector either on the master boot record of the first drive, or on a boot floppy. Note that installing the boot sector on a boot floppy is still quite fast, because it only needs to read one sector. All other files still live in the _L_i_n_u_x partition on your hard drive. If you have another boot manager (i.e. _O_S_/_2 _b_o_o_t _m_a_n_a_g_e_r, or Partition Magic), then a safe choice is to install the boot sector in the Linux partition. However, you will have to tell your other boot manager about this new partition. The _O_S_/_2 _b_o_o_t _m_a_n_a_g_e_r can boot (as LILO does) Linux, even if it is located on a second hard drive (not the primary one). 33..11..33.. BBIIOOSS bboooott mmooddee Known to boot faster. Known not to work on some machines. 33..11..44.. BBoooott ttaabbllee eennccooddiinngg LILO creates a table which lets the boot loader locate the kernel files. This encoding is either done as track/head/sector or as a linear block number. With some SCSI controllers, the first strategy does not work. If you experience this, try to use the linear mode. Most modern computers work fine when you use a linear block number. 33..11..55.. PPrreesseenntt tthhee LLIILLOO pprroommpptt With this option, LILO will show its prompt. This option is on by default. LILO boot: From there you can +o Boot a different OS or a different configuration +o Pass boot-time parameters to the kernel At the prompt, you may select a configuration by pressing the key to get a list of configurations. Type the label of a configuration or simply hit the key to select the default configuration. If you need to pass boot-time parameters to the kernel, you will need to type the name of the configuration first, even if it is the default configuration. 33..11..66.. PPrroommpptt ttiimmeeoouutt Without a timeout, LILO will wait forever at the prompt. You can specify a timeout, after which, LILO will automatically boot the default configuration. The default timeout is 5 seconds. 33..11..77.. BBoooott ddeellaayy LILO may boot immediately or it may wait some time before presenting the LILO boot prompt, provided it is so configured. Alternatively, LILO may display the prompt while booting if it is configured to show it. During this wait, you can intercept the boot sequence by hitting Shift-Tab. LILO will then present you with its normal boot: prompt. If you disable the prompt, a boot delay of 5 seconds is recommended. Entering 0 disables this delay. 33..11..88.. MMeessssaaggee ffiillee You must put the path to a text file. Ideally, the text will be short and fill the screen, leaving the _L_I_L_O prompt at the bottom. This is used for the boot floppies of some distributions. You can use it, for example, to give boot instructions to users in a lab or to family members who might not remember which keys to press. 33..22.. DDeeffaauullttss This section provides the default configuration, which Linuxconf applies to different _L_i_n_u_x configuration entries. Entering information here allows you to avoid entering it repeatedly later. 33..22..11.. RRoooott ppaarrttiittiioonn You must set where your _L_i_n_u_x root partition is located. A pop-up list gives you a list of all partitions. 33..22..22.. RRAAMM ddiisskk ssiizzee RAM disks are used for installation boot disks. They are seldom used for full configurations. The recent development of kernel modules has made RAM disk runtime configurable. A value of 0 disables the RAM disk feature. 33..22..33.. BBoooott mmooddee:: rreeaadd oonnllyy?? Normally, this flag is on. For _U_M_S_D_O_S installation, it is off. _U_M_S_D_O_S installation will generally use _l_o_a_d_l_i_n to boot instead of _L_I_L_O anyway. Unless you really know what you're doing, leave it on. This is why: when _L_i_n_u_x boots in read-only mode, it is allowed to do extensive inspections of the partitions without modifying them. This is especially valuable, if the boot follows a crash that has left the partitions in a weird state. Why all the fuss about not touching the partition? Well, _L_i_n_u_x supports multiple time stamps per file. One is the ``last access date.'' This means that the filesystem has changed (data has been written to the disk) because the files have been read (which is exactly what happens at boot time). This "last access date" stamp is quite useful, but it becomes a nuisance at boot time. The "read only" setting tells _L_i_n_u_x to drop this behavior. After the partition has been checked, the system will be set back to "read write" mode automatically. 33..22..44.. BBoooott ooppttiioonnss Some drivers require information to correctly initialize themselves. For example, some CD-ROM drives do not correctly identify themselves. In order to tell Linux to consider your "rather broken" CD-ROM drive as a CD-ROM drive, you might need something like this: hdc=cdrom This will tell Linux that the master IDE device on the second IDE interface (that is, /dev/hdc) is a CD-ROM device. 33..33.. LLiinnuuxx sseettuuppss The default section is followed by several identical sections. Each sections defines one _L_i_n_u_x boot configuration. Each boot configuration repeats all the parameters of the default section. You can simply override them in each section if you wish to change them. The first configuration will be the default. This means that _L_I_L_O will boot this one unless told differently at the boot: prompt. Only three fields differ from the default section. 33..33..11.. DDeelleettee tthhiiss ccoonnffiigguurraattiioonn If you check this box, the configuration will disappear when you hit the accept button. 33..33..22.. KKeerrnneell iimmaaggee ffiillee This is the path to the kernel file, which boots with this configuration. Note that one kernel file may be used within several configurations. 33..33..33.. LLaabbeell This is a short name uniquely identifying the configuration. Given that a kernel file may be shared by several configurations, we need a unique key. This will be used when intercepting the boot process. _L_I_L_O only expects a label name and will boot the corresponding configuration. 33..44.. OOtthheerr ooppeerraattiinngg ssyysstteemmss _L_I_L_O is able to boot almost any OS. For each OS you want to boot, simply specify the partition and a label. Then _L_I_L_O simply loads the boot sector of that partition and launches it. 44.. MMoovviinngg LLIILLOO ccoonnffiigguurraattiioonn ffiilleess Sometimes, one must play with _L_I_L_O configuration files. The good news is that (1) they are movable and (2) you can tell Linuxconf about it. Just go to the "List all configuration files" menu, scroll to the /etc/lilo.conf line and select the edit button. Enter the new path of the _L_I_L_O configuration file. Be aware that _L_I_L_O expects to find its configuration file in /etc/lilo.conf. When moving the file, it has to go to a subdirectory holding an etc subdirectory in which you will place the file lilo.conf (for example: /mnt/tmp/etc/lilo.conf). 44..11.. WWhhyy mmoovvee LLIILLOO aannyywwaayy?? There are different reasons why one would want to do this. Here are some of those reasons: +o Your hard drive has more that 1024 cylinders and the root partition goes beyond the 1024th cylinder. _L_I_L_O uses the BIOS to load the kernel files (among other things). If the kernel file lies above the 1024 cylinder limit, _L_I_L_O won't be able to boot properly. LILO will tell you this at install time. +o Your root partition is located on the third or fourth hard drive and your BIOS (again) is too old and does not know about this second IDE channel. In this case, LILO will warn you at install time that your BIOS can't access the drive. At boot time, you will get a bunch of errors. On the other hand, some distributions properly install all the files needed for booting in a /boot directory, which is kept in a separate partition, if your root directory is not entirely below the 1024 cylinder mark. In that case, you are not likely to need to move LILO at all. 44..22.. HHooww ttoo mmoovvee?? AAnndd wwhheerree?? On a machine dedicated to Linux, where you have a large drive with more than 1024 cylinders, many people will create a smaller partition for the basic OS and a larger for the data, insuring that all LILO files fits under the 1024 cylinder limit. This is often annoying as it makes management more complex. You end up with two partitions partly filled. Another solution is to create a very small partition (a few megs) at the beginning of the disk and reserve that for _L_I_L_O configuration and kernel files. In this way, you can create a single large root partition which is easier to manage. (One can argue that creating a single large partition is a bad idea as it puts "all the eggs in the same basket." Given the design of the EXT2 filesystem, which distributes management information all over the partition, with replication, I doubt this applies anymore). So you have a partition which fits the bill. It is all accessible from the BIOS? Here are the steps to follow. Suppose this partition is mounted under the lilo directory and you want to put all the configuration files in the root of this partition. +o mkdir /lilo/etc +o cp /etc/lilo.conf /lilo/etc/lilo.conf +o mkdir /lilo/boot +o cp /boot/* /lilo/boot +o cd / +o tar cf - dev | (cd /lilo && tar xvf -) +o cp /vmlinuz /lilo You can activate this moved configuration like this /sbin/lilo -r /lilo And you can do this with Linuxconf by telling it the /etc/lilo.conf is now /lilo/etc/lilo.conf. From now on, using Linuxconf, this should be completely invisible to you or whoever manages your machine. 55.. AAlltteerrnnaattiivveess ttoo LLIILLOO _L_i_n_u_x can be booted from a plain floppy or using loadlin. All this is unrelated to _L_I_L_O but it is good to know. Assuming your _L_i_n_u_x root partition is /dev/hdaX... 55..11.. UUssiinngg aa ffllooppppyy To create a simple boot floppy, just do +o cp zImage /dev/fd0 +o rdev /dev/fd0 /dev/hdaX +o rdev -R /dev/fd0 1 55..22.. UUssiinngg llooaaddlliinn To boot with loadlin (a _D_O_S program), just copy the kernel file to your _D_O_S partition and type, at the _D_O_S prompt: loadlin zimage root=/dev/hdaX ro