202.1. Customizing SysV-init system startup

202.1 Customizing SysV-init system startup

Weight: 3
Description: Candidates should be able to query and modify the behaviour of system services at various targets / run levels. A thorough understanding of the systemd, SysV Init and the Linux boot process is required. This objective includes interacting with systemd targets and SysV init run levels.
Key Knowledge Areas:
    Systemd
    SysV init
    Linux Standard Base Specification (LSB)
Terms and Utilities:
    /usr/lib/systemd/
    /etc/systemd/
    /run/systemd/
    systemctl
    systemd-delta
    /etc/inittab
    /etc/init.d/
    /etc/rc.d/
    chkconfig
    update-rc.d
    init and telinit

Over View

During the previous lessons we talked about initrd/initramfs. When the kernel completly loaded it searchs for init process to start it. init process can be init, upstart or systemd. Traditionally System v init is used to start other services but it has some short comings. So other solutions invented like upstart and systemd.
/sbin/init can be linked to upstart or systemd. to check which system you are running, check each directory existence:
Directpry
Description [if exist]
/etc/init.d
Shows you have SysV in your linux box
/usr/share/upstart
You are on a Upstart Based system
/usr/lib/systemd
You are using Systemd-Based system
also try stat /proc/1/exe
link
Description
File: ‘/proc/1/exe’ -> ‘/sbin/init’
in SysV and upstart system
File: '/proc/1/exe' -> '/lib/systemd/systemd'
in Systemd box

Sys v

System "5" or Sys "v" is an ancient method of handling system services from unix world back to 1980s. SysV uses serial loading of services, in another word each service must be loaded in sequence (after each other). SysV uses runlevels concept to define which stat the server should boot in. In each runlevel specific amount of shell scripts is processed to reach the state we desire.
runlevels start from 0 upto 6 and they are different in Redhat based and Debian based systems.
runlevel
Redhat
Debian
0
System Halt (do not set as default)
System Halt (do not use as default)
1
Single User Mode
Single User Mode
2
Multi User without NFS
Full multi User mode with GUI(default)
3
Full Multi User Mode
--same as 2-- --unused--
4
---unused--
--same as 2-- --unused--
5
X11/Full Multi user Mode(default)
--same as 2-- --unused--
6
reboot (Do not set as initdefault)
rebbot (do not set as default)
/etc/inittab is SysV configuration file where default runlevel can be set, We use CentOS 5 for demonstration :
1
#
2
# inittab This file describes how the INIT process should set up
3
# the system in a certain run-level.
4
#
5
# Author: Miquel van Smoorenburg, <[email protected]>
6
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
7
#
8
9
# Default runlevel. The runlevels used by RHS are:
10
# 0 - halt (Do NOT set initdefault to this)
11
# 1 - Single user mode
12
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
13
# 3 - Full multiuser mode
14
# 4 - unused
15
# 5 - X11
16
# 6 - reboot (Do NOT set initdefault to this)
17
#
18
id:5:initdefault:
19
20
# System initialization.
21
si::sysinit:/etc/rc.d/rc.sysinit
22
23
l0:0:wait:/etc/rc.d/rc 0
24
l1:1:wait:/etc/rc.d/rc 1
25
l2:2:wait:/etc/rc.d/rc 2
26
l3:3:wait:/etc/rc.d/rc 3
27
l4:4:wait:/etc/rc.d/rc 4
28
l5:5:wait:/etc/rc.d/rc 5
29
l6:6:wait:/etc/rc.d/rc 6
30
31
# Trap CTRL-ALT-DELETE
32
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
33
34
# When our UPS tells us power has failed, assume we have a few minutes
35
# of power left. Schedule a shutdown for 2 minutes from now.
36
# This does, of course, assume you have powerd installed and your
37
# UPS connected and working correctly.
38
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"
39
40
# If power was restored before the shutdown kicked in, cancel it.
41
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"
42
43
44
# Run gettys in standard runlevels
45
1:2345:respawn:/sbin/mingetty tty1
46
2:2345:respawn:/sbin/mingetty tty2
47
3:2345:respawn:/sbin/mingetty tty3
48
4:2345:respawn:/sbin/mingetty tty4
49
5:2345:respawn:/sbin/mingetty tty5
50
6:2345:respawn:/sbin/mingetty tty6
51
52
# Run xdm in runlevel 5
53
x:5:respawn:/etc/X11/prefdm -nodaemon
Copied!
By modifying id:5:initdefault: we can change the run level for the next time boot but there is another proper way :

init / telinit

init and telinit commands are the same.how ever telinit is recommended. They are both used to change current system runlevel
1
[[email protected] ~]# telinit 3
Copied!
and for come back to previous run level:
1
[[email protected] ~]# telinit 5
Copied!
and to see previous runlevel and current runlevel use runlevel command:
1
[[email protected] ~]# runlevel
2
3 5
Copied!
as you can see 3 was our previous runlevel and we have switched from it to 5.

/etc/init.d and /etc/rc.d

as we said SysV runs scripts in sequence to start services. But how and where they are managed? its simple but implementation is some how complicated.
all scripts are inside /etc/rc.d/init.d but there are symbolic links to desired rc folder. each rc folder specify one runlevel. so if you want to manually start a service in a run level you can create a symbolic link inside desired rc folder from init.d folder and put a name with sequence for that. "K" for Kill the service and "S" to Start it.

chkconfig

Exploring rc folders, creating symbolic links is a hard job. chkconfig is a great tool which let us turn on or off specific service or services in desired runlevel.lets start:
1
[[email protected] ~]# chkconfig
2
chkconfig version 1.3.30.2 - Copyright (C) 1997-2000 Red Hat, Inc.
3
This may be freely redistributed under the terms of the GNU Public License.
4
5
usage: chkconfig --list [name]
6
chkconfig --add <name>
7
chkconfig --del <name>
8
chkconfig [--level <levels>] <name> <on|off|reset|resetpriorities>
9
[[email protected] ~]# chkconfig --list
10
NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
11
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
12
anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off
13
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
14
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
15
autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
16
avahi-daemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
17
avahi-dnsconfd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
18
bluetooth 0:off 1:off 2:on 3:on 4:on 5:on 6:off
19
conman 0:off 1:off 2:off 3:off 4:off 5:off 6:off
20
cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off
21
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
22
cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off
23
dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off
24
dund 0:off 1:off 2:off 3:off 4:off 5:off 6:off
25
firstboot 0:off 1:off 2:off 3:on 4:off 5:on 6:off
26
gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
27
haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
28
hidd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
29
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
30
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
31
ipmi 0:off 1:off 2:off 3:off 4:off 5:off 6:off
32
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
33
irda 0:off 1:off 2:off 3:off 4:off 5:off 6:off
34
irqbalance 0:off 1:off 2:on 3:on 4:on 5:on 6:off
35
iscsi 0:off 1:off 2:off 3:on 4:on 5:on 6:off
36
iscsid 0:off 1:off 2:off 3:on 4:on 5:on 6:off
37
kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off
38
lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off
39
mcstrans 0:off 1:off 2:on 3:on 4:on 5:on 6:off
40
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
41
mdmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
42
messagebus 0:off 1:off 2:off 3:on 4:on 5:on 6:off
43
microcode_ctl 0:off 1:off 2:on 3:on 4:on 5:on 6:off
44
multipathd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
45
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
46
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
47
netplugd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
48
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
49
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
50
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
51
nscd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
52
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
53
oddjobd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
54
pand 0:off 1:off 2:off 3:off 4:off 5:off 6:off
55
pcscd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
56
portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off
57
psacct 0:off 1:off 2:off 3:off 4:off 5:off 6:off
58
rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off
59
rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
60
readahead_early 0:off 1:off 2:on 3:on 4:on 5:on 6:off
61
readahead_later 0:off 1:off 2:off 3:off 4:off 5:on 6:off
62
restorecond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
63
rpcgssd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
64
rpcidmapd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
65
rpcsvcgssd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
66
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
67
sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
68
smartd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
69
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
70
svnserve 0:off 1:off 2:off 3:off 4:off 5:off 6:off
71
syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
72
vmware-tools 0:off 1:off 2:on 3:on 4:on 5:on 6:off
73
vmware-tools-thinprint 0:off 1:off 2:on 3:on 4:on 5:on 6:off
74
vncserver 0:off 1:off 2:off 3:off 4:off 5:off 6:off
75
wdaemon 0:off 1:off 2:off 3:off 4:off 5:off 6:off
76
wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off
77
xfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
78
ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
79
yum-updatesd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Copied!
to change see some usefull examples:
command
description
chkconfig <service name> on
start service on any unspecial run level(3,4,5 centOS)
chkconfig <service name> off
turn service off in all runlevels
chkconfig --list <service name>
List service condition in all unlevels
chkconfig --level 345 <service name> on/off
Turn serve on/off in runlevel 3,4 and 5

update-rc.d

in Debian based systems like ubuntu update-rc.d used as a command instead of chkconfig command
1
[email protected]:/etc# update-rc.d
2
usage: update-rc.d [-n] [-f] <basename> remove
3
update-rc.d [-n] <basename> defaults [NN | SS KK]
4
update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] .
5
update-rc.d [-n] <basename> disable|enable [S|2|3|4|5]
6
-n: not really
7
-f: force
8
9
The disable|enable API is not stable and might change in the future.
10
11
[email protected]:/etc# update-rc.d apparmor disable
12
update-rc.d: warning: apparmor start runlevel arguments (none) do not match LSB Default-Start values (S)
13
Disabling system startup links for /etc/init.d/apparmor ...
14
Removing any system startup links for /etc/init.d/apparmor ...
15
/etc/rc0.d/K63apparmor
16
Adding system startup for /etc/init.d/apparmor ...
17
/etc/rc0.d/K63apparmor -> ../init.d/apparmor
Copied!

upstart

The first serious attempt to replace systemV was upstart, created by ubuntu. upstart is reactionary, means it takes events and based on them run jobs. In comparison with SysV upstart is more flexible but still it uses scripts and like SysV has some shortages. Although upstart is backward compatible and lets us to use SysV commands. if your system has /etc/init directory it us using upstart.
upstart keeps all previous SysV Folders and uses it, We use Ubuntu 14 machine :
1
[email protected]:/etc# cd /etc/init.d/ && ls
2
acpid dns-clean procps single
3
anacron friendly-recovery pulseaudio skeleton
4
apparmor grub-common rc speech-dispatcher
5
apport halt rc.local sudo
6
avahi-daemon irqbalance rcS thermald
7
bluetooth kerneloops README udev
8
brltty killprocs reboot umountfs
9
console-setup kmod resolvconf umountnfs.sh
10
cron lightdm rsync umountroot
11
cups networking rsyslog unattended-upgrades
12
cups-browsed ondemand saned urandom
13
dbus pppd-dns sendsigs x11-common
14
15
[email protected]:~# cd /etc/rc6.d/ && ls -l
16
total 4
17
lrwxrwxrwx 1 root root 29 Dec 9 02:07 K10unattended-upgrades -> ../init.d/unattended-upgrades
18
lrwxrwxrwx 1 root root 20 Dec 9 02:07 K20kerneloops -> ../init.d/kerneloops
19
lrwxrwxrwx 1 root root 15 Dec 9 02:07 K20rsync -> ../init.d/rsync
20
lrwxrwxrwx 1 root root 27 Dec 9 02:07 K20speech-dispatcher -> ../init.d/speech-dispatcher
21
-rw-r--r-- 1 root root 351 Mar 12 2014 README
22
lrwxrwxrwx 1 root root 18 Dec 9 02:07 S20sendsigs -> ../init.d/sendsigs
23
lrwxrwxrwx 1 root root 17 Dec 9 02:07 S30urandom -> ../init.d/urandom
24
lrwxrwxrwx 1 root root 22 Dec 9 02:07 S31umountnfs.sh -> ../init.d/umountnfs.sh
25
lrwxrwxrwx 1 root root 18 Dec 9 02:07 S40umountfs -> ../init.d/umountfs
26
lrwxrwxrwx 1 root root 20 Dec 9 02:07 S60umountroot -> ../init.d/umountroot
27
lrwxrwxrwx 1 root root 16 Dec 9 02:07 S90reboot -> ../init.d/reboot
Copied!
The configuration files of native upstart services are in /etc/init/ directory :
1
[email protected]:/etc/init# ls
2
acpid.conf mtab.sh.conf
3
alsa-restore.conf networking.conf
4
alsa-state.conf network-interface.conf
5
alsa-store.conf network-interface-container.conf
6
anacron.conf network-interface-security.conf
7
apport.conf network-manager.conf
8
avahi-cups-reload.conf passwd.conf
9
avahi-daemon.conf plymouth.conf
10
bluetooth.conf plymouth-log.conf
11
bootmisc.sh.conf plymouth-ready.conf
12
checkfs.sh.conf plymouth-shutdown.conf
13
checkroot-bootclean.sh.conf plymouth-splash.conf
14
checkroot.sh.conf plymouth-stop.conf
15
console.conf plymouth-upstart-bridge.conf
16
console-font.conf procps.conf
17
console-setup.conf pulseaudio.conf
18
container-detect.conf rc.conf
19
control-alt-delete.conf rcS.conf
20
cron.conf rc-sysinit.conf
21
cups-browsed.conf resolvconf.conf
22
cups.conf rfkill-restore.conf
23
dbus.conf rfkill-store.conf
24
dmesg.conf rsyslog.conf
25
failsafe.conf setvtrgb.conf
26
failsafe-x.conf shutdown.conf
27
flush-early-job-log.conf startpar-bridge.conf
28
friendly-recovery.conf systemd-logind.conf
29
gpu-manager.conf thermald.conf
30
hostname.conf tty1.conf
31
hwclock.conf tty2.conf
32
hwclock-save.conf tty3.conf
33
irqbalance.conf tty4.conf
34
kmod.conf tty5.conf
35
lightdm.conf tty6.conf
36
modemmanager.conf udev.conf
37
mountall-bootclean.sh.conf udev-fallback-graphics.conf
38
mountall.conf udev-finish.conf
39
mountall-net.conf udevmonitor.conf
40
mountall-reboot.conf udevtrigger.conf
41
mountall.sh.conf ufw.conf
42
mountall-shell.conf upstart-file-bridge.conf
43
mountdevsubfs.sh.conf upstart-socket-bridge.conf
44
mounted-debugfs.conf upstart-udev-bridge.conf
45
mounted-dev.conf ureadahead.conf
46
mounted-proc.conf ureadahead-other.conf
47
mounted-run.conf usb-modeswitch-upstart.conf
48
mounted-tmp.conf vmware-tools.conf
49
mounted-var.conf vmware-tools-thinprint.conf
50
mountkernfs.sh.conf wait-for-state.conf
51
mountnfs-bootclean.sh.conf whoopsie.conf
Copied!
as an example let take a look at inside of ufw.conf:
1
# ufw - Uncomplicated Firewall
2
#
3
# The Uncomplicated Firewall is a front-end for iptables, to make managing a
4
# Netfilter firewall easier.
5
6
description "Uncomplicated firewall"
7
8
# Make sure we start before an interface receives traffic
9
start on (starting network-interface
10
or starting network-manager
11
or starting networking)
12
13
stop on runlevel [!023456]
14
15
console output
16
17
pre-start exec /lib/ufw/ufw-init start quiet
18
post-stop exec /lib/ufw/ufw-init stop
Copied!
How upstart keeps backward compatibility and live beside old SysV? the secret is inside /etc/init/rcS.conf :
1
# rcS - System V single-user mode compatibility
2
#
3
# This task handles the old System V-style single-user mode, this is
4
# distinct from the other runlevels since running the rc script would
5
# be bad.
6
7
description "System V single-user mode compatibility"
8
author "Scott James Remnant <[email protected]>"
9
10
start on runlevel S
11
stop on runlevel [!S]
12
13
console owner
14
exec /sbin/sulogin
15
16
post-stop script
17
# Don't switch runlevels if we were stopped by an event, since that
18
# means we're already switching runlevels
19
if [ -n "${UPSTART_STOP_EVENTS}" ]
20
then
21
exit 0
22
fi
23
24
# Switch, passing a magic flag
25
start --no-wait rc-sysinit FROM_SINGLE_USER_MODE=y
26
end script
Copied!
bu using rcS.conf upstart can run SysV scripts which haven't been developed for upstart natively .

Systemd

Systemd is used in all modern linuxes. Its a new way of starting linux services but that is not all. The idea of Systemd project is scary! Systemd developers have this idea to create Systemd OS which runs on linux OS. So it seems usual if we know it has its own tool which work like cron, or fstab, rsyslog ... .
In Systemd world we have tragets and unit files, targets is like our goal which we want to reach. But for reaching targets we need to specified what ever is needed to be load in unit files. As Systemd doing variety of thing, there for different types of unit files exists:
    service : unit file to start a service considering its dependencies
    mount : replace the mount in /etc/fstab
    timer : replacement for cron
    automount : mount a directory when needed
    target : as we said a bunch of unit files :), target is an end point, tragets can be used as runlevel .
    path :observ activities on a path and start a service associated with that
    ...

/usr/lib/systemd/system and /etc/systemd/system

Orginal systemd ubit files are in /usr/lib/systemd/system directory but they should not be modified by administrators. Modification should be done in /etc/systemd/system and its good to know that they are linked. Inorde to do any modification we should copy service files from /usr/lib/systemd/system to /etc/systemd/system and then set our settings, we use Ubuntu 16:
1
[[email protected] system]# cd /usr/lib/systemd/system && ls
2
abrt-ccpp.service plymouth-poweroff.service
3
abrtd.service plymouth-quit.service
4
abrt-oops.service plymouth-quit-wait.service
5
abrt-pstoreoops.service plymouth-read-write.service
6
abrt-vmcore.service plymouth-reboot.service
7
abrt-xorg.service plymouth-start.service
8
accounts-daemon.service plymouth-switch-root.service
9
alsa-restore.service polkit.service
10
alsa-state.service postfix.service
11
alsa-store.service poweroff.target
12
anaconda-direct.service poweroff.target.wants
13
anaconda-nm-config.service printer.target
14
anaconda-noshell.service proc-fs-nfsd.mount
15
anaconda-pre.service proc-sys-fs-binfmt_misc.automount
16
anaconda.service proc-sys-fs-binfmt_misc.mount
17
[email protected] psacct.service
18
anaconda-sshd.service qemu-guest-agent.service
19
anaconda.target quotaon.service
20
[email protected] radvd.service
21
arp-ethers.service rc-local.service
22
atd.service rdisc.service
23
auditd.service rdma-ndd.service
24
auth-rpcgss-module.service rdma.service
25
autofs.service realmd.service
26
[email protected] reboot.target
27
avahi-daemon.service reboot.target.wants
28
avahi-daemon.socket remote-fs-pre.target
29
basic.target remote-fs.target
30
basic.target.wants rescue.service
31
blk-availability.service rescue.target
32
bluetooth.service rescue.target.wants
33
bluetooth.target rhel-autorelabel-mark.service
34
brandbot.path rhel-autorelabel.service
35
brandbot.service rhel-configure.service
36
brltty.service rhel-dmesg.service
37
canberra-system-bootup.service rhel-domainname.service
38
canberra-system-shutdown-reboot.service rhel-import-state.service
39
canberra-system-shutdown.service rhel-loadmodules.service
40
certmonger.service rhel-readonly.service
41
cgconfig.service rngd.service
42
cgdcbxd.service rpcbind.service
43
cgred.service rpcbind.socket
44
[email protected] rpcbind.target
45
[email protected] rpc-gssd.service
46
chronyd.service rpcgssd.service
47
chrony-wait.service rpcidmapd.service
48
colord.service rpc-rquotad.service
49
[email protected] rpc-statd-notify.service
50
console-getty.service rpc-statd.service
51
console-shell.service rsyncd.service
53
cpupower.service rsyncd.socket
54
crond.service rsyslog.service
55
cryptsetup-pre.target rtkit-daemon.service
56
cryptsetup.target runlevel0.target
57
ctrl-alt-del.target runlevel1.target
58
cups-browsed.service runlevel1.target.wants
59
cups.path runlevel2.target
60
cups.service runlevel2.target.wants
61
cups.socket runlevel3.target
62
dbus-org.freedesktop.hostname1.service runlevel3.target.wants
63
dbus-org.freedesktop.import1.service runlevel4.target
64
dbus-org.freedesktop.locale1.service runlevel4.target.wants
65
dbus-org.freedesktop.login1.service runlevel5.target
66
dbus-org.freedesktop.machine1.service runlevel5.target.wants
67
dbus-org.freedesktop.timedate1.service runlevel6.target
68
dbus.service saslauthd.service
69
dbus.socket [email protected]
70
dbus.target.wants [email protected]
71
debug-shell.service shutdown.target
72
default.target shutdown.target.wants
73
default.target.wants sigpwr.target
74
dev-hugepages.mount sleep.target
75
dev-mqueue.mount -.slice
76
dm-event.service slices.target
77
dm-event.socket smartcard.target
78
dmraid-activation.service smartd.service
79
dnsmasq.service sockets.target
80
dracut-cmdline.service sockets.target.wants
81
dracut-initqueue.service sound.target
82
dracut-mount.service speech-dispatcherd.service
83
dracut-pre-mount.service spice-vdagentd.service
84
dracut-pre-pivot.service spice-vdagentd.target
85
dracut-pre-trigger.service sshd-keygen.service
86
dracut-pre-udev.service sshd.service
87
dracut-shutdown.service [email protected]
88
ebtables.service sshd.socket
89
emergency.service sssd-autofs.service
90
emergency.target sssd-autofs.socket
91
fcoe.service sssd-nss.service
92
final.target sssd-nss.socket
93
firewalld.service sssd-pac.service
94
firstboot-graphical.service sssd-pac.socket
95
flatpak-system-helper.service sssd-pam-priv.socket
96
fprintd.service sssd-pam.service
97
fstrim.service sssd-pam.socket
98
fstrim.timer sssd-secrets.service
99
gdm.service sssd-secrets.socket
100
geoclue.service sssd.service
101
[email protected] sssd-ssh.service
102
getty.target sssd-ssh.socket
103
graphical.target sssd-sudo.service
104
graphical.target.wants sssd-sudo.socket
105
gssproxy.service suspend.target
106
halt-local.service svnserve.service
107
halt.target swap.target
108
halt.target.wants sys-fs-fuse-connections.mount
109
hibernate.target sysinit.target
110
hybrid-sleep.target sysinit.target.wants
111
hypervfcopyd.service sys-kernel-config.mount
112
hypervkvpd.service sys-kernel-debug.mount
113
hypervvssd.service syslog.socket
114
initial-setup-graphical.service syslog.target.wants
115
initial-setup-reconfiguration.service sysstat.service
116
initial-setup.service systemd-ask-password-console.path
117
initial-setup-text.service systemd-ask-password-console.service
118
initrd-cleanup.service systemd-ask-password-plymouth.path
119
initrd-fs.target systemd-ask-password-plymouth.service
120
initrd-parse-etc.service systemd-ask-password-wall.path
121
initrd-root-fs.target systemd-ask-password-wall.service
122
initrd-switch-root.service [email protected]
123
initrd-switch-root.target systemd-binfmt.service
124
initrd-switch-root.target.wants systemd-bootchart.service
125
initrd.target systemd-firstboot.service
126
initrd.target.wants systemd-fsck-root.service
127
initrd-udevadm-cleanup-db.service [email protected]
128
instperf.service systemd-halt.service
129
iprdump.service [email protected]
130
iprinit.service systemd-hibernate.service
131
iprupdate.service systemd-hostnamed.service
132
iprutils.target systemd-hwdb-update.service
133
ipsec.service systemd-hybrid-sleep.service
134
irqbalance.service systemd-importd.service
135
iscsid.service systemd-initctl.service
136
iscsid.socket systemd-initctl.socket
137
iscsi.service systemd-journal-catalog-update.service
138
iscsi-shutdown.service systemd-journald.service
139
iscsiuio.service systemd-journald.socket
140
iscsiuio.socket systemd-journal-flush.service
141
kdump.service systemd-kexec.service
142
kexec.target systemd-localed.service
143
kexec.target.wants systemd-logind.service
144
kmod-static-nodes.service systemd-machined.service
145
kpatch.service systemd-machine-id-commit.service
146
ksm.service systemd-modules-load.service
147
ksmtuned.service [email protected]
148
libstoragemgmt.service systemd-poweroff.service
149
libvirtd.service systemd-quotacheck.service
150
lldpad.service systemd-random-seed.service
151
lldpad.socket systemd-readahead-collect.service
152
local-fs-pre.target systemd-readahead-done.service
153
local-fs.target systemd-readahead-done.timer
154
local-fs.target.wants systemd-readahead-drop.service
155
lvm2-lvmetad.service systemd-readahead-replay.service
156
lvm2-lvmetad.socket systemd-reboot.service
157
lvm2-lvmpolld.service systemd-remount-fs.service
158
lvm2-lvmpolld.socket [email protected]
159
lvm2-monitor.service systemd-shutdownd.service
160
[email protected] systemd-shutdownd.socket
161
machine.slice systemd-suspend.service
162
machines.target systemd-sysctl.service
163
[email protected] systemd-timedated.service
164
[email protected] systemd-tmpfiles-clean.service
165
[email protected] systemd-tmpfiles-clean.timer
166
mdmonitor.service systemd-tmpfiles-setup-dev.service
167
[email protected] systemd-tmpfiles-setup.service
168
messagebus.service systemd-udevd-control.socket
169
microcode.service systemd-udevd-kernel.socket
170
ModemManager.service systemd-udevd.service
171
multipathd.service systemd-udev-settle.service
172
multi-user.target systemd-udev-trigger.service
173
multi-user.target.wants systemd-update-done.service
174
netcf-transaction.service systemd-update-utmp-runlevel.service
175
NetworkManager-dispatcher.service systemd-update-utmp.service
176
NetworkManager.service systemd-user-sessions.service
177
NetworkManager-wait-online.service systemd-vconsole-setup.service
178
network-online.target system.slice
179
network-online.target.wants system-update.target
180
network-pre.target system-update.target.wants
181
network.target target.service
182
nfs-blkmap.service tcsd.service
183
nfs-client.target [email protected]
184
nfs-config.service timers.target
185
nfs-idmapd.service timers.target.wants
186
nfs-idmap.service time-sync.target
187
nfs-lock.service tmp.mount
188
nfslock.service tuned.service
189
nfs-mountd.service udisks2.service
190
nfs-rquotad.service umount.target
191
nfs-secure.service upower.service
192
nfs-server.service [email protected]
193
nfs.service usbmuxd.service
194
nfs-utils.service user.slice
195
nss-lookup.target var-lib-nfs-rpc_pipefs.mount
196
nss-user-lookup.target vgauthd.service
197
ntpdate.service virt-guest-shutdown.target
198
ntpd.service virtlockd.service
199
numad.service virtlockd.socket
200
oddjobd.service virtlogd.service
201
packagekit-offline-update.service virtlogd.socket
202
packagekit.service vmtoolsd.service
203
paths.target [email protected]
204
plymouth-halt.service wpa_supplicant.service
205
plymouth-kexec.service zram.service
206
207
208
209
[[email protected] system]# cd /etc/systemd/system/ && ls -l
210
total 4
211
drwxr-xr-x. 2 root root 31 Oct 28 11:21 basic.target.wants
212
drwxr-xr-x. 2 root root 31 Oct 28 11:20 bluetooth.target.wants
213
lrwxrwxrwx. 1 root root 41 Oct 28 11:20 dbus-org.bluez.service -> /usr/lib/systemd/system/bluetooth.service
214
lrwxrwxrwx. 1 root root 41 Oct 28 11:20 dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service
215
lrwxrwxrwx. 1 root root 44 Oct 28 11:21 dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/system/avahi-daemon.service
216
lrwxrwxrwx. 1 root root 44 Oct 28 11:21 dbus-org.freedesktop.ModemManager1.service -> /usr/lib/systemd/system/ModemManager.service
217
lrwxrwxrwx. 1 root root 46 Oct 28 11:20 dbus-org.freedesktop.NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
218
lrwxrwxrwx. 1 root root 57 Oct 28 11:20 dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service
219
lrwxrwxrwx. 1 root root 36 Oct 28 11:25 default.target -> /lib/systemd/system/graphical.target
220
drwxr-xr-x. 2 root root 87 Oct 28 11:20 default.target.wants
221
drwxr-xr-x. 2 root root 38 Oct 28 11:21 dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants
222
lrwxrwxrwx. 1 root root 35 Oct 28 11:21 display-manager.service -> /usr/lib/systemd/system/gdm.service
223
drwxr-xr-x. 2 root root 32 Oct 28 11:20 getty.target.wants
224
drwxr-xr-x. 2 root root 65 Oct 28 11:27 graphical.target.wants
225
drwxr-xr-x. 2 root root 4096 Oct 28 11:27 multi-user.target.wants
226
drwxr-xr-x. 2 root root 26 Oct 28 11:21 printer.target.wants
227
drwxr-xr-x. 2 root root 31 Oct 28 11:20 remote-fs.target.wants
228
drwxr-xr-x. 2 root root 188 Oct 28 11:21 sockets.target.wants
229
drwxr-xr-x. 2 root root 36 Oct 28 11:21 spice-vdagentd.target.wants
230
drwxr-xr-x. 2 root root 26 Oct 28 11:20 sssd.service.d
231
drwxr-xr-x. 2 root root 169 Oct 28 11:20 sysinit.target.wants
232
drwxr-xr-x. 2 root root 44 Oct 28 11:20 system-update.target.wants
233
drwxr-xr-x. 2 root root 29 Oct 28 11:20 vmtoolsd.service.requires
Copied!
As you have probably seen Systemd works with different dependencies:
Dependency
Description
Requires
define unit files must beloaded, if not load it
wants
[seen in targets], specify unit files which must be loaded but if not, takes it easy and continue
requisite
must be already loaded, if not loaded fails
confilicts
unit files which never be activated with current unit file
before
current unit files activated before listed unit files
after
current unit file activated after listed unit file

systemctl

systemctl is systemd magic command to work with services:
systemctl useful commands
systemctl start <ServiceName>
to start a service
systemctl stop <ServiceName>
to stop
systemctl disable <ServiceName>
disable it, won't be activated even after reboot
systemctl enable <ServiceName>
enable a service
systemctl relaod <ServiceName>
reload a service by reading its conf file,[might not work]
systemctl restart <ServiceName>
stop and start a service
systemctl list-unit-files --type=service
same as chkconf --list but in systemd environment
systemctl daemon-reload
Reload systemd Daemon, used after unit files modification
systemctl list-depencencies
List targets and services dependencies

For the History:

Distro
Pre 2006
2006 (14.04)-2019
2015(15.10)-????
ubuntu
SysV
Upstart
Systemd
2007
2011-2020
2014-????
centOS
SysV (centOS 5)
Upstart (centOS6)
systemd (centOS 7)
.
.
.
Last modified 2yr ago