Systemd

The controversial systemd


I recently went to a talk given at Facebook by Lennart Poettering. Systemd will be replacing sysvinit in the upcoming REL 7 distribution in Red Hat Linux, the Linux operating system that is commonly used in some enterprises. What interests me are the container features that it provides as an alternative to the docker style container system.

Before Systemd

Sysvinit

Upstart

Systemd

Inspirations from

  1. Launchd
    • Socket activation
    • Inetd
  2. SMF
    • Solaris management framework

Features of Systemd

  1. Modular
    • Can turn off most features except 3

Basic concepts

  1. Everything is a unit Foo.service Bar.device Waldo.target Another.socket Something.automount

  2. Dependencies (-> requires) Multi-user.target -> http.service -> basic.target -> local-fs.target -> home.mount -> Systemd-fsck@dev-sda6.service -> dev-sda7.device

This example above is a dependency check for a web (http service). You can use system graph to see dependencies

Example of parent and child process double forking (the classic example)

Starting a service at service level 3

Systemd family

Systemctl stop service

Systemctl restart

Systemctl status

Systemctl show

Systemctl cat (don’t have to go to the directory file/folder) Systemctl edit - tell MySQL to change the cpu to use

More daemons Systemd-udevd

Systemd-logind Systemd-journald

Systemd-networkd

Systemd-resolved

Systemd-timesyncd

Systemd-locald Systemd-hostnamed

Others for bootup Systemd-tmpfiles

Systemd-sysusers

System-module-load

Systemd-binfmt Format binaries such as Java

Systemd-backlight Manages background lighting actors reboot

Systemd-random-seed Saves randomness seed across reboot

Journalctl Log error, really useful, time zone correctly - unlike syslog, or chroot which is a steam

Systemctl

Loginctl Show session Show user log

Machinectl Useful for containers

Coredumpctl Collects core dumps Ex: coredumpctl gdb If used this way every coredump is logged

Busctl What interfaces methods and dbus messages each message offer

Systemd-nspawn

Systemd-machined

Via machined Ps Systemctl -M In this container very thing is okay or 5 failed Loginctl -M who is logged in within this container Systemctl list-containers

Container Nspawn

VM Kvm

Systemd-import Uncompressed/unzip and then call nspawn Add more containers (and VMs) to your local system

Nspawn va docker Docker’s philosophy

Systemd

Summary

See image

Q&A

  1. how do you deal with trolls
    • Cost of open source
  2. tools are tightly bundled
    • networkd makes assumptions about how the system is run /var Assumptions that certain mounts and libraries exist Vendor for the operation system should integrate for you
    • it doesn’t run on FreeBSD, Solaris SMF is not inherently portable either. Making it portable is a burden and it’s not a priority for Debian.
    • benefits code is more minimal.

If you buy rel 7 (red hat) you should get systemd preconfigured

Nspawn now works on non systemd systems now but it’s not officially supported.

  1. Inotify fix request - reload file from disk every 10 minutes.
    • Notify sync
    • Unix doesn’t have a transactional file system.
    • Snapshot from dbus on disk is non trivial
  2. Opinionated Syslog flaws, journal log say the earliest and everything is logged Consolek replaced by logind

  3. Journal-remote Journal over http protocol., understands ssl
    • Export to handle coredump (binary) plus json
    • provides both push and pull based logging
    • pull based in at times useful
  4. Claims only 99% compatibility with old style fs Not sysvinit 100% compatibility