LPIC-1 Exam Objective: 101.2 Boot the System #
In this tutorial, we’ll cover the essential aspects of booting a Linux system, aligned with the LPIC-1 exam objective 101.2. We’ll explore common commands, the boot sequence, and various init systems, as well as how to check boot events in log files.
Key Knowledge Areas #
1. Common Commands to the Boot Loader and Kernel Options at Boot Time #
Boot Loader Commands #
The boot loader is the first software that runs after the BIOS/UEFI initializes the hardware. GRUB (GRand Unified Bootloader) is a common boot loader in many Linux distributions.
Accessing GRUB Menu: To access the GRUB menu, press the
Esc
,Shift
, orF2
key (depending on your system) during the boot process.Editing Boot Parameters: In the GRUB menu, highlight the desired entry and press
e
to edit boot parameters. You can add kernel options likesingle
for single-user mode ornomodeset
to disable kernel mode setting.
Kernel Options #
- Single User Mode: Useful for maintenance tasks, you can enter
single
or1
as a kernel parameter. - Recovery Mode: Similar to single-user mode but often includes additional recovery tools.
- Nomodeset: Disables kernel mode setting, useful for troubleshooting display issues.
- ro/rw: Specifies the root filesystem as read-only (
ro
) or read-write (rw
).
2. Boot Sequence from BIOS/UEFI to Boot Completion #
BIOS/UEFI Initialization #
- Power On Self Test (POST): The BIOS/UEFI performs hardware initialization and POST.
- Boot Device Selection: The BIOS/UEFI selects the boot device based on the configured boot order.
Bootloader Stage #
- Bootloader Execution: The bootloader (e.g., GRUB) is loaded from the boot device.
- Kernel Loading: The bootloader loads the Linux kernel and the initial RAM filesystem (
initramfs
).
Kernel and Init System #
- Kernel Initialization: The kernel initializes hardware and mounts the
initramfs
. - Init System Start: The init system (SysVinit, systemd, or Upstart) takes over to start user-space services.
3. Understanding of SysVinit and systemd #
SysVinit #
- Init Process: The
init
process (PID 1) reads the/etc/inittab
file to determine the system’s runlevel and starts the appropriate services. - Runlevels: SysVinit uses runlevels to define different modes of operation (e.g., 0 for halt, 1 for single-user mode, 3 for multi-user mode without GUI, 5 for multi-user mode with GUI).
systemd #
- Units and Targets: systemd uses units (service, socket, device, etc.) and targets (equivalent to runlevels) to manage system services.
- Key Commands:
systemctl status <service>
: Check the status of a service.systemctl start/stop/restart <service>
: Manage services.systemctl list-units --type=target
: List available targets.
4. Awareness of Upstart #
Upstart is an event-based init system used in older Ubuntu releases. It has been largely replaced by systemd but is still relevant in some systems.
- Key Concepts:
- Events: Upstart responds to events (e.g., starting/stopping a service).
- Job Configuration: Jobs are configured in
/etc/init
with.conf
files.
5. Checking Boot Events in Log Files #
- dmesg: Displays kernel ring buffer messages. Use
dmesg | less
to view the output. - journalctl: Used with systemd to view log messages. Use
journalctl -b
to view boot messages.
Partial List of Used Files, Terms, and Utilities #
- dmesg: Command to view kernel ring buffer messages.
- journalctl: Command to view systemd journal logs.
- BIOS/UEFI: Firmware interfaces for hardware initialization.
- bootloader: Software that loads the kernel (e.g., GRUB).
- kernel: Core of the operating system.
- initramfs: Initial RAM filesystem loaded by the kernel.
- init: The first user-space process started by the kernel.
- SysVinit: Traditional init system.
- systemd: Modern init system.
Conclusion #
Understanding the boot process is crucial for managing and troubleshooting Linux systems. This tutorial has covered the essential commands, boot sequence, init systems, and log file checks to help you master the LPIC-1 exam objective 101.2.