s
Many things go wrong on a Linux system. Often, if something goes wrong it is related to the startup of the server.

In this session of the Linux System administrator program, you'll learn about the startup procedure and how problems can occur and be fixed.

Intro to Troubleshooting the Boot Procedure:

·  We are going to learn about the different phases of the server startup procedure and how to fix them if something goes wrong

·  First, you'll learn how the server uses GRUB for booting.

·  GRUB is the boot loader that is installed on the bootable disk in your server

o  it takes care of starting the Linux kernel

o  Once successfully loaded, GRUB will start a kernel and all of the associated drivers

§  Once this is completed, Upstart is started

§  Upstart is responsible for starting all the services on your server

Schematic overview of the Linux boot procedure (RHEL):

Configuring Booting with GRUB:

·  When your server starts, it needs to know which OS to start

·  A boot loader is loaded for this purpose

·  On RHEL, the GRUB boot loader is used

·  On a standard installation, the first part of the boot loader program is installed in the master boot record, and from there the rest of the boot procedure is executed

Understanding the grub.conf Configuration File:

·  An important part of GRUB is the configuration file "/boot/grub/grub.conf"

Example Below:

·  The purpose of the GRUB is to load the kernel and the initial RAM file system

·  The kernel is the heart of the OS, which ensures that the hardware in the computer can be used.

·  The initial RAM file system contains modules that are needed by the kernel to access the file system and load other modules

o  to load the kernel and initial RAM file system, different sections can be included in "grub.conf"

o  only one section is used. . .which is defined in the line that starts with title Red Hat Enterprise Linux and the 3 lines beneath that one.

o  The first thing that happens in each section is that the root device is referenced

§  This is not the device that contains the root file system

§  it is the device that GRUB will use to find all the files that referenced in the "grub.conf" configuration file

§  the "root" device is referred to by its BIOS name, which in this example is "hd0,0"

·  this refers to the first partition on the first hard disk, which from the perspective of the kernel is known as "/dev/sda1"

o  GRUB has to use the BIOS name of the device because, at the initial boot stage when this file is read, the kernel name /dev/sda1 is unknown yet

o  Next the kernel is loaded on the line that starts with "kernel /vmlinuz....", and it is followed by a number of options that specify exactly how the kernel should be loaded

§  The name of the referenced file(/vmlinuz) is relative to the root that is defined in the first line. . this means it is obtained from the partition root of the device /dev/sda1

o  After specifying the name of the kernel, some kernel load options are specified

§  All options that appear in uppercase are variables that are passed to the "init"

§  If starting your server in troubleshooting mode, you can safely omit all these parameters

Boot parameters listed below:

·  There are many boot parameters you can use. For a complete overview, read the man page bootparam(7)

ro

This parameter indicates that the root file system should be mounted as read-only.

root=

This parameter specifies the name of the device that contains the root file system. On Red Hat Enterprise Linux, this is typically an LVM device.

quiet

This parameter hides the messages that are generated while booting. For better insight into what your server is doing when it boots, consider removing it.

rhgb

This parameter loads the Red Hat Graphical Boot, which displays a logo graphic when booting. Because this hides the messages that are generated while your server is booting, consider removing it.

The last parameter in the section that specifies what should be loaded indicates the name of the initial RAM file system. The parameter name is initrd, and the name of the file is initramfs. This line ensures that an automatically generated file is loaded, which contains all of the required hardware drivers to boot your server and also some important other drivers, such as the Ext4 file system driver.

Apart from the specific sections that specify which kernel to load, in grub.conf you'll also find a generic section that specifies how to load it. You will find the following parameters in the example file in Listing 19.1:

default

This specifies which of the proposed operating systems to load, and it refers to the sections that are defined below the generic section in grub.conf. In Listing 19.1, section 0 is referenced. This refers to the first (and only) section in the example listing.

timeout

During boot, the user can press Tab to open the GRUB menu and add or change kernel parameters. The timeout boot option is used to specify how much time a user has to get into the GRUB menu.

splashimage

This parameter refers to a file containing a graphical background, which is loaded while GRUB is displayed.

hiddenmenu

This option makes sure that no GRUB menu is shown while booting. To enter the GRUB menu, the administrator has to press the Enter key at the right moment.

·  Apart from the default options in the "grub.conf" menu, there are other options that can also be used

§  one of them is the GRUB password

§  using a password is a good choice when you want to add an extra layer of security to your system

§  By default, anyone with physical access to a server can open the GRUB menu and change the boot parameters

·  by using the GRUB password, you can restrict such modification only to users who have entered the correct password

§  To set a GRUB password, you first need to generate a password that is hashed with the MD5 hashing algorithm

·  This password is then included in the "grub.conf" configuration file using the password parameter in the general section of GRUB

·  Let's learn by completing the "Adding a GRUB Boot Password" exercise

Exercise:

·  Adding a GRUB Boot Password