[systemd-devel] Minimize systemd for kdump's initramfs

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Jan 2 09:02:30 UTC 2020


On Thu, Jan 02, 2020 at 12:21:26AM +0800, Kairui Song wrote:
> Some component, like Systemd, have grown by a lot, here is a list of
> the size of part of binaries along with the binaries they required in
> F31:
> /root/image/bin/systemctl
> 20M     .
> /root/image/usr/bin/systemctl
> 20M     .
> /root/image/usr/bin/systemd-cgls
> 20M     .
> /root/image/usr/bin/systemd-escape
> 20M     .
> /root/image/usr/bin/systemd-run
> 20M     .
> ...
> 
> There are overlays between the libraries they used so when installed
> into the initramfs, the total size didn't go too big yet. But we can
> see the size of systemd binary and libraries it used is much bigger
> than others.

All systemd binaries will mostly link to the same libraries (because
they link to a private shared library, which links to various other
shared libraries). So this "20M" will be repeated over and over, but
it's the same dependencies.

While we'd all prefer for this to be smaller, 20M should is actually
not that much...

> And as a compare, from version 219 to 243, systemd's library
> dependency increased a lot:
> (v219 is 5M in total, v243 is 20M in total)

This is slightly misleading. Code was moved from individual binaries
to libsystemd-shared-nnn.so, so if you look at the deps of just a single
binary, you'll see many more deps (because libsystemd-shared-nnn.so has
more deps). But the total number of deps when summed over all binaries
grew much less. A more useful measure would be the size with deps summed
over all systemd binaries that are installed into your image in v219 and
v243.

I don't have a link at hand, but there's work being done to use openssl
for all crypto, which would reduce the dependency list nicely.

> Is there any way to have a smaller systemd binary that is just enough
> to boot the initramfs into the stage before switch-root?

We don't have anything like this now, sorry!

Zbyszek


More information about the systemd-devel mailing list