Boot systems into different targets manually

4. Operate Running Systems

📘Red Hat Certified System Administrator (RHCSA – EX200)


1. Understanding “Targets” in Linux

In modern Linux systems (like Red Hat Enterprise Linux 8), the concept of runlevels from older Linux has been replaced by targets in systemd.

Targets define what services and processes start when the system boots. Think of a target as a predefined system state.

Common targets include:

Target NamePurpose/Use Case
graphical.targetFull multi-user system with GUI (desktop environment).
multi-user.targetFull multi-user system without GUI (server mode).
rescue.targetSingle-user mode for system recovery or maintenance.
emergency.targetMinimal environment for fixing critical system problems.
reboot.targetReboots the system.
poweroff.targetShuts down the system.

IT Example:

  • A web server might boot into multi-user.target (no GUI).
  • A desktop system boots into graphical.target.
  • If a disk fails or a service misbehaves, you might boot into rescue.target to fix it.

2. Checking the Current Default Target

To see which target your system boots into by default:

systemctl get-default

Example Output:

graphical.target

This means your system normally boots with a GUI.


3. Temporarily Changing the Boot Target

Sometimes you may want to boot once into a different target without changing the default permanently.

Steps:

  1. At the GRUB boot menu:
    • Restart the system.
    • When GRUB shows up, press e to edit the boot entry.
  2. Add the target to the kernel line:
    • Find the line starting with linux or linux16.
    • At the end of the line, append: systemd.unit=rescue.target
    • Or another target, e.g., emergency.target.
  3. Boot with this temporary target:
    • Press Ctrl + X or F10 to boot.

IT Example:

  • If a network service fails to start, boot into rescue.target to troubleshoot without all normal services starting.

4. Permanently Changing the Default Target

If you want the system to always boot into a specific target:

# Check current default
systemctl get-default# Change default target
sudo systemctl set-default multi-user.target

Check the change:

systemctl get-default

IT Example:

  • A server administrator may want servers to boot into multi-user.target instead of GUI to save resources.

5. Switching Targets Without Rebooting

You can switch targets on a running system. This is called changing the system state dynamically.

# Switch to multi-user (no GUI)
sudo systemctl isolate multi-user.target# Switch to graphical (GUI)
sudo systemctl isolate graphical.target

Notes:

  • isolate stops services from the current target that are not part of the new target.
  • It’s like “jumping” from one system state to another immediately.

IT Example:

  • If you need to install a package in a console-only environment, switch to multi-user.target without rebooting.

6. Rescue and Emergency Modes

Rescue Mode (rescue.target)

  • Single-user mode.
  • Only essential services are started.
  • Root access is available.
  • Useful for fixing configuration errors or broken services.

Command to enter from running system:

sudo systemctl isolate rescue.target

Emergency Mode (emergency.target)

  • Minimal environment.
  • Only root filesystem is mounted (sometimes read-only).
  • Used when system cannot boot normally.
  • Very limited commands available.

Command to enter from running system:

sudo systemctl isolate emergency.target

IT Example:

  • If /etc/fstab has a bad entry, boot into emergency.target to fix the mount points before full system startup.

7. Summary Table of Commands

ActionCommandNotes
Check current default targetsystemctl get-defaultShows default boot target
Change default target (permanent)sudo systemctl set-default multi-user.targetReplace multi-user.target as needed
Switch target without rebootsudo systemctl isolate graphical.targetChanges state immediately
Boot once into a target (GRUB method)Add systemd.unit=rescue.target to kernel lineTemporary, no permanent change

8. Exam Tips

  1. Know the difference between temporary and permanent target changes.
  2. Remember rescue.target is single-user, emergency.target is minimal recovery.
  3. Practice isolating targets without reboot to troubleshoot live systems.
  4. Familiarize yourself with GRUB editing to boot into a target manually.
  5. Always confirm the default target after changing it:
systemctl get-default

By understanding these commands and modes, you can handle system boot issues, troubleshoot services, and configure servers for different purposes—key skills for the RHCSA exam.

Buy Me a Coffee