ITS 2320 - Linux II

Week 8, Chapter 5, Booting, Initializing, and Virtualizing Linux


This lesson discusses the events that happen when a Linux system boots up.. Objectives important to this lesson:

  1. Boot process
  2. Boot loaders and managers
  3. Linux as a virtual machine

This chapter is about three main topics. In case it bothers anyone, the author is not presenting topics in order given at the beginning of each chapter. The order of topics in the actual text is one the author considers more logical.

The first topic discussed in the chapter is the boot process.

  1. The boot process normally begins with a power on self test (POST) in which the hardware information stored in firmware (BIOS/UEFI) is compared to the components the computer can see. A beep code is issued (noting success or a problem) and the system looks for a bootloader program in the locations listed as boot devices.
  2. Once the bootloader is found, it is run, and it locates the kernel of the installed Linux system.
  3. The kernel is loaded into RAM, and it mounts the root partition.
  4. The initialization process runs, calling other processes that are normal for the distro being used.

The text informs us that several messages produced by the boot process are only shown briefly, but they may be displayed again with the dmesg command. Well, maybe. This command displays the messages stored in the kernel ring buffer. The messages stored here are overwritten each time the system boots. It is called a ring buffer because it is a static size, and when it is full the oldest data in it is overwritten by the next data, and so on around the virtual ring. It only holds the last several messages so, if there are a lot of messages, the one you want to see may be gone.

It is also possible to see boot messages in log files:

  • Debian based systems often store log files in /var/log/boot
  • Red Hat based systems often use /var/log/boot.log.

The author spends a little space on the difference between BIOS and UEFI systems, and reminds us that some Linux distros do not support UEFI hardware. In my opinion, this is a good argument for selecting a distro that does support it, since BIOS hardware is becoming rare.

The text turns to boot order which allows us to put the possible boot devices for a given system in a preferred order. If first one is not available, the system will attempt to boot from the second one, and so on. The list on page 249 contains choices the may not be available on all systems, so you should make sure you select only real possibilities.

You will need to know that the three bootloaders you are likely to encounter are LILO, GRUB (Grub Legacy), and GRUB2. They are all bootloader programs, but each is has more features than the previous model.

  • LILO - Linux Loader, used in the 1990s, configuration file is /etc/lilo.conf; does not work with UEFI hardware, so the text mentions it but does not cover it
  • GRUB (Legacy) - Grand Unified Bootloader, created in 1999 to support UEFI; configuration file is /boot/grub/menu.lst; options are discussed in the text
  • GRUB2 - created in 2005, presents more options and recognizes external drives; global configuration file is /boot/grub/grub.cfg and separate boot files are stored in /etc/grub.d, one for each boot option

The next section of the text is about using GRUB, both GRUB Legacy and GRUB2. Installation and configuration are different, so we can assume that they will be different for each alternative bootloader that is developed in the future.

The video below discusses these concepts and adds a few details.

The text lists other bootloaders that you may see:

  • system-boot
  • U-Boot
  • SYSLINUX (which has several variants)

Note the variants that allow you to choose to load Windows and older versions of DOS.

After booting, the system needs to load its version of the init file. This is the initialization daemon that starts services. Older systems may load </p> (based on UNIX System V), but newer ones are more likely to use systemd. The init file may be in the /etc, /bin, or /sbin folders. It will be a link to the actual initialization daemon that the system starts.

If the init file is not found, the system will try to start /bin/sh, which is a default shell. The value of the init program is that it can start several other programs that the administrator has decided the computer needs to run on boot. It can call all of the batch files to start them simultaneously.

The text covers startup options using systemd in great detail. Note that you typically use the systemctl utility to configure what systemd starts. This is discussed in the following video from Eli the Computer Guy. This video covers most the the discussion about systemd.

The text presents a discussion about using SysVinit, but it recommends that you do not do so.

The text continues with a discussion about shutting down a Linux system, which is usually not an issue with virtual machines. Look it over, then move on.

There is a brief discussion of sending notifications to users, which was covered in Linux I. This should be review for you.

The chapter ends with about ten pages on running Linux in a virtual machine, which you have been doing for seven weeks so far in this course.