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

Dan Nicholson nicholson at endlessm.com
Fri Jan 3 20:04:59 UTC 2020


On Wed, Jan 1, 2020 at 9:21 AM Kairui Song <kasong at redhat.com> wrote:
>
> Hi all,
>
> I noticed there is a Fedora minimization project which seems could be
> a bit related to the thing I'm trying to do, and this could be a
> generic topic.
>
> What I'm trying to do is reduce the initramfs size used for kdump.
> Kdump loads a crash kernel and kdump initramfs image in a prereseved
> memory region, which get booted when current kernel crashed and
> perform crash dump. The prereserved memory is limited, so initramfs
> shouldn't go too big.
>
> Kdump in Fedora use Dracut to create bootable initramfs, just hook the
> final step to do kdump things instead of switch root. And to reduce
> the size only the binaries and drivers required to boot and perform
> kdump on current machine is installed. So long it have been working
> very well.
>
> But problem is Dracut works by reusing binaries and libraries from the
> currently running system, and many userspace binaries and libraries is
> keep growing and using more space. So the initramfs is also growing.

Can you arrange to run a different dracut command line for generating
the kdump initramfs? If so, then you can just leave out systemd (and
anything else you want) and add a dracut module that does the kdump
loading. Assuming you have a dracut module named kdump, this would
work:

dracut -o systemd -a kdump kdump.img

Or, if you know specifically which modules you want, you can specify them:

dracut -m "kdump some-other-required-module" kdump.img

Or, you could even supply a custom config file and/or directory on disk:

dracut -c /etc/dracut-kdump.conf --confdir /etc/dracut-kdump.conf.d kdump.img

See dracut(8) for many other options. Considering how narrow the use
case for this initramfs is intended to be, I really doubt you want to
take the generic initramfs and just tack on kdump. I think it would be
better to invoke dracut in a way to produce a specialized initramfs
for this purpose. I don't know how that would work in the fedora
packaging and booting land, but IMO that's what the focus should be -
figure out how to invoke dracut to make a minimal initramfs for
running kdump and then figure out how to support that in fedora.

--
Dan


More information about the systemd-devel mailing list