Red Hat Bugzilla – Bug 1278928
dracut unconditionally includes systemd-modules-load.service even if not needed
Last modified: 2017-08-08 08:22:09 EDT
Description of problem:
When building a new initramfs, /usr/lib/dracut/modules.d/00systemd/module-setup.sh unconditionally includes $systemdutildir/systemd-modules-load into the initramfs. It does this even if --no-kernel was specified (because a custom kernel already has builtin all the drivers needed to mount the rootfs), and there are no kernel modules present in the initramfs.
The end result is a totally spurious systemd error messages saying
that systemd-modules-load.service failed.
Putting systemd-modules-load into the initramfs should be dependent on actually having modules to load - and further down in function install() we *do* know if we have modules or not. It probably should defer installing the systemd unit until that time.
Version-Release number of selected component (if applicable):
Boot with an initramfs built with --no-kernel and no modules in the initramfs image.
Steps to Reproduce:
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.
More information and reason for this action is here:
Created attachment 1147796 [details]
Patch to not include the systemd-modules-load service if -no-kernel was specified. There won't be any .ko's in the image, so including the service produces a spurious 'Loading kernel modules failed' at boot.
Hmm, another use case of "--no-kernel" is also to split the initramfs in two parts.
1. user space
2. kernel modules
So, you can exchange one for a newer version, without recreating the other part.
Why does systemd-modules-load.service fail?
Well, it doesn't actually *log* anything because it happens in very early boot, and apparently journald isn't running yet.
But I'm pretty sure it's because it finds it has loaded zero modules (because there are no modules to be loaded), and it thinks it has failed in its mission.
In any case, it's something that we can know up front doesn't need to run, so skipping it helps the boot time slightly.
I've seen zero documentation on how to actually use a split initramfs - where is the use case documented? (Although this probably *should* still work, as if you're loading 2 initramfs's, one for userspace that was built with --no-kernel, and a second one for kernel modules, the 3 files in question will still get included from the kernel-module initramfs - as *that* one *can't* be built with 'dracut --no-kernel')
(In reply to Valdis Kletnieks from comment #4)
> Well, it doesn't actually *log* anything because it happens in very early
> boot, and apparently journald isn't running yet.
> But I'm pretty sure it's because it finds it has loaded zero modules
> (because there are no modules to be loaded), and it thinks it has failed in
> its mission.
> In any case, it's something that we can know up front doesn't need to run,
> so skipping it helps the boot time slightly.
> I've seen zero documentation on how to actually use a split initramfs -
> where is the use case documented? (Although this probably *should* still
> work, as if you're loading 2 initramfs's, one for userspace that was built
> with --no-kernel, and a second one for kernel modules, the 3 files in
> question will still get included from the kernel-module initramfs - as
> *that* one *can't* be built with 'dracut --no-kernel')
Well, you can specify multiple initramfs in your boot loader or just concatenate them manually.
The kernel will unpack one after the other in the ramdisk.
$ dracut --no-early-microcode --kernel-only --hostonly test-kernel.img
the test-kernel.img only contains kernel modules and firmware files.
$ dracut --no-kernel --hostonly test-nokernel.img
will not contain any kernel modules
$ cat test-nokernel.img test-kernel.img > test-all.img
and test-all.img used as an initramfs will just boot as if there was no split.
And no, the test-kernel.img would not contain systemd-modules-load service .
But yeah, one could optimize for the case, where neither "--no-kernel" nor "--kernel-only" is set and no kernel modules installed, but I rather fix the configuration files in /etc/modules-load.d /usr/lib/modules-load.d in the initramfs, to not include any kernel modules, which are not installed in the initramfs.
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora 'version'
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.