Table of Contents

Init Systems

General Information

Down and dirty quick info about three different init systems that Linux uses; SysV init, upstart, and systemd.

Checklist


All Inits

This section will compare three init systems; sysv, upstart, and systemd.

Command Table

Command Sysv Upstart Systemd
Status of Service service foo status initctl status foo systemctl status foo
Start Service service foo start initctl start foo systemctl start foo
Stop Service service foo stop initctl stop foo systemctl stop foo
Restart Service service foo restart initctl restart foo systemctl restart foo
Reload config file service foo reload initctl reload foo systemctl reload foo
List services ls /etc/init.d/ initctl list systemctl (or)
systemctl list-unit-files (or)
systemctl list-unit-files –type=service
Enable Service At Boot chkconfig foo on Edit /etc/init/<jobname>.conf “start on” field systemctl enable foo
Disable Service At Boot chkconfig foo off Edit /etc/init/<jobname>.conf “start on” field systemctl disable foo
List services and enabled run levels chkconfig –list initctl show-config systemctl list-unit-files –type=service (or)
ls /etc/systemd/system/*.wants/

All Inits Run Levels

Description Sysv Upstart Systemd
Halt system 0 runlevel [0] poweroff.target
Single user mode 1,s,single runlevel [1] rescue.target
User defined. Same as 3 by default. 2,4 runlevel [24] multi-user.target
Multi-user, non-graphical 3 runlevel [3] multi-user.target
Multi-user, graphical 5 runlevel [5] graphical.target
Reboot 6 runlevel [6] reboot.target
Emergency shell emergency ? emergency.target

SysV Init (init)

Sysv init details not contained in All Inits section.

Distributions: RHEL/CentOS ⇐ 6 (RHEL 6 uses an init/upstart combination), Debian ⇐ 7

Defualt run level

Example with run level 5 as default:

id:5:initdefault

Master Copy of Startup Scripts

/etc/rc.d/init.d/

rc#.d directories

The rc#.d directories contain symbolic links to the scripts in /etc/rc.d/init.d.

# = the run level, ie rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d

Locations

Script Names

Manage Services


Upstart

Upstart details not contained in All Inits section.

Distributions: Ubuntu 9.10 - Current (migrating to systemd), RHEL/CentOS 6 (some scripts)

Upstart uses event driven jobs, instead of run levels to executes scripts. It does have events for rc0-6 to maintain compatibility with init.


Systemd

Systemd details not contained in All Inits section.

Distributions: RHEL/CentOS 7, Debian 8, Ubuntu 15.4?

Location of Unit Scripts

Laptop: Disable Suspend

On systemd based systems, the laptop suspend on lid closed can be disabled by changing the logind config.

1) Edit /etc/systemd/logind.conf

2) Uncomment “HandleLidSwitch” and set to ignore

HandleLidSwitch=ignore