Domain 4Running SystemsCORE

Managing Boot Procedure

Guide to managing RHEL boot procedures, configuring Systemd targets, analyzing unit dependencies, and modifying GRUB 2 bootloader configurations.

Domain: Operate running systems•Updated: 2026-08-30
#Boot#Systemd#GRUB2#Targets#RHCSA#RHEL

Managing Boot Procedure

Theory Questions

1. Define a system “want” efficiently.

  • Command(s):
    systemctl enable <unit>

* **Why:** Enables a unit by creating a symbolic link in the `.target.wants` directory, defining a soft dependency where systemd attempts to start the unit when the target loads.
* **Gotchas:** Avoid manually creating symlinks; using `systemctl enable` ensures proper tracking, systemd reloads, and clean uninstallation.
* **Verify:**
```bash
systemctl is-enabled <unit>

2. Identify the normal default target for servers.

  • Command(s):
systemctl get-default
  • Why: Displays the active default boot target. RHEL production servers typically boot into multi-user.target (non-graphical multi-user CLI environment).
  • Gotchas: Confusing multi-user.target (standard CLI environment) with graphical.target (GUI environment with X11/Wayland).
  • Verify: Output should display:
multi-user.target

3. Identify valid and invalid Systemd targets.

  • Command(s):
systemctl list-unit-files --type=target
  • Why: Displays all available target unit files on the system alongside their configuration state (enabled, disabled, static, or masked).
  • Gotchas: Units marked as static lack an [Install] section and cannot be directly enabled or disabled via systemctl.
  • Verify: Inspect the STATE column in the command output.

4. Define which target a unit should start in when enabled.

  • Command(s):
grep -i "WantedBy" /usr/lib/systemd/system/<unit>
  • Why: The WantedBy= directive inside the [Install] section of a unit file specifies which target directory receives the unit’s symbolic link when enabled.
  • Gotchas: Forgetting to run systemctl daemon-reload after modifying custom unit files.
  • Verify:
systemctl show <unit> -p WantedBy

5. Allow a target to be isolated.

  • Command(s):
grep -i "AllowIsolate" /usr/lib/systemd/system/<target>
  • Why: The AllowIsolate=yes directive in the [Unit] section allows systemd to switch directly to this target while stopping all services not required by it.
  • Gotchas: Isolating a target stops all non-dependent running services, which will instantly terminate active SSH sessions.
  • Verify:
systemctl show <target> -p AllowIsolate

6. Switch the current target to rescue.target.

  • Command(s):
systemctl isolate rescue.target
  • Why: Stops all non-essential services and drops the system into a single-user maintenance mode with a root shell prompt.
  • Gotchas: Requires root password authentication; if the root account is locked or password unknown, access will be blocked.
  • Verify:
systemctl is-active rescue.target

7. Map Systemd targets to legacy System V runlevels.

  • Command(s):
ls -l /usr/lib/systemd/system/runlevel*.target
  • Why: Shows symbolic links mapping traditional SysV runlevels (0–6) to modern systemd targets (e.g., runlevel3.target -> multi-user.target).
  • Gotchas: Assuming traditional SysV runlevel scripts still execute directly; they exist purely as systemd compatibility symlinks.
  • Verify: Output displays targets matching runlevels 0 through 6:
runlevel3.target -> multi-user.target
runlevel5.target -> graphical.target

8. Identify the file where GRUB 2 configuration changes should be applied.

  • Path / Command:
/etc/default/grub
  • Why: Holds primary environment variables (such as GRUB_CMDLINE_LINUX and GRUB_TIMEOUT) used to generate the final GRUB 2 configuration.
  • Gotchas: Editing /boot/grub2/grub.cfg directly; manual modifications get overwritten whenever kernel updates execute grub2-mkconfig.
  • Verify:
cat /etc/default/grub

9. Apply GRUB 2 configuration changes after editing.

  • Command(s):
grub2-mkconfig -o /boot/grub2/grub.cfg
  • Why: Compiles /etc/default/grub and scripts in /etc/grub.d/ into the operational /boot/grub2/grub.cfg bootloader file.
  • Gotchas: On RHEL 9 and 10, /boot/grub2/grub.cfg is unified for both BIOS and UEFI systems; do not use legacy RHEL 8 EFI paths.
  • Verify:
stat /boot/grub2/grub.cfg

10. Identify the GRUB 2 configuration file generated on a UEFI system.

  • Path / Command:
/boot/grub2/grub.cfg
  • Why: In RHEL 9/10, boot config paths are unified under /boot/grub2/grub.cfg for both UEFI and BIOS systems (using stub loading).
  • Gotchas: Attempting to update /boot/efi/EFI/redhat/grub.cfg directly on RHEL 9/10, which can break automatic kernel updates.
  • Verify:
ls -l /boot/grub2/grub.cfg

11. Define what a “unit” is.

  • Command(s):
systemctl list-units
  • Why: A unit is an abstracted system resource configuration file managed by systemd (e.g., .service, .target, .socket, .mount, .timer).
  • Gotchas: Assuming systemd units only manage services; units also manage storage mounts, network sockets, path monitoring, and timers.
  • Verify: Output displays loaded units categorized by types such as .service, .target, and .socket.

12. Prevent a target from automatically starting on boot.

  • Command(s):
systemctl disable <target>
  • Why: Removes symbolic links in target dependency folders, preventing the target from being pulled in automatically at system launch.
  • Gotchas: Disabling essential targets like multi-user.target directly can render the system unbootable; modify default targets using set-default instead.
  • Verify:
systemctl is-enabled <target>

13. Identify the configuration file for common GRUB 2 changes.

  • Path / Command:
/etc/default/grub
  • Why: Contains customizable parameters including default boot kernel selections, timeout values, and kernel parameters.
  • Gotchas: Modifying scripts directly inside /etc/grub.d/ for basic parameter changes instead of editing /etc/default/grub.
  • Verify:
ls -l /etc/default/grub

14. Show all service units currently loaded.

  • Command(s):
systemctl list-units --type=service
  • Why: Filters systemd memory to list only service units currently loaded into memory, showing their active and sub-states.
  • Gotchas: Confusing list-units (loaded in memory) with list-unit-files (all installed unit files on disk).
  • Verify: Output lists active service units with loaded status in the LOAD column.

15. Create a “want” for a service.

  • Command(s):
systemctl enable <service>
  • Why: Creates a symbolic link in the corresponding <target>.wants/ directory, establishing a soft startup dependency.
  • Gotchas: systemctl enable only configures boot startup; use systemctl enable --now <service> to enable and start the service immediately.
  • Verify:
systemctl is-enabled <service>

16. Switch the current operational target to rescue.target.

  • Command(s):
systemctl isolate rescue.target
  • Why: Immediately switches system execution state to emergency single-user maintenance mode.
  • Gotchas: Remote network interfaces are shut down during isolation, terminating active SSH connections.
  • Verify:
systemctl is-active rescue.target

17. Explain why a target cannot be isolated.

  • Command(s):
systemctl show <target> -p AllowIsolate
  • Why: If a target unit file lacks AllowIsolate=yes in its [Unit] section, systemd rejects isolation requests to protect system integrity.
  • Gotchas: Attempting systemctl isolate on custom targets without explicitly configuring AllowIsolate=yes.
  • Verify: Output returns:
AllowIsolate=no

18. Find which units depend on a specific service before shutting it down.

  • Command(s):
systemctl list-dependencies <service> --reverse
  • Why: Displays all systemd units that depend on, require, or want the target service, preventing accidental disruption of dependent services.
  • Gotchas: Omitting --reverse; without this flag, systemctl lists what the service depends on, rather than what depends on it.
  • Verify: Inspect the resulting dependency tree.

19. Identify the GRUB 2 configuration file for applying changes.

  • Path / Command:
/etc/default/grub
  • Why: Central point of configuration for modifying kernel flags before building final configuration binaries.
  • Gotchas: Editing /boot/grub2/grub.cfg manually instead of applying parameters to /etc/default/grub.
  • Verify: Ensure file exists and parameters are formatted correctly.

20. Run the appropriate command after modifying GRUB 2 configuration.

  • Command(s):
grub2-mkconfig -o /boot/grub2/grub.cfg
  • Why: Scans /etc/default/grub and /etc/grub.d/ helpers to regenerate /boot/grub2/grub.cfg with updated directives.
  • Gotchas: rebooting without executing grub2-mkconfig, leaving modifications unapplied.
  • Verify:
stat /boot/grub2/grub.cfg

Lab Tasks

Task 1: Boot Target Practice

  • Command(s):
systemctl set-default multi-user.target
reboot
systemctl get-default
  • Why:

  • systemctl set-default: Updates the /etc/systemd/system/default.target symlink to target multi-user.target.

  • reboot: Restarts system to verify non-graphical startup.

  • systemctl get-default: Confirms persistent execution target.

  • Gotchas: Forgetting to run get-default post-reboot to confirm target persistence.

  • Verify:

systemctl get-default

Task 2: GRUB 2 Practice

  • Command(s):
sed -i 's/rhgb quiet//' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
  • Why: Removing rhgb (Red Hat Graphical Boot) and quiet from GRUB_CMDLINE_LINUX enables verbose text output during boot sequence.
  • Gotchas: Forgetting to run grub2-mkconfig -o /boot/grub2/grub.cfg to regenerate the bootloader configuration file.
  • Verify:
cat /proc/cmdline

(Ensure rhgb and quiet are absent from active kernel boot parameters)