Bug 1278928 - dracut unconditionally includes systemd-modules-load.service even if not needed
dracut unconditionally includes systemd-modules-load.service even if not needed
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: dracut (Show other bugs)
24
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: dracut-maint-list
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-06 13:48 EST by Valdis Kletnieks
Modified: 2017-08-08 08:22 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-08 08:22:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
0099-fix-systemd-modules-load.patch (2.06 KB, patch)
2016-04-15 18:03 EDT, Valdis Kletnieks
no flags Details | Diff

  None (edit)
Description Valdis Kletnieks 2015-11-06 13:48:51 EST
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):
dracut-043-60.git20150811.fc24.x86_64

How reproducible:

Boot with an initramfs built with --no-kernel and no modules in the initramfs image.


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 Jan Kurik 2016-02-24 08:55:14 EST
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:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Comment 2 Valdis Kletnieks 2016-04-15 18:03 EDT
Created attachment 1147796 [details]
0099-fix-systemd-modules-load.patch

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.
Comment 3 Harald Hoyer 2016-04-18 07:17:10 EDT
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?
Comment 4 Valdis Kletnieks 2016-04-18 10:51:43 EDT
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')
Comment 5 Harald Hoyer 2016-04-22 05:28:30 EDT
(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.

So with
$ dracut --no-early-microcode --kernel-only --hostonly test-kernel.img

the test-kernel.img only contains kernel modules and firmware files.

while
$ 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.
Comment 6 Fedora End Of Life 2017-07-25 15:26:57 EDT
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'
of '24'.

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.
Comment 7 Fedora End Of Life 2017-08-08 08:22:09 EDT
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
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.