<h2>1 What is systemd?</h2>
<p>A dependency system for unix services.<br />
And, a set of basic unix services to make a unix system usable.<br />
And, a growing list of not quite so basic services</p>
<ul>
<li>NTP, networkd, timers (crond/atd)
</li></ul>
<p>From a programmers perspective, it's the mainloop phenomenon.</p>
<h2>2 Alternatives</h2>
<p>Solaris: Service Management Facility<br />
Mac OSX: launchd<br />
Ubuntu: upstart (until recently)</p>
<h2>3 Replaces</h2>
<p>SYSV<br />
LSB (actually implements LSB deps)</p>
<h2>4 Terminology</h2>
<p>units</p>
<ul>
<li>[auto]mount</li>
<li>swap</li>
<li>path (inotify triggers)</li>
<li>socket</li>
<li>timer (crond/atd)</li>
<li>service</li>
<li>slice (cgroup)</li>
<li>pseudo<ul>
<li>device</li>
<li>snapshot</li>
<li>scope</li>
</ul>
</li>
</ul>
<p>targets</p>
<ul>
<li>replace run levels</li>
<li>default target at boot</li>
<li>can isolate to just one target</li>
</ul>
<h2>5 Advantages - Design</h2>
<p>Proper, explicit dependencies between system compontents<br />
Starts components in parallel<br />
A proper separation of concerns, lots of situations covered.</p>
<ul>
<li>configuration files are regular, simple to understand generally small</li>
<li>OTOH, there are LOTS of options</li>
</ul>
<p>Configuration is not runnable shell.</p>
<pre><code>[Unit]
Description=CUPS Scheduler
Documentation=man:cupsd(8)

[Service]
ExecStart=/usr/sbin/cupsd -l
Type=simple

[Install]
Also=cups.socket cups.path
WantedBy=printer.target
</code></pre>
<p>Separate system and user daemons.</p>
<h2>6 Advantages - Sysadmins</h2>
<p>Modify configuration without modifying upstream configuration<br />
Service watching (startup, watchdog, failure modes)<br />
systemd-delta</p>
<pre><code>[EXTENDED]   /lib/systemd/system/rc-local.service → /lib/systemd/system/rc-local.service.d/debian.conf
[EXTENDED]   /lib/systemd/system/systemd-timesyncd.service → /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf
[EQUIVALENT] /etc/systemd/system/default.target → /lib/systemd/system/default.target

3 overridden configuration files found.
</code></pre>
<h2>7 Advantages - Programming</h2>
<p>Removal of some error and security prone code</p>
<ul>
<li>socket activation (e.g. privileged ports)</li>
<li>user/group changing</li>
</ul>
<h2>8 Advantages - Provisioning</h2>
<p>standardized cgroup controls<br />
containers<br />
debootstrap ; systemd-spawn-boot
* systemd takes care of all pseudo file systems for you</p>
<h2>9 Advantages - Users</h2>
<p>quick to boot<br />
can reduce load later on (services start & stop as required)<br /></p>
<h2>10 Examples</h2>
<p>Color legend:</p>
<ul>
<li>black = Requires</li>
<li>dark blue = Requisite</li>
<li>dark grey = Wants</li>
<li>red = Conflicts</li>
<li>green = After</li>
</ul>
<p><a href="https://clintonroy.wordpress.com/a-systemd-primer/loom_boot.svg">systemd-analyze blame</a></p>
<p><a href="https://clintonroy.wordpress.com/a-systemd-primer/loom.svg">systemd-analyze plot</a></p>
<p><a href="https://clintonroy.wordpress.com/a-systemd-primer/loom_gdm.svg">systemd-analyze plot gdm.service</a></p>
<h2>11 Disadvantages</h2>
<p>Journald</p>
<ul>
<li>It’s really nice in theory, but in practice I’ve found it to be slow and buggy</li>
</ul>
<p>It’s a little new, so LTS distros necessarily have older versions</p>
<ul>
<li>el7 has something like 200 patches</li>
</ul>
<p>network-online.target is a bit flakey<br />
DBUS</p>
<ul>
<li>Unix is a graveyard of IPC, I don't feel DBUS is much better</li>
<li>KDBUS means it will probably be around for ever.</li>
</ul>
<h2>12 Quandries</h2>
<p>Deeply hooked into linux specific details, not portable</p>
<ul>
<li>kernel api, cgroups, udev etc.</li>
</ul>
<p>Some cool features relient on file system e.g. btrfs for snapshot</p>
<h2>13 Future</h2>
<p>I haven’t had a chance to play with networkd yet, but it sounds like it’s going to be very good.</p>
<h2>14 Questions</h2>
<p>Migrating</p>
<ul>
<li>It depends…</li>
<li>systemd only supports start/stop/reload</li>
<li>work with the daemon: oneshot/simple/forking/inetd</li>
<li>integrate with systemd: notify, watchdog</li>
</ul>
<p>Userspace</p>
<ul>
<li>Every login, a separate systemd -> user is spawned</li>
<li>Can override with .config/systemd files</li>
</ul>
