Why systemd in Embedded Linux Systems?

Posted by Cliff Brake on 2013-12-11 | 2 Comments to Read

Recently I was asked why use systemd vs sysvinit in embedded systems?  There are many discussions on this, and really most of the reasons people use it for servers and desktops are also valid for embedded systems.  Lennart Poettering’s articles explain very well why you might want to consider systemd.  A few things that rank high on my list:

  1. systemd systems generally boot must faster than sysvinit systems.
  2. systemd monitors every process it starts, so you know conclusively if your app is still running.
  3. systemd has flexible mechanisms for restarting apps that crash, and rebooting if you get so many restarts in X amount of time.  This is very important in embedded systems where you need to keep things running.
  4. systemd logging (journald) is very flexible.  The stdout of every process that is started by systemd is captured in the journal.  You can also capture kernel messages in the journal.  The end result is you have one place to look for system logs.
  5. systemd has support for watchdog chaining — again, important for many embedded systems.
  6. The systemd dependency mechanism is very flexible.
  7. systemd has tools to debug the init process: systemd-analyze, systemd-cgls, systemd-cgtop, bootchart, pybootchargui, etc.
  8. on demand launch of services can improve boot time and conserve resources.

In summary, with systemd I have more control over the system startup and shutdown, and have better mechanisms to monitor things to make sure they stay running.

  • Chris Cole said,

    Is systemd suitable for a space-constrained embedded system? (rootfs < 10 MB)

    What is the impact on image size when migrating from sysvinit to systemd? Are there a lot of dependencies?

    Any impact on power consumption?

  • Cliff Brake said,

    The following is from an older build, but should give you some idea of the size of systemd:

    grep systemd build/tmp-angstrom_next-eglibc/buildhistory/images/machine-x/eglibc/omap-image/installed-package-sizes.txt
    1412 KiB systemd
    48 KiB libsystemd-journal0
    8 KiB libsystemd-daemon0
    4 KiB xinput-calibrator-systemd
    4 KiB wpa-supplicant-systemd
    4 KiB udev-systemd
    4 KiB systemd-serialgetty
    4 KiB systemd-compat-units
    4 KiB openssh-sshd-systemd
    4 KiB dbus-systemd
    4 KiB busybox-syslog-systemd
    4 KiB avahi-systemd

    sysvinit is much smaller — I’m guessing in the < 100KB range from looking at an older machine, so systemd is not typically used in space constrained systems (like an initramfs, or a very simple system). I don't think there would be much impact on power consumption.