Systemd vs SysVinit: A Comprehensive Comparison and Cheat Sheet
Understanding Linux Service Management: Systemd vs. SysVinit
This page provides a detailed comparison and cheat sheet for managing services on Linux systems, focusing on the transition from the traditional SysVinit to the modern Systemd init system. Understanding these differences is crucial for system administrators and developers working with various Linux distributions.
Systemd vs. SysVinit Command Equivalents
Here's a breakdown of common service management tasks and their corresponding commands in both SysVinit and Systemd.
Controlling Available Services
SysVinit:
service SERVICE [start/stop/restart/reload/condrestart/status]
Systemd:
systemctl [start/stop/restart/reload/condrestart/status] SERVICE
Listing Services
SysVinit:
ls /etc/rc.d/init.d/
Systemd Methods:
systemctl
systemctl list-unit-files --type=service
ls /lib/systemd/system/*.service /etc/systemd/system/*.service
Enabling or Disabling Services for Boot
SysVinit:
chkconfig SERVICE [on/off]
Systemd:
systemctl [enable/disable] SERVICE
Checking Service Enablement Status
SysVinit:
chkconfig SERVICE
Systemd:
systemctl is-enabled SERVICE
Listing Services Configured for Run Levels
SysVinit:
chkconfig --list
Systemd Methods:
systemctl list-unit-files --type=service
ls /etc/systemd/system/*.wants/
Identifying Services for GUI Boot
SysVinit:
chkconfig --list | grep 5:on
Systemd:
systemctl list-dependencies graphical.target
Listing Configuration for a Specific Service
SysVinit:
chkconfig SERVICE --list
Systemd:
ls /etc/systemd/system/*.wants/SERVICE.service
Adding or Reloading New Service Files
SysVinit:
chkconfig SERVICE --add
Systemd:
systemctl daemon-reload
Run Level / Target Equivalents
Systemd uses "targets" which are analogous to SysVinit's "run levels". Here's a mapping:
Power Off
SysVinit Run level: 0
Systemd Target: runlevel0.target
, poweroff.target
Single-User Mode
SysVinit Runlevel: 1, s, single
Systemd Target: runlevel1.target
, rescue.target
User-Defined/Site-Specific Run Levels
SysVinit Runlevel: 2, 4
Systemd Target: runlevel2.target
, runlevel4.target
, multi-user.target
Multi-User (Non-Graphical)
SysVinit Runlevel: 3
Systemd Target: runlevel3.target
, multi-user.target
Multi-User (Graphical)
SysVinit Runlevel: 5
Systemd Target: runlevel5.target
, graphical.target
Reboot
SysVinit Runlevel: 6
Systemd Target: runlevel6.target
, reboot.target
Emergency Shell
SysVinit Runlevel: emergency
Systemd Target: emergency.target