In Linux, run levels define the operational state of the system by controlling which services and processes are started or stopped. They determine whether the system boots into single-user mode, multi-user mode, graphical mode, or shuts down entirely.
While modern RHEL versions (7 and later) use systemd, understanding traditional SysV init run levels remains essential—both for legacy systems and for grasping how systemd targets evolved.
Run Levels in RHEL Versions Before 7 (SysV Init)
RHEL versions prior to RHEL 7 use the SysV-style init system, where run levels control system behavior.
Commonly Used Run Levels
- Run Level 3 – Default for Servers
- Run Level 5 – Default for Desktop Systems
Checking the Default Run Level
The default run level is defined in the /etc/inittab file.
# cat /etc/inittab | grep initdefault
Example output:
id:3:initdefault:
This means the system boots by default into run level 3.
Complete List of Linux Run Levels (SysV Init)
Run Level 0 — Halt
- Safely shuts down the system
- Powers off the machine
- Used during system shutdown
Run Level 1 — Single-User Mode
- Maintenance and recovery mode
- Only the root user is logged in
- Networking services are disabled
- Used for system repair and troubleshooting
- Often accessed through rescue mode
Run Level 2 — Multi-User Mode (No Networking)
- Multi-user access enabled
- Networking services disabled
- Rarely used in RHEL
Run Level 3 — Multi-User Mode with Networking
- Full multi-user environment
- Networking enabled
- No graphical interface
- Default run level for most RHEL servers
Run Level 4 — User-Definable
- Not used by default
- Reserved for custom configurations
- Can be defined by system administrators
Run Level 5 — Multi-User Mode with GUI
- Multi-user environment
- Networking enabled
- Graphical interface available
- Starts X Window System and display manager
- Default run level for desktop systems
Run Level 6 — Reboot
- Safely reboots the system
- Used during system restart
- Checking the Current Run Level
To see the current run level:
# runlevel
or
# who -r
Changing Run Levels Temporarily
You can switch run levels without rebooting:
# init 3 # Switch to multi-user CLI mode
# init 5 # Switch to multi-user GUI mode
Note: Switching run levels can stop services and user sessions.
Changing the Default Run Level Permanently (SysV Init)
Edit the /etc/inittab file:
# vi /etc/inittab
Look for a line similar to:
id:5:initdefault:
Change the run level number (0–6) as required.
Run Levels in systemd (RHEL 7 and Later)
RHEL 7+ replaces run levels with systemd targets, offering better dependency management and parallel service startup.
Mapping Run Levels to systemd Targets
| SysV Run Level | systemd Target |
|---|---|
| 0 | poweroff.target |
| 1 | rescue.target |
| 3 | multi-user.target |
| 5 | graphical.target |
| 6 | reboot.target |
Managing systemd Targets
Check Current Default Target
# systemctl get-default
Change Default Target
# sudo systemctl set-default multi-user.target
Switch Targets Immediately
# sudo systemctl isolate graphical.target
Conclusion
Linux run levels remain a foundational concept in RHEL system administration. While systemd targets have replaced traditional run levels in modern RHEL releases, the underlying operational states remain the same. Understanding both models equips administrators to manage legacy systems, troubleshoot boot issues, and operate confidently across RHEL environments.
No comments:
Post a Comment