Difference between revisions of "Installing LILO"
Kyoungmeyer (talk | contribs) |
|||
Line 1: | Line 1: | ||
{{todo|Complete (12.16.13-03:15->MD+);(12.16.13-12:50->MD);(12.16.13-13:40->MD);(12.16.13-13:45->MW+);(12.16.13-18:20->KY+)|Mike Dean|project=oe 4,oe 5,md,Complete,mw,ky}} | {{todo|Complete (12.16.13-03:15->MD+);(12.16.13-12:50->MD);(12.16.13-13:40->MD);(12.16.13-13:45->MW+);(12.16.13-18:20->KY+)|Mike Dean|project=oe 4,oe 5,md,Complete,mw,ky}} | ||
− | == | + | ==Introduction== |
LILO can be installed onto a disk for use by the local machine, or it can be installed onto a removable storage device for use in booting on a different machine. Both installation methods are discussed here. Usually, the former method will be used to update the existing bootloader for new kernels, new kernel configurations, or new boot time options. The latter method is generally used to initially set up a bootable storage device which is intended to be inserted into an embedded system for which it is being created. | LILO can be installed onto a disk for use by the local machine, or it can be installed onto a removable storage device for use in booting on a different machine. Both installation methods are discussed here. Usually, the former method will be used to update the existing bootloader for new kernels, new kernel configurations, or new boot time options. The latter method is generally used to initially set up a bootable storage device which is intended to be inserted into an embedded system for which it is being created. | ||
− | + | ==Installing Onto the Local Machine== | |
− | Before LILO can be used to boot a system, it must be installed onto the boot device. It must also be reinstalled any time the | + | Before LILO can be used to boot a system, it must be installed onto the boot device. It must also be reinstalled any time the kernel is changed. |
− | + | The easiest way to install LILO onto the system's Master Boot Record, using the default configuration file (<code>/etc/lilo.conf</code>), is run lilo on the target device: | |
− | The easiest way to install LILO onto the | ||
root@oe:/# lilo | root@oe:/# lilo | ||
− | This method works well | + | This method works well when the default configuration can be used. Many times, an alternate configuration will be used so that a breaking change to a known-good configuration file will not leave the system without a usable configuration file. If a configuration file in an alternate location needs to be used, it will have to be specified to lilo with the -C option: |
root@oe:/# lilo -C /etc/alternate_lilo_configuration_file.conf | root@oe:/# lilo -C /etc/alternate_lilo_configuration_file.conf | ||
Line 19: | Line 18: | ||
The <code>-C</code> (capital C) switch tells <code>lilo</code> to use the configuration file specified after the switch when installing itself. | The <code>-C</code> (capital C) switch tells <code>lilo</code> to use the configuration file specified after the switch when installing itself. | ||
− | + | ==Installing LILO Onto a Removable Drive== | |
− | The | + | The method shown above is used on a running embedded system. Additional steps are required when the root filesystem is on a Compact Flash card inserted into a Linux PC. This method is usually necessary when there isn't already a bootable disk for the embedded machine. |
+ | <cl> | ||
+ | 1. Determine the device node of the Compact Flash card by using <code>dmesg</code>. | ||
− | + | user@ldc:~/# dmesg | tail -n 15 | |
+ | ... | ||
+ | [126468.154762] sd 6:0:0:0: [sdb] 7831152 512-byte logical blocks: (4.00 GB/3.73 GiB) | ||
+ | [126468.182196] sdb: sdb1 | ||
+ | [126468.688061] kjournald starting. Commit interval 5 seconds | ||
+ | [126468.691223] EXT3-fs (sdb1): using internal journal | ||
+ | [126468.691225] EXT3-fs (sdb1): recovery complete | ||
+ | [126468.694526] EXT3-fs (sdb1): mounted filesystem with ordered data mode | ||
+ | [173828.541718] sdb: detected capacity change from 4009549824 to 0 | ||
+ | [179577.977554] sd 6:0:0:0: [sdb] 7831152 512-byte logical blocks: ('''4.00 GB/3.73 GiB''') | ||
+ | [179577.994839] '''sdb:''' '''sdb1''' | ||
+ | [179578.376157] kjournald starting. Commit interval 5 seconds | ||
+ | [179578.381428] EXT3-fs (sdb1): using internal journal | ||
+ | [179578.381433] EXT3-fs (sdb1): recovery complete | ||
+ | [179578.384661] EXT3-fs (sdb1): mounted filesystem with ordered data mode | ||
− | + | * The device node <code>sdb</code> was created for the flash card with one partition <code>sdb1</code>(in this example). Also note that <code>sdb</code> reports a size of 4.00 GB which corresponds to the size of the card inserted. | |
− | + | * Determine if the card was automatically mounted to the desktop's filesystem. Problems have been identified when running lilo on an automounted device. The best way to avoid problems later in the process is to unmount and manually remount the device. | |
− | + | <syntaxhighlight lang="console"> | |
− | + | developer@ldc:~$ mount | grep sdb1 | |
− | + | /dev/sdb1 on /media/EMAC-OE type ext3 (rw,nosuid,nodev,uhelper=udisks) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | * | + | |
+ | * If there is no output from this command, continue with step 3. Otherwise follow the next step to unmount the device. | ||
+ | |||
+ | user@ldc:~/# umount /dev/sdb1 | ||
+ | |||
+ | * Now mount the card so that it's contents can be accessible to the desktop. First create a mount point (directory) if one does not exist, then issue the <code>mount</code> command. | ||
+ | |||
+ | <syntaxhighlight lang="console"> | ||
user@ldc:~/# sudo su | user@ldc:~/# sudo su | ||
[sudo] password for user: | [sudo] password for user: | ||
Line 55: | Line 62: | ||
root@ldc:~/# | root@ldc:~/# | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
* Bind mount the device nodes into the filesystem so that LILO will be able to communicate with the flash card: | * Bind mount the device nodes into the filesystem so that LILO will be able to communicate with the flash card: | ||
root@ldc:~/# cd /mnt/cfcard | root@ldc:~/# cd /mnt/cfcard | ||
Line 60: | Line 68: | ||
root@ldc:/mnt/cfcard# | root@ldc:/mnt/cfcard# | ||
− | * <code>chroot</code> into the filesystem: | + | * <code>chroot</code> into the filesystem on the Compact Flash card: |
root@ldc:/mnt/cfcard# chroot . | root@ldc:/mnt/cfcard# chroot . | ||
− | + | bash-3.2# | |
− | * | + | * Inspect the configuration file that will be used when running lilo e.g. lilo.conf.boot. Make sure that the <code>root=/dev/xxx</code> and <code>disk=/dev/xxx</code> lines point to the correct device node that the Compact Flash card is mounted on (in this example, <code>/dev/sdb</code>). If these lines point to the desktop hard drive, the system bootloader will be overwritten and cause the desktop to be unbootable See [[Configuring LILO]] for more information. |
− | + | ||
+ | * Run <code>lilo</code> with the appropriate LILO configuration file. | ||
+ | |||
+ | <syntaxhighlight lang=console> | ||
+ | bash-3.2# lilo -C /etc/lilo.conf.boot | ||
Warning: '/proc/partitions' does not exist, disk scan bypassed | Warning: '/proc/partitions' does not exist, disk scan bypassed | ||
Added emac-oe * | Added emac-oe * | ||
One warning was issued. | One warning was issued. | ||
− | + | bash-3.2# | |
− | Note that the warning here is normal, because LILO is being installed inside a chroot which doesn't have a mounted <code>/proc</code> virtual filesystem. | + | </syntaxhighlight> |
+ | |||
+ | * Note that the warning here is normal, because LILO is being installed inside a chroot which doesn't have a mounted <code>/proc</code> virtual filesystem. | ||
+ | |||
* Exit the chroot and unmount the device: | * Exit the chroot and unmount the device: | ||
− | + | ||
+ | bash-3.2# exit | ||
root@ldc:/mnt/cfcard# cd .. | root@ldc:/mnt/cfcard# cd .. | ||
− | root@ldc:/mnt# umount cfcard | + | root@ldc:/mnt# umount cfcard/dev/ |
+ | root@ldc:/mnt# umount cfcard/ | ||
* It is now safe to remove the flash card and put it into the embedded machine. | * It is now safe to remove the flash card and put it into the embedded machine. | ||
</cl> | </cl> | ||
− | == | + | ==Next Steps== |
− | + | * [[Configuring LILO]] | |
− | |||
− | |||
− | |||
− | |||
− | * | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ==See Also== | |
− | |||
− | |||
− | + | [http://lilo.alioth.debian.org/olddoc/html/user_21-5.html Lilo User Guide] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 13:11, 19 December 2013
Contents
Introduction
LILO can be installed onto a disk for use by the local machine, or it can be installed onto a removable storage device for use in booting on a different machine. Both installation methods are discussed here. Usually, the former method will be used to update the existing bootloader for new kernels, new kernel configurations, or new boot time options. The latter method is generally used to initially set up a bootable storage device which is intended to be inserted into an embedded system for which it is being created.
Installing Onto the Local Machine
Before LILO can be used to boot a system, it must be installed onto the boot device. It must also be reinstalled any time the kernel is changed.
The easiest way to install LILO onto the system's Master Boot Record, using the default configuration file (/etc/lilo.conf
), is run lilo on the target device:
root@oe:/# lilo
This method works well when the default configuration can be used. Many times, an alternate configuration will be used so that a breaking change to a known-good configuration file will not leave the system without a usable configuration file. If a configuration file in an alternate location needs to be used, it will have to be specified to lilo with the -C option:
root@oe:/# lilo -C /etc/alternate_lilo_configuration_file.conf
The -C
(capital C) switch tells lilo
to use the configuration file specified after the switch when installing itself.
Installing LILO Onto a Removable Drive
The method shown above is used on a running embedded system. Additional steps are required when the root filesystem is on a Compact Flash card inserted into a Linux PC. This method is usually necessary when there isn't already a bootable disk for the embedded machine.
-
Determine the device node of the Compact Flash card by using
dmesg
.user@ldc:~/# dmesg | tail -n 15 ... [126468.154762] sd 6:0:0:0: [sdb] 7831152 512-byte logical blocks: (4.00 GB/3.73 GiB) [126468.182196] sdb: sdb1 [126468.688061] kjournald starting. Commit interval 5 seconds [126468.691223] EXT3-fs (sdb1): using internal journal [126468.691225] EXT3-fs (sdb1): recovery complete [126468.694526] EXT3-fs (sdb1): mounted filesystem with ordered data mode [173828.541718] sdb: detected capacity change from 4009549824 to 0 [179577.977554] sd 6:0:0:0: [sdb] 7831152 512-byte logical blocks: (4.00 GB/3.73 GiB) [179577.994839] sdb: sdb1 [179578.376157] kjournald starting. Commit interval 5 seconds [179578.381428] EXT3-fs (sdb1): using internal journal [179578.381433] EXT3-fs (sdb1): recovery complete [179578.384661] EXT3-fs (sdb1): mounted filesystem with ordered data mode
-
The device node
sdb
was created for the flash card with one partitionsdb1
(in this example). Also note thatsdb
reports a size of 4.00 GB which corresponds to the size of the card inserted.
-
-
Determine if the card was automatically mounted to the desktop's filesystem. Problems have been identified when running lilo on an automounted device. The best way to avoid problems later in the process is to unmount and manually remount the device.
developer@ldc:~$ mount | grep sdb1 /dev/sdb1 on /media/EMAC-OE type ext3 (rw,nosuid,nodev,uhelper=udisks)
-
If there is no output from this command, continue with step 3. Otherwise follow the next step to unmount the device.
user@ldc:~/# umount /dev/sdb1
-
-
Now mount the card so that it's contents can be accessible to the desktop. First create a mount point (directory) if one does not exist, then issue the
mount
command.user@ldc:~/# sudo su [sudo] password for user: root@ldc:~/# mkdir -p /mnt/cfcard root@ldc:~/# mount /dev/sdb1 /mnt/cfcard root@ldc:~/#
-
Bind mount the device nodes into the filesystem so that LILO will be able to communicate with the flash card:
root@ldc:~/# cd /mnt/cfcard root@ldc:/mnt/cfcard# mount --bind /dev dev/ root@ldc:/mnt/cfcard#
-
chroot
into the filesystem on the Compact Flash card:root@ldc:/mnt/cfcard# chroot . bash-3.2#
-
Inspect the configuration file that will be used when running lilo e.g. lilo.conf.boot. Make sure that the
root=/dev/xxx
anddisk=/dev/xxx
lines point to the correct device node that the Compact Flash card is mounted on (in this example,/dev/sdb
). If these lines point to the desktop hard drive, the system bootloader will be overwritten and cause the desktop to be unbootable See Configuring LILO for more information. -
Run
lilo
with the appropriate LILO configuration file.bash-3.2# lilo -C /etc/lilo.conf.boot Warning: '/proc/partitions' does not exist, disk scan bypassed Added emac-oe * One warning was issued. bash-3.2#
-
Note that the warning here is normal, because LILO is being installed inside a chroot which doesn't have a mounted
/proc
virtual filesystem.
-
-
Exit the chroot and unmount the device:
bash-3.2# exit root@ldc:/mnt/cfcard# cd .. root@ldc:/mnt# umount cfcard/dev/ root@ldc:/mnt# umount cfcard/
-
It is now safe to remove the flash card and put it into the embedded machine.