AllTechWiki



A Place for All Technical Stuff Linux Cloud etc

Init vs systemd and runlevels vs targets in RHEL 6/7/8/9

 RHEL 6 uses SysVinit, which is a traditional init system that was widely used in Linux distributions before the introduction of systemd.

SysVinit is a simple, yet effective init system that uses a series of scripts to manage system services and startup processes. However, it has some limitations, such as:

- No parallelization of startup processes

- No automatic dependency management

RHEL 7 uses systemd, provides a more modern and efficient init system that offers features such as:

- Parallelization of startup processes

- Automatic dependency management

- Improved logging and debugging capabilities

Overall, the switch from SysVinit to systemd in RHEL 7 provides a more efficient, scalable, and reliable init system for managing system services and startup processes.

Why RHEL switched to systemd ?

Parallel service initialization : Unlikes the SysV init program, systemd is capable of launching services in parallel. The init program, by contrast, launches them one by one.

Faster process communication : The parallel capabilities of systemd carry over to inter-process communication. systemd is able to offer parallel access to sockets and system bus, significantly reducing process wait times for communication resources.

Automatic restart : If a service crashes, systemd can detect that and attempt to restart it. Most of the times, a simple restart is all that is needed for an application to begin functioning again, unless there are more fundamental issues.

RHEL 7/8/9 booting process is faster than RHEL6 due to parallel service initialization .

Key Differences of RHEL 6 and RHEL 7/8/9 Commands Usage Below

Task Name

RHEL 6 Command

RHEL 7/8/9 Command

Service Management

service <service> start/stop

systemctl start/stop <service>

chkconfig <service> on/off

systemctl enable/disable <service>

chkconfig --del <service_name>

systemctl mask <service>

chkconfig --add <service_name>

systemctl unmask <service>

chkconfig --list

systemctl list-unit-files

System Boot and Runlevel

runlevel

systemctl get-default

init <runlevel>

systemctl isolate <target>

N/A

systemctl list-units --type=target

Log Management

tail /var/log/messages

journalctl -u <service>

N/A

journalctl --since "today"

 

journalctl -u sshd --since="2024-12-01"

N/A

journalctl -xe

Network Management

service network start/stop

systemctl start/stop NetworkManager

ifconfig

ip addr

netstat -tulnp

ss -tulnp

Firewall Management

iptables commands

firewalld with firewall-cmd

service iptables start/stop

systemctl start/stop firewalld

iptables-save

firewall-cmd --permanent --list-all

Package Management

yum install <package>

yum install <package> (backed by DNF)                                                                 dnf install <package> -> RH8/9

Disk and Filesystem Management

fdisk

parted or gdisk for GPT disks

mount

mount

User Session Management

who, w

who, w

last

last

Shutdown and Reboot

shutdown -h now

systemctl poweroff

reboot

systemctl reboot

halt

systemctl halt


Runlevels and Targets Details

RHEL 6 Runlevel

RHEL 6 description

RHEL 7/8/9 target name

RHEL 7/8/9 description

0

Halt 

(shutdown the system)

poweroff.target

Powers off the system.

1

Single-user mode 

(maintenance mode)

rescue.target

Single-user mode for troubleshooting (similar to runlevel 1).

2

Multi-user mode 

(without networking)

emergency.target

Minimal environment for system recovery.

3

Full multi-user mode

(text mode)

multi-user.target

Multi-user system without a GUI (similar to runlevel 3).

4

Unused 

(available for customization)

Unused

NA

5

Full multi-user mode 

(with graphical interface)

graphical.target

Multi-user system with a graphical user interface (GUI).

6

Reboot (restart the system)

reboot.target

Reboots the system.

 

 

default.target

The default target set for the system (symlink to another target).


Run level/Targets

RHEL 6 Command

RHEL 7/8/9 Command

Check default runlevel

cat /etc/inittab

systemctl get-default

Check current runlevel

runlevel

systemctl is-active <target> ; shows active or not

Change runlevel / Target

sudo init <runlevel>

sudo systemctl isolate <target>

Set Default

vi /etc/inittab => id:3:initdefault: <== change required levels

sudo systemctl set-default <target>





Post a Comment

Previous Post Next Post

Basic Useful Links