Commit Graph

5755 Commits (053)

Author SHA1 Message Date
Colin Walters 6b8ee4fc37 Don't print when a module is explicitly omitted (by default)
dracut builds today are fairly verbose to start, but on top of
that many of the messages tend to liberally use the
exclamation point `!` which calls attention to them.

I see these a lot when looking at rpm-ostree build logs
and it'd be nicer if we were quiet when there wasn't
an actual problem.

In this specific case, if the builder is explicitly adding
`--omit=foo`, there's no reason for us to say:

`dracut: dracut module 'foo' will not be installed, because it's in the list to be omitted!`

We already print the command line to start, so the information
is there.

Demote this message to debug.
2020-11-14 19:38:29 +01:00
Daniel Molkentin 5840c466dc 95nfs: /var/lib/nfs/statd/sm is /var/lib/nfs/sm on SUSE
Reference: boo#1177462
2020-11-14 19:28:56 +01:00
Daniel Molkentin e0524af2bf Retrieve service, rpc and protcol entries via getent in hostonly mode
Sometimes, systems have more elaborate backends in nsswitch.conf,
the complexity of which we do not want in the initrd. SUSE systems
with atomic for instance, where those files may also reside in /usr/etc.

With this change, the unavaiable nsswitch.conf backends will be silently
ignored, and we still end up with all the information we need.

Reference: boo#1165366
2020-11-14 19:28:56 +01:00
Daniel Molkentin 1ec85e5232 Remove uses of bash (and bash specific syntax) in runtime scripts
dracutinstall picks up interpreters and includes bash despite
the users' wishes or expectations, as modules should not require
bashisms at runtime.

Fixes #951
2020-11-14 16:36:38 +01:00
Jonathan Lebon a23a4680e7 90crypt: pull in remote-cryptsetup.target enablement
This should've been part of #964. As mentioned there, the
`initrd-cryptsetup.target` approach was reverted in the end, and we went
back to relying in `remote-cryptsetup.target`:

https://github.com/systemd/systemd/pull/17467

So we do need to ship the enablement symlink for it.
2020-11-14 15:30:34 +01:00
David Tardon 0f89c0dff6 90multipath: install kpartx's 11-dm-parts.rules
This makes /dev/disk/by-uuid links point to the right device.
2020-11-14 15:15:13 +01:00
Jonathan Lebon 09804a4629 Revert "90crypt: ship initrd-cryptsetup.target"
This reverts commit 8f56daa8c3.

The addition of `initrd-cryptsetup.target` was reverted in systemd:
https://github.com/systemd/systemd/pull/17467
2020-11-05 14:22:52 +01:00
Kairui Song 831e310adf 90qemu-net: install less module for strict hostonly mode 2020-10-30 10:13:37 +01:00
Kairui Song 5698258d30 90qemu-net: in hostonly mode, only install if network is needed
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song 3b45c7e1a0 95nfs: Install less module if hostonly mode is strict
For strict hostonly mode, only install currently loaded modules instead
of a bunch of driver that may not be needed.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song 5817934936 90kernel-modules: Install less modules for hostonly mode
Rearrange some module installation mode, install less modules for
hostonly mode.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song 6375d5d504 90kernel-modules: install block drivers more strictly
For strict hostonly mode, only install block drivers needed for hostonly
devices.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song 5a49fd3656 04watchdog-modules: Simplify install_kernel using new added helper
The new added get_dev_modules helper can help simplify the driver
detection code by a lot.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song cbafcd0fc7 dracut-init.sh: Add a helper for detect device kernel modules
Use udevadm to detect the required kernel modules to load a given
device. udevadm will follow the device chain, help detect all required
parent device drivers as well.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song ab17cb8515 dracut-functions.sh: Fix check_block_and_slaves_all
check_block_and_slaves_all $func $dev should return 0, if $func return 0
for any checked device. Currently if any device don't have any sub
device, 1 is returned instead.

So remove the sub device checking statement. Also remove the same
statement in check_block_and_slaves, the "[[ -f $_x/dev ]]" in the for
loop is enought to ensure sub device exists.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song c69961b403 90kernel-network-modules: Don't install iscsi related module
These modules are installed in 95iscsi, no need to repeat here.
2020-10-26 14:16:19 +01:00
Kairui Song 1e92f7285d Add a --hostonly-nics option
Currently when network is enabled, dracut will install all network
drivers that are currently loaded, but some time only one NIC is needed
for the initramfs.

So for strict hostonly mode, add a --hostonly-nics option, user can
provide a list of NICs to be enabled, and only needed drivers for
specifed NICs will be installed so save space.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-26 14:16:19 +01:00
Rumbaut Thomas e4483e5917 Configure the runner for team interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=1881463
2020-10-26 12:52:24 +01:00
Kairui Song 83c65fd3db 99squash: Check require module earlier, and properly
Let 99squash fail earlier if required modules are not enabled or
missing, using the new added helper.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-21 17:04:00 +02:00
Kairui Song c050190f86 dracut-functions: add a helper to check if kernel module is available
It's like check_kernel_config, help to check if a kernel module is
enabled (cover built-in or compiled module case).

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-21 17:04:00 +02:00
Jonathan Lebon 8f56daa8c3 90crypt: ship initrd-cryptsetup.target
This was added in https://github.com/systemd/systemd/pull/17149 and is
the designated cryptsetup target for all encrypted volumes that need to
be opened in the initrd.

So it effectively replaces `cryptsetup.target` and
`remote-cryptsetup.target` there. I've removed the latter since it was
added recently (by me) in #930, but kept `cryptsetup.target` since we've
been shipping it for a long time now.
2020-10-21 16:43:53 +02:00
Jonathan Lebon 9fb2431a88 Revert "90crypt: pull in remote-cryptsetup.target enablement"
This reverts commit 7ea391b527.

We've moved away from this in
https://github.com/systemd/systemd/pull/17149.
2020-10-21 16:43:53 +02:00
Frederick Grose 12ab0dce66 dmsquash-live/iso-scan: Provide an easy reference to iso-scan device.
With commit 3c8c807, /run/initramfs/isoscan and /run/initramfs/live
mountpoints are unmounted upon rd.live.ram boots.  Save a link to
the iso-scan device in /run/initramfs/isoscandev to easily remount
the source, if desired.
2020-10-20 15:46:49 +02:00
Daniel Molkentin f51d013384 99memstrack: use /bin/bash
/usr/local/bin causes trouble for distros that do not use /usr/bin == /bin
/usr/bin/env likewise, plus the use of env is not needed here
2020-10-12 14:05:09 +02:00
Jonathan Lebon 512c51d267 98dracut-systemd: don't wait for root device if remote cryptsetup active
This is a plain and simple hack around dependency issues between dracut
and systemd.

When using Tang-pinned LUKS root devices, we want to rely on
`systemd-cryptsetup@.service` to unlock it. However, that service only
runs `After=remote-fs-pre.target`, while `dracut-initqueue.service` has
`Before=remote-fs-pre.target` (which makes sense because we don't want
to attempt networked root devices before networking is up).

However, the rootfs-generator here wants to make sure that the root
device exists *before* exiting the initqueue via an initqueue/finished
"devexists" hook. This will never work though because by design
`systemd-cryptsetup@.service`, which unlocks the root device, won't run
until after we exit.

So we have a dependency cycle:

    initqueue -> devexists hook -> root device ->
        systemd-cryptsetup@.service -> remote-fs-pre.target -> initqueue

There's no clean way to break this. The root issue is that there's no
way right now to split sequencing of systemd services across the
initqueue/online and initqueue/finished events because it's all bundled
in a single service. (The deeper root issue of course is that we have
two init systems. :) ).

Here we do a tactical fix: if there's a `systemd-cryptsetup@.service`
instance, let's assume it's for the root device and skip waiting for it
to show up if it depends on `remote-fs-pre.target`.
2020-10-12 11:07:41 +02:00
Đoàn Trần Công Danh 7990ab91f9 cryptroot-ask: unify /etc/crypttab and rd.luks.key
dracut feeds whatever it receives in password field of
crypttab(5) to `cryptsetup -d`, treating them as plain-text key file.

Meanwhile, dracut treats the key file from `rd.luks.key` differently,
by have some special rules to decrypt those key files that has extension of
`gpg` and `img`.

Let's begin to treat them the same.

This is a backward-incompatible change for those people
that uses plain-text key-file that has extension of `gpg` and `img`.
However, those setup is questionable to begin with.
2020-10-08 13:56:44 +02:00
Nicolas Chauvet a298f5f285 90kernel-modules: arm: add drivers/hwmon for arm/arm64
In the case of the s805x the drivers/hwmon directory contains the
scpi_hwmon kernel module.
On a running system, lsmod would output the following dependencies:
 arm_scpi               24576  2 clk_scpi,scpi_hwmon

It means that if the clock driver is bundled in the initramfs it will
bring arm_scpi. But if scpi_hwmon is missing the scpi will be incomplete
and it can lead to crashes.

When the hwmon is bundled, no crash occurs

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-10-07 16:04:08 +02:00
Đoàn Trần Công Danh 811c814677 rootfs-block: only write root argument for block device
Some filesystem (e.g. ZFS, and btrfs subvolumes) don't use block
devices. Should they be mounted as `/`, `find_root_block_device`
yields nothing, hence dracut will append this problematic argument
to kernel cmdline:

	root=/dev/block

On a machine that employ root ZFS on LUKS, which was setup with
an OpenPGP-encrypted key file, this argument renders that machine
unbootable. Remove that `root=/dev/block` manually could boot the
machine.

Let check if that device is a block device before write down `root`
argument. This is consistent with the check for block device in
`find_block_device`.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2020-10-05 17:17:40 +02:00
Jonathan Lebon 7ea391b527 90crypt: pull in remote-cryptsetup.target enablement
This is enabled upstream in
https://github.com/systemd/systemd/pull/17149.
2020-10-05 15:53:32 +02:00
Jonathan Lebon 7c923f1de8 00systemd: add missing cryptsetup-related targets
We want these in the initramfs. Things related to clevis and systemd's
`cryptsetup-generator` reference these targets.
2020-10-05 14:43:58 +02:00
Hannes Reinecke 251b424727 95nvmf: Implement 'fc,auto' commandline syntax
Add a 'fc,auto' commandline syntax for nvmf.discover to force
nvmf autodiscovery on FC-NVMe.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Hannes Reinecke 0e2ef80993 95nvmf: add nvmf-autoconnect script
Add a script to run FC autoconnect.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Hannes Reinecke f0ac6cb462 95nvmf: Fixup FC connections
D-Bus doesn't run in the initrd, so our usual trick of activating
custom systemd services from udev doesn't work.
So add a rule to create initqueue entries for each possible
connection.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Hannes Reinecke e9a614b50c 95nvmf: add documentation
Add documentation for 95nvmf module to dracut.cmdline

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Hannes Reinecke 4087fd4d1a 95nvmf: rework parameter handling
Always add the nvmf.discover parameters to /etc/nvme/discovery
when parsing the dracut commandline, and rely on NVMe autodiscovery
when no parameters are given.
And modify the syntax to use a comma ',' as a separator for nvmf.discover
as the semicolon ':' is already used for the FC-NVMe transport address format.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Daniel Molkentin ee9b9b1241 dracut-install: fix edge-case regression with weak modules
This was introduced with 6dafdda4a6, but
is actually caused by the fact that modules that have already been
installed cause dracut_install() to return without adding the module
to the hashmap. This can happen if an earlier-run dracut module chose
to install the same module. Now modprobe statements like:

softdep usb_storage post: uas
softdep uas pre: usb_storage

(which look weird, but are perfectly valid), cause
dracut_install() to enter an infinite recursion if and only if
at least one of the files has previously been installed by another
module.

Fix this by also adding already installed modules to the hashmap.
2020-10-02 15:49:09 +02:00
David Tardon 4916dfc2b9 dracut-install: ignore bogus preload libs
If there are any nonexistent libraries listed in /etc/ld.so.preload, ldd
prints error messages like:

ERROR: ld.so: object '/usr/lib64/libfoo.so.1' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.

This causes resolve_deps() to return error, which leads to symlinks
(like usr/bin/awk) not being copied into the initrd.
2020-10-02 15:34:40 +02:00
Harald Hoyer ee6ce31003 dracut.spec: Use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
2020-10-02 14:05:51 +02:00
Harald Hoyer 9eb1d1ed5e dracut.spec: remove fedora pre 30 quirks 2020-10-02 13:48:48 +02:00
Nicolas Chauvet dee4f26adc 50drm: Check drm_encoder_init along drm_crtc_init
Some modules are involved in the display output without to rely on
drm_crtc_init.

This is the case for the meson_dw_hdmi. This module need to be included
into the initramfs in both hostonly and generic modes.

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-09-28 21:08:12 +00:00
Nicolas Chauvet 5afd3cfc96 50drm: Include drm platform drivers in hostonly
On arm, many drm drivers are located in the plaform bus.

Adding the platform bus will allow drm drivers to be included in the
initramfs when using hostonly mode.

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-09-28 21:08:12 +00:00
Nicolas Chauvet 89cd7a4629 50drm: fix ambiguous redirects
If i contains a space, there is a need to protect the variable usage in some cases.

This will occurs when a next patch will enable platform bus with such case:
'/sys/bus/platform/devices/Fixed MDIO bus.0'

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-09-28 21:08:12 +00:00
Peter Robinson 38ea7e821b Include devfreq drivers in initrd
Some SoCs now have drivers that user devfreq in early init and fail
if the drivers are missing so make sure we have them in the initrd.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2020-09-23 13:44:21 +02:00
Beniamino Galvani f3e328a7fd dracut.spec: include the 04watchdog-modules module
Include the 04watchdog-modules module that was added in 39d90012a6
("04watchdog: split the watchdog module install").
2020-09-21 13:25:14 +02:00
Antz 37502d4c89 90crypt: make `rd.luks.key` usable with encrypted keydev.
Introduce prefix `keysource:` for the values of `rd.luks.partuuid`,
`rd.luks.serial` and `rd.luks.uuid`.
If specified, ask for passphrase instead of waiting for keydevs to come
online.
2020-09-18 21:59:00 +02:00
Kairui Song 39d90012a6 04watchdog: split the watchdog module install
In some cases, user only want to include the watchdog module, not the
wdctl or any other userspace helper. For example, systemd have a
RebootWatchdogSec option that use watchdog to prevent reboot hangs. And
it can help prevent machines hangs when reboot directly within the
initramfs stage. So split the module installation to a standlone module.

Also when watchdog-module get included, install driver for all loaded
watchdog instaed of only install driver for active watchdog. Both
watchdog and watchdog-module return 255 in check(), so it's enabled only
when manually included, the watchdog may get configured/activated later.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-09-17 14:52:48 +02:00
GuoChuang d76e9ad5d7 fix graphics startup failure with the rhgb paramter in CentOS8.2 2020-09-03 15:27:14 +02:00
Beniamino Galvani f87605e3ab dracut.cmdline.7.asc: fix typo 2020-09-02 22:35:28 +02:00
Daniel Molkentin a5372b8ba8 Add --version to man page 2020-08-28 23:28:25 +02:00
Daniel Molkentin ff2d8bdfb3 dracut.sh: Add --version 2020-08-28 23:28:25 +02:00