[systemd-devel] experiments with 'minimal build'

Jeff Waugh jdub at bethesignal.org
Wed Mar 18 01:40:46 PDT 2015

On Wed, Mar 18, 2015 at 6:07 PM, Alison Chaiken <alison at she-devel.com>

> 1. With ./configure --disable-gtk-doc --disable-seccomp
> --disable-selinux --disable-apparmor --disable-xz --disable-zlib
> --disable-pam --disable-acl --disable-smack --disable-gcrypt
> --disable-audit --disable-elfutils --disable-libcryptsetup
> --disable-qrencode --disable-microhttpd --disable-gnutls
> --disable-libcurl --disable-libidn  --disable-quotacheck
> --disable-vconsole --disable-logind --disable-machined
> --disable-importd --disable-hostnamed --disable-timedated
> --disable-localed --disable-polkit --disable-resolved
> --disable-networkd --disable-efi --disable-manpages
> --disable-hibernate --disable-tests
> [achaiken at localhost systemd (master)]$ ./systemd --version
> systemd 219

I'm interested in minimal builds too, as I've been learning the ins and
outs of systemd on a 32MB MIPS system about the size of a US quarter. (I
learn best by repeatedly punching myself in the face.)

Mantas clarified the memory measurement issue. It's one of those confusing
things about Linux that hasn't improved in 20 years. Here's a 10 year old
Perl script that occasionally comes in handy for more accurate memory


But usually, RSS is a good enough indicator.

Here's my build:

# /usr/lib/systemd/systemd --version
systemd 219

And because my tooling is somewhat limited on this device, here's the RSS
straight from the source:

# grep ^VmRSS /proc/1/status # systemd/init
VmRSS:      2584 kB

# grep ^VmRSS /proc/199/status # journald
VmRSS:      1452 kB

# grep ^VmRSS /proc/349/status # udevd
VmRSS:      1372 kB

# grep ^VmRSS /proc/356/status # dbus-daemon
VmRSS:      1528 kB

Even for my use case, booting directly into a squashfs filesystem, booting
failed when I disabled blkid. That doesn't worry me too much, because
ultimately systemd has to detect my flash (mtd) block devices, so it'll
probably be needed anyway. (The on-disk footprint of libblkid on my system
is 245.6K.)

I haven't disabled kmod, but could. That will mean the systemd binary won't
try to load unix, ipv6, and autofs4 modules when it starts, but I can build
those modules into the kernel (or load them prior to starting systemd). The
only trouble is that disabling kmod will disable systemd-modules-load. Not
sure if I really need that, but it's something to keep in mind. It may be
possible to patch out kmod use from systemd, such that only
systemd-modules-load would bring it in, but I'm not sure it's worth it.
(The on-disk footprint of libkmod on my system is 71.8K.)

The last + is +SYSVINIT, but there doesn't appear to be a configure option
to disable sysvinit compatibility anymore. From what I can tell, there's a
bit of sysvinit-related logic in the systemd binary itself, but most of the
icky bits are farmed off to helper binaries, such as the short-lived

The other part of minimal builds is on-disk footprint and avoiding implicit
work. So, I've aggressively split up my OpenWrt packages to let builders
choose what they need for their use case. This doesn't make a lot of sense
in beefy desktop or server land, but it's measurably important for
"embedded" deployments.

For example, by splitting out (and not installing) the sysvinit
compatibility support binaries, I save about 184K on-disk, plus a little
bit of time during boot. :-)

Here's my systemd packaging work for OpenWrt if anyone's interested (which
reminds me, I really need to push my latest changes):


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150318/6be57b24/attachment.html>

More information about the systemd-devel mailing list