From ArchWiki
Revision as of 09:50, 17 September 2010 by Zom (talk | contribs) (Initial article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Systemd an event-based init system which is meant to replace the old sysvinit. It provides an automatic way of starting, restarting or stopping services depending on different triggers.

It is under heavy development and as such might not be suitable for your everyday computer needs. Use caution.

How it works

Lets say you get disconnected from your network, you might want to stop sshd and avahi. Systemd does this for you, and once you reconnect those services will be available again. The same goes for hardware. Say you have a printer and a bluetooth dongle. There's no need for cups or bluetoothd to run while those things are disconnected.

There's also no reason for things like sshd running while nobody is connected to the machine. Systemd listens to the ssh socket, and once someone connects it starts sshd, and when the last user disconnects it stops sshd.

There are 3 main goals in mind for systemd:

  • Starting as many services in parallel as possible.
  • Monitoring daemons (Like Monit)
  • Listening to sockets and controlling services (Like inetd)

Systemd vs. Upstart

While both Upstart and Systemd have a event-based init system, they don't share any code. There are also some differences in philosophy. When D-Bus is started in Upstart, everything depending on D-Bus will also be started (e.g. NetworkManager).

In contrast, systemd works in the reverse. When NetworkManager is started, D-Bus will also be started since it's required by NetworkManager. Starting D-Bus is not an indicator that you want to start NetworkManager, but that everything which relies on D-Bus can now be started.

So instead of running all the possible services when an event is triggered, systemd has a specific goal in mind.

Installing systemd

Falconindy has done a wonderful job porting systemd to Arch and there are packages ready on AUR to get you started. First you need to install the following:


You also need to patch the extra/docbook-xsl PKGBUILD before building systemd-git. Simply download the PKGBUILD and run:

$ sed -i 's/xhtml/&{,-1_1}/' PKGBUILD

then build it with makepkg and install it.

To take advantage of the systemd way of starting services, you might also want the arch units package from AUR: systemd-arch-units

Finally, to test systemd you just need to add init=/bin/systemd to the kernel line in GRUB.

Configuring systemd

The available services or units can be seen in /lib/systemd/system. You can use:

$ systemctl start <service>

to start services with systemd. To automatically start a service on boot use:

$ systemctl enable <service>

All right, so far so good, but lets take it a step further. Right now, the regular Arch initscripts is still used to start the base system. To fully make use of systemd you'll want to replace those initscripts.


You can install the systemd initscripts from AUR. However, until now you could easily switch back to the old sysvinit by just removing the init=/bin/systemd from the kernel line, installing this package won't let you do that anymore. If something breaks in systemd, your system won't be able to boot properly and you'll probably need a livecd to restore the old sysvinit.

Only do this if you're very sure of what you're doing. The package can be found on AUR: initscripts-systemd-git

Helping out

Currently, systemd is under heavy development. Help is very welcome. You can fork the GIT repo and then put pull requests for your code. You can also help by translating the old daemons in Arch to the newer systemd format.

If unsure, just ask in the thread in the Arch forums.

More resources

Lennart Poettering on systemd

falconindy's article on systemd in Arch

The systemd thread on the Arch forums

falconindys packages on AUR