Linux System Administration: Using LILO, The Linux Loader
In general, the boot process on a microcomputer has three stages: the system's master boot record (MBR) contains the primary boot program which starts the boot process and loads a secondary boot program from the boot blocks of the active partition; this second boot program is what loads the actual kernel.
Linux provides LILO, the Linux Loader, which can function as either a master boot program or a secondary boot program. lilo is installed with a command like this one:
# lilo -C /etc/lilo.conf
The -C option specifies the location of LILO's configuration file. (The location in the preceding command is, in fact, the default location, and so the -C clause is redundant.)
The lilo.conf file specifies LILO's behavior for certain aspects of the boot process and also defines the kernels and operating systems that it can boot. The following excerpt from a lilo.config file lists the most important entries—and the ones that you are most likely to want or need to modify:
# Wait 10 seconds before autobooting 1st entry.timeout=100 # Allow user to enter a boot command. prompt # Where to install/configure LILO # (no partition #=MBR) [see below] boot=/dev/hda ... # Text file displayed before boot prompt. message = /boot/boot.message # # Default kernel is the first one listed. image = /vmlinuz # Boot prompt command to boot this kernel. label = linux # Fix for Sony CD-ROM (post 1.1.72) # Specifies parameters to pass to kernel, # changing CD-ROM's compiled-in I/O address. append = "cdu31a=0x340,0," # # An alternate Linux kernel image = /safe # Its boot command label = safe append = "cdu31a=0x340,0," ... # A different operating system (DOS) other = /dev/hdb1 # Use the D: drive boot loader. loader = /boot/any_d.b # Use this partition table. table = /dev/hdb # This is the corresponding boot command. label = ddog
[I tend to install LILO both in the MBR and the Linux partition for maximum flexibility, by running a second LILO command using its -b option (which replaces the boot entry in the configuration file):# lilo -b /dev/hda1 -C /etc/lilo.confThis way, if I decide to remove LILO from the MBR, I'll be all set to switch over to the Linux partition version.]
The final section (“stanza”) illustrates the format for booting a DOS partition on the second hard disk; it uses an alternate loader, any_d.b, which tricks DOS into thinking it's on the C: drive. There are also loaders provided for OS/2 on the D: drive and DOS on the B: drive (os2_d.b and any_b.d, respectively; chain.b is the default loader for other operating systems).
If the label for a stanza is omitted, it defaults to the final component of the image or other entry (for example, vmlinuz or hda1).
The entry for a DOS partition on the C: drive is simpler, looking something like this:
other = /dev/hda1 label = dos table = /dev/hda
This stanza is actually what you need for any foreign operating system on /dev/hda1. There is one additional trick needed if SCO Unix is the operating system you want to boot. In order for LILO to successfully boot a SCO Unix partition, that partition must be the only active partition on the C: drive. This means you will have to turn off the active (boot) flag on the Linux partition and turn it on for the SCO Unix partition, using the Linux fdisk or cfdisk, before trying to boot SCO Unix (in addition to running LILO to install the new configuration). Note that LILO must be the master boot loader in this case.
Note: You will need to rerun the LILO command to reinstall it every time you rebuild the kernel or change any relevant aspect of the disk partitioning scheme. If you forget to do this, the system will not boot and you'll have to boot from a floppy. You will also need to rerun LILO if you change the text of the boot.message file.
Booting a Linux partition on the second hard drive is also possible. For this to work, LILO must be installed in the MBR of the system's boot disk, as well as the secondary boot program in the Linux partition itself—this is usually taken care of when you install Linux on the hard disk and will be assumed in what follows. In this case, the best way to proceed is in two stages:
First, set up a lilo.conf like this one:
boot=/dev/hdaroot=current image=/vmlinuz label=linux other=/dev/hda1 unsafe other=/dev/hda2 unsafe ... other=/dev/hdb4 unsafe
Define all of the partitions on both hard disks in the same way; the unsafe keyword tells LILO not to read the boot blocks or the disk's partition table for that entry—it basically says, “Trust me and do what I tell you.” Install this LILO configuration, and make sure that Linux is bootable.
Then, modify the file, changing entries for any bootable partitions on /dev/hda to their correct form and removing ones you don't need, and rerun the LILO command.
It is also possible to boot a Linux partition on each of two disks. The procedure for doing so is the following:
Decide which one will be the usual Linux boot partition and set up LILO to boot it and any other non-Linux operating systems on both disks. Create an entry like the following for the second Linux partition:
other = /dev/hdb2 label=eviltwin unsafe
Create a boot.message file which tells you which Linux will be booted when you select the default option. Install this configuration into the MBR on the C: drive.
Create (or retain) another LILO configuration for the second Linux partition, this time including an unsafe entry for the first Linux partition if you want to (this again assumes that LILO is installed in that partition, which usually happens at upon installation of the OS). Make sure that this partition's boot.message file also lets you know where you are. Install this configuration into the Linux partition only—make sure that the boot entry specifies the partition and not the disk as a whole.
The boot sequence will then go something like this:
Welcome to gallant.Boot choices: linux (default; on C:), dos, eviltwin (Linux on D:), sco boot: eviltwin Welcome to goofus. Boot choices: test (default; on D:), goodtwin (Linux on C:) boot: [Return] Loading test...
Given these selections, Linux will boot from the D: drive. What happens is the LILO from the MBR on drive C: runs first, and it then starts the boot program on the Linux partition on the D: drive—which is again LILO. That (second) LILO then loads the kernel from the D: drive. (Note that if you wanted to, you could just keep popping back and forth between the LILO programs on C: and D: ad infinitum.)
If you think this is pretty silly, then omit the prompt keyword from the LILO configuration file for the D: drive (as well as its image section for the Linux partition on the C: drive), resulting in a simple lilo.conf file on the D: drive:
install=/boot/boot.bboot=/dev/hdb2 root=/dev/hdb2 map=/boot/map image=/vmlinuz label=linux
Once this is installed, selecting eviltwin at the initial boot prompt will immediately boot the Linux partition on the second hard disk.
|Free Today: September Issue of Linux Journal (Retail value: $5.99)||Sep 27, 2016|
|nginx||Sep 27, 2016|
|Epiq Solutions' Sidekiq M.2||Sep 26, 2016|
|Nativ Disc||Sep 23, 2016|
|Android Browser Security--What You Haven't Been Told||Sep 22, 2016|
|The Many Paths to a Solution||Sep 21, 2016|
- Free Today: September Issue of Linux Journal (Retail value: $5.99)
- Android Browser Security--What You Haven't Been Told
- Readers' Choice Awards 2013
- Epiq Solutions' Sidekiq M.2
- The Many Paths to a Solution
- Nativ Disc
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Synopsys' Coverity
- Securing the Programmer
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide