System Startup
System Startup covers the path from firmware through the boot loader and kernel to PID 1, plus the targets and recovery modes an administrator uses when normal boot fails.
Boot loader and targets
- Firmware loads the boot loader, which loads kernel and initramfs; the kernel then starts init or systemd.
- GRUB 2 configuration is generated:
/boot/grub/grub.cfgon Debian,/boot/grub2/grub.cfgon RHEL. Edit/etc/default/gruband/etc/grub.d/, then runupdate-gruborgrub2-mkconfig -o /boot/grub2/grub.cfg. GRUB_CMDLINE_LINUXadds kernel parameters;GRUB_DEFAULTselects the default entry;grub-installwrites the boot loader to disk.- systemd targets replace runlevels:
multi-user.target,graphical.target,rescue.target,emergency.target. Usesystemctl get-defaultandset-default. systemd.unit=rescue.target,init=/bin/bash, and RHEL'srd.breakare recovery paths with different mount states.
Worked example
Make a serial console permanent: add console=ttyS0,115200 to GRUB_CMDLINE_LINUX in /etc/default/grub, run grub2-mkconfig -o /boot/grub2/grub.cfg, then reboot. Reasoning: the generated grub.cfg is recreated from /etc/default/grub and /etc/grub.d; editing grub.cfg directly survives only until the next regeneration. Confirm the running command line in /proc/cmdline.
Traps
- Editing
grub.cfginstead of the source files. - Forgetting
grub-installafter replacing a disk. - Confusing rescue (root password, local filesystems mounted) with emergency (read-only root, minimal services).
- Expecting
/etc/inittabto control systemd.