Linux Boot Process 4 — Questions and Answers
Question 1: Which systemd command shows the time taken by each unit during the last boot?
- systemctl status --boot
- systemd-analyze blame (Correct answer)
- journalctl --time-sort
- bootctl status --timing
Correct answer: systemd-analyze blame
systemd-analyze blame lists units sorted by initialization time, useful for diagnosing slow boots.
Question 2: What is the function of the /etc/fstab file during the boot process?
- It defines the order in which services start
- It tells the kernel which modules to load
- It specifies filesystems to mount at boot (Correct answer)
- It lists valid login shells for users
Correct answer: It specifies filesystems to mount at boot
/etc/fstab defines filesystems and their mount points, mount options, and whether they should be checked/mounted at boot.
Question 3: Which GRUB2 command at the GRUB command prompt loads a Linux kernel file?
- boot /vmlinuz
- linux /boot/vmlinuz-<version> (Correct answer)
- kernel /vmlinuz
- load-kernel /boot/vmlinuz
Correct answer: linux /boot/vmlinuz-<version>
The 'linux' command in GRUB2 specifies the kernel image path and optional kernel parameters before booting.
Question 4: What happens when the Linux kernel detects a kernel panic during early boot?
- It automatically reboots after 30 seconds by default
- It halts and displays an error message, awaiting manual reboot (Correct answer)
- It switches to emergency.target
- It rolls back to the previous kernel automatically
Correct answer: It halts and displays an error message, awaiting manual reboot
By default a kernel panic halts the system and displays diagnostic info; automatic reboot on panic requires kernel.panic sysctl to be set.
Question 5: In UEFI booting, where does the firmware look for the bootloader by default?
- /boot/efi/EFI/BOOT/BOOTX64.EFI on the EFI System Partition (Correct answer)
- /boot/grub2/grub.cfg
- The first sector of the first hard disk
- /usr/lib/efi/grub.efi
Correct answer: /boot/efi/EFI/BOOT/BOOTX64.EFI on the EFI System Partition
UEFI firmware searches the EFI System Partition for a fallback bootloader at EFI/BOOT/BOOTX64.EFI on x86-64 systems.
Question 6: Which kernel ring buffer command shows hardware detection messages produced during boot?
- journalctl -k
- dmesg (Correct answer)
- lsmod --boot
- syslog --kernel
Correct answer: dmesg
dmesg reads the kernel ring buffer, which contains messages from kernel and driver initialization during boot.
Question 7: What is the purpose of 'switch_root' at the end of the initramfs phase?
- It changes the root password to a temporary one
- It pivots from the initramfs root to the real root filesystem (Correct answer)
- It switches the default runlevel
- It reloads kernel modules from the real root
Correct answer: It pivots from the initramfs root to the real root filesystem
switch_root replaces the initramfs as the root filesystem with the real root partition and executes /sbin/init on it.
Which systemd command shows the time taken by each unit during the last boot?