Lesson
1.1 Objective review
The boot process
Every Linux boot follows the same chain. Knowing which stage owns which job is what most troubleshooting questions test.
- Firmware (BIOS or UEFI) runs the power-on self test, finds a boot device and loads the bootloader. UEFI reads an EFI executable from the EFI System Partition (a FAT32 partition, usually mounted at
/boot/efi); legacy BIOS reads the first 446 bytes of the MBR. - Bootloader (GRUB 2 on almost every distribution) shows the menu, then loads the kernel and the initial RAM disk into memory and passes the kernel its parameters.
- Kernel initializes hardware, mounts the initrd as a temporary root filesystem and runs its init program.
- initrd / initramfs contains just enough drivers and tools (storage, LVM, RAID, LUKS) to find and mount the real root filesystem, then hands over.
- init (PID 1, which is systemd on modern distributions) starts services and brings the system to its default target.
Bootloader configuration files
| File | Purpose |
|---|---|
/etc/default/grub |
The settings you edit: GRUB_TIMEOUT, GRUB_DEFAULT, GRUB_CMDLINE_LINUX (kernel parameters for every entry) |
/etc/grub.d/ |
Scripts that generate menu entries (40_custom for your own entries) |
/boot/grub2/grub.cfg (RHEL family) or /boot/grub/grub.cfg (Debian family) |
The generated file GRUB reads. Never edit it by hand |
After changing /etc/default/grub, regenerate the configuration with grub2-mkconfig -o /boot/grub2/grub.cfg (RHEL family) or update-grub (Debian family, a wrapper around grub-mkconfig). On RHEL family systems grubby changes kernel arguments directly, for example grubby --update-kernel=ALL --args="quiet".
Kernel parameters
The parameters the running kernel was booted with are in /proc/cmdline. Useful ones to know:
| Parameter | Effect |
|---|---|
ro / rw |
Mount root read only (then remounted by systemd) or read write |
root=UUID=... |
Which device holds the root filesystem |
quiet, rhgb, splash |
Fewer messages, graphical boot screen |
systemd.unit=rescue.target |
Boot to single user rescue mode (single or 1 also works) |
systemd.unit=emergency.target |
Minimal emergency shell, root mounted read only |
rd.break |
Stop inside the initramfs before root is switched (classic root password reset) |
init=/bin/bash |
Replace init with a shell |
To change parameters for one boot, press e at the GRUB menu, edit the linux line and press Ctrl+X. To make them permanent, edit GRUB_CMDLINE_LINUX and regenerate, or use grubby. Runtime kernel tunables (not boot parameters) are handled by sysctl, covered in objective 2.5.
PXE
Preboot Execution Environment boots a machine over the network with no local disk. The network card's firmware asks a DHCP server for an address; the DHCP reply includes the boot server (next-server) and boot file name, which the client downloads with TFTP, followed by the kernel and initrd. PXE is the usual first step of unattended installs (Kickstart, objective 4.1).
Filesystem Hierarchy Standard (FHS)
| Directory | Contents |
|---|---|
/ |
Root of the single directory tree |
/bin |
Essential user commands (ls, cp). On modern distributions a symlink to /usr/bin |
/sbin |
Essential system administration commands (fdisk, ip). Often a symlink to /usr/sbin |
/boot |
Kernel (vmlinuz-*), initramfs images and the GRUB directory |
/dev |
Device files (/dev/sda, /dev/null), managed by udev |
/etc |
Host specific configuration files, text only |
/home |
Users' home directories (root's home is /root) |
/lib |
Shared libraries and kernel modules (/lib/modules/<version>) |
/proc |
Virtual filesystem exposing kernel and process information (/proc/cpuinfo, /proc/<PID>) |
/tmp |
Temporary files, often cleared at boot and sometimes a tmpfs in RAM |
/usr |
Read only, shareable programs, libraries and documentation |
/var |
Variable data that grows: logs (/var/log), spools, caches, databases |
Related: /sys (virtual view of devices and drivers), /run (runtime data since boot, a tmpfs), /opt (add-on software), /srv (data served by this host), /mnt and /media (mount points).
/proc, /sys and /run exist only in memory. Files there are generated by the kernel when you read them, which is why ls -l /proc/cpuinfo shows a size of 0.
Server architectures
| Name | Notes |
|---|---|
| x86 | 32-bit Intel compatible (i386, i686). Mostly legacy |
| x86_64 / AMD64 | 64-bit extension of x86, designed by AMD. The most common server architecture |
| AArch64 | 64-bit ARM (also called ARM64). Low power, used by many cloud instances and single board computers |
| RISC-V | An open, royalty-free instruction set architecture based on reduced instruction set principles |
uname -m and lscpu show the architecture. Packages are built per architecture (for example x86_64, aarch64, or noarch for scripts and data), and Debian uses its own names such as amd64 and arm64.
Distributions
| Family | Package format and tools | Examples |
|---|---|---|
| RPM-based | .rpm; rpm, dnf (formerly yum), zypper on SUSE |
RHEL, Fedora, Rocky Linux, AlmaLinux, CentOS Stream, openSUSE, SLES |
| dpkg-based | .deb; dpkg, apt |
Debian, Ubuntu, Linux Mint |
Graphical user interface
- X server (X11, Xorg): the classic display server. Network transparent, so applications can display on a remote X server (X forwarding over SSH). The
DISPLAYvariable says which display to use. - Wayland: the modern replacement protocol. The compositor is the display server, which simplifies the stack and isolates applications from each other. XWayland runs X11 applications on it.
- Display manager: the graphical login screen that starts a session (GDM, SDDM, LightDM).
- Window manager: places and decorates windows (Mutter, KWin, Openbox, i3). A desktop environment such as GNOME or KDE Plasma bundles one with panels, settings and applications.
Servers normally run without a GUI and boot to multi-user.target; desktops boot to graphical.target.
Software licensing
| Term | Meaning |
|---|---|
| Open source | Source is available and the license meets the Open Source Definition (use, study, modify, redistribute) |
| Free software | The Free Software Foundation's four freedoms: run, study and change, redistribute, distribute modified copies. "Free as in freedom", not price |
| Proprietary | Source is closed; use is limited by an end user license agreement |
| Copyleft | Derivative works must be distributed under the same license (GNU GPL). Permissive licenses (MIT, BSD, Apache 2.0) let derivatives become proprietary |
The Linux kernel itself is licensed under GPL version 2.