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 Name | Purpose/Use Case |
|---|---|
graphical.target | Full multi-user system with GUI (desktop environment). |
multi-user.target | Full multi-user system without GUI (server mode). |
rescue.target | Single-user mode for system recovery or maintenance. |
emergency.target | Minimal environment for fixing critical system problems. |
reboot.target | Reboots the system. |
poweroff.target | Shuts 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.targetto 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:
- At the GRUB boot menu:
- Restart the system.
- When GRUB shows up, press
eto edit the boot entry.
- Add the target to the kernel line:
- Find the line starting with
linuxorlinux16. - At the end of the line, append: systemd.unit=rescue.target
- Or another target, e.g.,
emergency.target.
- Find the line starting with
- Boot with this temporary target:
- Press
Ctrl + XorF10to boot.
- Press
IT Example:
- If a network service fails to start, boot into
rescue.targetto 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.targetinstead 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:
isolatestops 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.targetwithout 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/fstabhas a bad entry, boot intoemergency.targetto fix the mount points before full system startup.
7. Summary Table of Commands
| Action | Command | Notes |
|---|---|---|
| Check current default target | systemctl get-default | Shows default boot target |
| Change default target (permanent) | sudo systemctl set-default multi-user.target | Replace multi-user.target as needed |
| Switch target without reboot | sudo systemctl isolate graphical.target | Changes state immediately |
| Boot once into a target (GRUB method) | Add systemd.unit=rescue.target to kernel line | Temporary, no permanent change |
8. Exam Tips
- Know the difference between temporary and permanent target changes.
- Remember
rescue.targetis single-user,emergency.targetis minimal recovery. - Practice isolating targets without reboot to troubleshoot live systems.
- Familiarize yourself with GRUB editing to boot into a target manually.
- 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.
