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

Dave Young dyoung at redhat.com
Fri Jan 3 03:48:53 UTC 2020


On 01/03/20 at 11:45am, Dave Young wrote:
> On 01/02/20 at 09:02am, Zbigniew Jędrzejewski-Szmek wrote:
> > 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 vaguely remember the size increased before due to linking with libidn2
> previously, so those libraries contribute a lot.
> 
> Does every systemd binary depend on all libraries? Or each of the
> systemd binary only depends on those libs when really needed?

For example if I do not need journalctl, then I can drop journalctl and
those libraries specific for journalctl?

> 
> Thanks
> Dave



More information about the systemd-devel mailing list