]> git.ipfire.org Git - thirdparty/dracut-ng.git/log
thirdparty/dracut-ng.git
22 months agofix(multipath): omit module if included with no multipath devices
Laszlo Gombos [Mon, 8 Jul 2024 15:18:01 +0000 (11:18 -0400)] 
fix(multipath): omit module if included with no multipath devices

Instead of warning the user, lets omit the module to follow
'Principle of Least Surprise'.

22 months agofeat(multipath): warn if included with no multipath devices and no user conf
Antonio Alvarez Feijoo [Tue, 29 Nov 2022 14:21:04 +0000 (15:21 +0100)] 
feat(multipath): warn if included with no multipath devices and no user conf

The multipath module is always included in no-hostonly mode, but including it in
the initramfs might activate multipath on the root device, which could be
undesirable. This behavior can be manually fixed by explicitly excluding the
root device from multipath in /etc/multipath.conf.

Therefore, issue a warning in no-hostonly mode, if there is no multipath device
and the user has not configured multipath.

bsc#1069169

Signed-off-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
22 months agofix(systemd): check for systemd-vconsole-setup.service
Laszlo Gombos [Thu, 4 Jul 2024 01:56:16 +0000 (21:56 -0400)] 
fix(systemd): check for systemd-vconsole-setup.service

22 months agofix(nfs): support rpcbind user named _rpc
Benjamin Drung [Mon, 8 Jul 2024 14:29:40 +0000 (16:29 +0200)] 
fix(nfs): support rpcbind user named _rpc

The Debian/Ubuntu package `rpcbind` creates a user named `_rpc`. Support
running `rpcbind` with that user. Add a helper function `get_rpc_user`
that derives the desired user from parsing `/etc/passwd`.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
22 months agofeat(dracut-install): configure if weak dep is still not supported in kmod
Jose Ignacio Tornos Martinez [Mon, 8 Jul 2024 11:41:24 +0000 (13:41 +0200)] 
feat(dracut-install): configure if weak dep is still not supported in kmod

The weak dependency feature is new and better be backward compatible.
So check in configure stage if the kmod used includes the weak dependency
feature so as not to include it here and avoid compilation errors.

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
22 months agofeat(dracut-install): add weak dependencies support
Jose Ignacio Tornos Martinez [Mon, 8 Jul 2024 11:06:56 +0000 (13:06 +0200)] 
feat(dracut-install): add weak dependencies support

It has been seen that for some network mac drivers (i.e. lan78xx) the
related module for the phy is loaded dynamically depending on the current
hardware. In this case, the associated phy is read using mdio bus and then
the associated phy module is loaded during runtime (kernel function
phy_request_driver_module). However, no software dependency is defined, so
the user tools will no be able to get this dependency. For example, if
dracut is used and the hardware is present, lan78xx will be included but no
phy module will be added, and in the next restart the device will not work
from boot because no related phy will be found during initramfs stage.

In order to solve this, we could define a normal 'pre' software dependency
in lan78xx module with all the possible phy modules (there may be some),
but proceeding in that way, all the possible phy modules would be loaded
while only one is necessary.

So, a new type of dependency has been created, that we are going to call
'weak' to be used only by the user tools that need to detect this situation.
In that way, for example, dracut could check the 'weak' dependency of the
modules involved in order to install these dependencies in initramfs too.
That is, for the commented lan78xx module, defining the 'weak' dependency
with the possible phy modules list, only the necessary phy would be loaded
on demand keeping the same behavior, but all the possible phy modules would
be available from initramfs.

The 'weak' dependency support has been already included in kmod:
https://github.com/kmod-project/kmod/commit/05828b4a6e9327a63ef94df544a042b5e9ce4fe7
And in kernel:
https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/commit/?h=modules-next&id=1f3dacc0dcef6681c2acf5890e018012f6b53085
After these, 'weak' dependencies for modules will start to appear.
Read the possible weak dependencies from dracut in order to take them into
account.

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
22 months agoperf(dracut-install): use driver/module sysfs dirs for module name
Alper Nebi Yasak [Mon, 3 Jun 2024 09:12:39 +0000 (12:12 +0300)] 
perf(dracut-install): use driver/module sysfs dirs for module name

To handle fw_devlink suppliers as dependencies, we traverse every device
in /sys and collect a hashmap of module names to their suppliers before
starting module installation work. The module names are found by reading
and passing the "modalias" file to the `kmod_module_new_from_lookup()`
function from libkmod. This function is unexpectedly slow on ARM64
systems with device-tree where this work is primarily necessary.

Usually (but not always), the running kernel has already looked up the
modalias and bound a driver from the associated module. Get module names
by resolving the "driver/module" symbolic link and taking its basename.
If it doesn't exist, fall back to looking up the modalias.

It's possible that multiple modules match the modalias, in which case
others will be ignored in favor of the one already chosen by the kernel.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
22 months agotest: drop 'quiet' from kernel cmdline on verbose runs
Benjamin Drung [Mon, 8 Jul 2024 09:39:06 +0000 (11:39 +0200)] 
test: drop 'quiet' from kernel cmdline on verbose runs

If the test cases are run in verbose with (i.e. with `V=1` or `V=2`
set), do not add `quiet` to the kernel cmdline.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
22 months agofix(net-lib): require and install only the necessary binaries
Antonio Alvarez Feijoo [Mon, 8 Jul 2024 07:17:54 +0000 (09:17 +0200)] 
fix(net-lib): require and install only the necessary binaries

- `pgrep`, `tr` not needed.
- `sed` installed by `base`.

22 months agofeat(lsinitrd.sh): support configurable initrd filenames
Benjamin Drung [Tue, 2 Jul 2024 20:15:57 +0000 (22:15 +0200)] 
feat(lsinitrd.sh): support configurable initrd filenames

The initrd filename can be configured via `initrdname`. Support this
feature also in `lsinitrd` (similar to the code in
`dracut-initramfs-restore.sh`).

Fix: 28820e205328 ("feat(dracut.sh): make initramfs-${kernel}.img filename configurable")
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
22 months agofix: check for searched initrds to be present
Benjamin Drung [Tue, 2 Jul 2024 20:15:41 +0000 (22:15 +0200)] 
fix: check for searched initrds to be present

`find_initrd_for_kernel_version` uses the same search order than
`kernel-install` from systemd v249 [1]. When
`dracut-initramfs-restore.sh` or `lsinitrd.sh` searches for initrds,
they should check the presence of the files instead of assuming them to
be present. Otherwise the search might be stopped before an existing
initrd is found. On Ubuntu 24.10 (oracular) with a mounted `/boot`:

```
$ ls /boot/initr* -alh
lrwxrwxrwx 1 root root  27 Jun 20 15:31 /boot/initrd.img -> initrd.img-6.8.0-31-generic
-rw-r--r-- 1 root root 22M Jun 20 16:27 /boot/initrd.img-6.8.0-31-generic
lrwxrwxrwx 1 root root  27 Jun 20 15:31 /boot/initrd.img.old -> initrd.img-6.8.0-31-generic
$ lsinitrd 2>&1 | head -n1
No <initramfs file> specified and the default image '/boot/efi/6491959c70e6481eae6406d25e250d76/6.8.0-31-generic/initrd' cannot be accessed!
```

[1] https://github.com/systemd/systemd/blob/v249/src/kernel-install/kernel-install

22 months agorefactor: introduce find_initrd_for_kernel_version
Benjamin Drung [Tue, 2 Jul 2024 20:14:40 +0000 (22:14 +0200)] 
refactor: introduce find_initrd_for_kernel_version

Refactor `dracut-initramfs-restore.sh` and `lsinitrd.sh` to introduce a
`find_initrd_for_kernel_version` function to abstract the code. This
commit does not change the logic of the search order.

22 months agofeat(debug): add findmnt to help debugging
Laszlo Gombos [Sat, 6 Jul 2024 18:41:34 +0000 (14:41 -0400)] 
feat(debug): add findmnt to help debugging

Also sorted the list.

22 months agoci: run extended tests on Alpine and Void as well
Laszlo Gombos [Fri, 5 Jul 2024 18:05:11 +0000 (14:05 -0400)] 
ci: run extended tests on Alpine and Void as well

22 months agodocs: remove suggesting that hostonly option is only for experts
Laszlo Gombos [Sat, 6 Jul 2024 12:47:35 +0000 (08:47 -0400)] 
docs: remove suggesting that hostonly option is only for experts

Since some distributions set hostonly the default, suggesting
that it is only for experts is a bit of overstatement.

22 months agotest(TEST-40-NBD): tests should avoid managing kernel modules manually
Laszlo Gombos [Sat, 6 Jul 2024 13:17:09 +0000 (09:17 -0400)] 
test(TEST-40-NBD): tests should avoid managing kernel modules manually

Remove NFS related kernel modules from the NBD test.
Remove networking modules that are installed by kernel-network-modules.

Increase server disk space as now more kernel modules gets installed.

22 months agotest: delete hosts files that are not used by tests
Laszlo Gombos [Thu, 4 Jul 2024 02:53:40 +0000 (22:53 -0400)] 
test: delete hosts files that are not used by tests

CI uses IP addresses for simplicity.

22 months agotest: avoid writing to rootfs as it might be read-only
Laszlo Gombos [Sun, 7 Jul 2024 00:12:33 +0000 (20:12 -0400)] 
test: avoid writing to rootfs as it might be read-only

There is no need to remount rootfs read only right before shutdown.

22 months agotest(FULL-SYSTEMD): remove /etc/fstab from the rootfs
Laszlo Gombos [Sat, 6 Jul 2024 17:53:42 +0000 (13:53 -0400)] 
test(FULL-SYSTEMD): remove /etc/fstab from the rootfs

This PR moves /usr mounting into initrd instead of after
switch_root.

This PR makes the test more generic and allow more testcases.

22 months agotest(FULL-SYSTEMD): add a test for encrypted root
Laszlo Gombos [Sat, 6 Jul 2024 02:11:18 +0000 (22:11 -0400)] 
test(FULL-SYSTEMD): add a test for encrypted root

22 months agotest(FULL-SYSTEMD): include more systemd dracut modules
Laszlo Gombos [Wed, 3 Jul 2024 23:42:07 +0000 (19:42 -0400)] 
test(FULL-SYSTEMD): include more systemd dracut modules

Most of modules added had no test coverage in any of the tests on CI.

22 months agoci: add systemd-coredump to Debian/Ubuntu containers
Laszlo Gombos [Thu, 4 Jul 2024 02:29:16 +0000 (22:29 -0400)] 
ci: add systemd-coredump to Debian/Ubuntu containers

PR to enable testing systemd-coredump module.

22 months agotest: run iscsi and nbd tests sequentially to make it less flaky
Laszlo Gombos [Thu, 4 Jul 2024 12:15:31 +0000 (08:15 -0400)] 
test: run iscsi and nbd tests sequentially to make it less flaky

22 months agodocs: correct shutdown path disucssion
Ian Wienand [Wed, 3 Jul 2024 04:48:28 +0000 (14:48 +1000)] 
docs: correct shutdown path disucssion

Since 4f03054e540427682221e4c62b4d44f79424e38a, these shutdown steps have been
in response to the ExecStop= called from the sysinit.target.

Correct the doc in the two places it mentions this.

22 months agofeat: add common config for Integrity Measurement
Laszlo Gombos [Tue, 2 Jul 2024 17:57:27 +0000 (13:57 -0400)] 
feat: add common config for Integrity Measurement

22 months agotest: do not disable selinux for tests
Laszlo Gombos [Tue, 2 Jul 2024 15:08:36 +0000 (11:08 -0400)] 
test: do not disable selinux for tests

22 months agotest: increase VM memory size to pass test 40 on more VMs
Laszlo Gombos [Wed, 3 Jul 2024 03:12:50 +0000 (23:12 -0400)] 
test: increase VM memory size to pass test 40 on more VMs

22 months agofix: rename dracut.conf.d .conf files to conf.example
Laszlo Gombos [Wed, 3 Jul 2024 01:29:07 +0000 (21:29 -0400)] 
fix: rename dracut.conf.d .conf files to conf.example

Sadly, dracut.conf.d.*.conf files will be also picked up
during CI test runs and there is no trivial way to disable
that, so let's follow the existing .example pattern until
there is a better solution.

22 months agoci: add hmaccalc to the openSUSE CI containers
Laszlo Gombos [Sun, 30 Jun 2024 18:09:27 +0000 (14:09 -0400)] 
ci: add hmaccalc to the openSUSE CI containers

hmaccalc package is needed by the fido dracut module.

22 months agoci: run systemd-networkd and network-legacy tests on Debian as well
Laszlo Gombos [Mon, 1 Jul 2024 20:23:48 +0000 (16:23 -0400)] 
ci: run systemd-networkd and network-legacy tests on Debian as well

Debian CI (v12) not yet compatible with network-manager dracut
module.

22 months agofix(network): deprioritize connman for network selection
Laszlo Gombos [Mon, 1 Jul 2024 18:59:25 +0000 (14:59 -0400)] 
fix(network): deprioritize connman for network selection

Pick network-manager or networkd over connman if network preference
is otherwise not set. All networking tests fail with connman on Arch
currently.

22 months agoci: run network tests on Arch, Gentoo, openSUSE and Ubuntu
Laszlo Gombos [Mon, 1 Jul 2024 13:30:14 +0000 (09:30 -0400)] 
ci: run network tests on Arch, Gentoo, openSUSE and Ubuntu

Exclude test 40 as it is failing, except on Fedora.

22 months agotest: use use --add instead of --modules to create test-makeroot
Laszlo Gombos [Mon, 1 Jul 2024 12:58:31 +0000 (08:58 -0400)] 
test: use use --add instead of --modules to create test-makeroot

Use USE_NETWORK instead of network to be able to control the
network dracut module from outside of the tests.

22 months agotest: re-enable test 30 with default networking
Laszlo Gombos [Mon, 1 Jul 2024 11:42:41 +0000 (07:42 -0400)] 
test: re-enable test 30 with default networking

22 months agoci: run systemd-networkd tests on Ubuntu as well
Laszlo Gombos [Sat, 29 Jun 2024 18:46:25 +0000 (14:46 -0400)] 
ci: run systemd-networkd tests on Ubuntu as well

22 months agofix(dbus-daemon): actually enable the dbus service and socket
BtbN [Sun, 23 Jun 2024 12:14:54 +0000 (14:14 +0200)] 
fix(dbus-daemon): actually enable the dbus service and socket

22 months agoci: no need to set USE_NETWORK for default networking
Laszlo Gombos [Sat, 29 Jun 2024 17:37:23 +0000 (13:37 -0400)] 
ci: no need to set USE_NETWORK for default networking

22 months agotest: use network instead of network-legacy for client instance
Laszlo Gombos [Sat, 29 Jun 2024 16:32:35 +0000 (12:32 -0400)] 
test: use network instead of network-legacy for client instance

22 months agotest: use network instead of network-legacy for server instance
Laszlo Gombos [Sat, 29 Jun 2024 16:22:06 +0000 (12:22 -0400)] 
test: use network instead of network-legacy for server instance

22 months agofeat(hwdb): separate out hwdb module
Laszlo Gombos [Sun, 30 Jun 2024 23:53:44 +0000 (19:53 -0400)] 
feat(hwdb): separate out hwdb module

22 months agotest: virtual hardware watchdog not available on s390x
Laszlo Gombos [Sat, 29 Jun 2024 19:21:02 +0000 (15:21 -0400)] 
test: virtual hardware watchdog not available on s390x

22 months agofix(fips): remove reference to kernel module zlib in fips module
Cameron Baird [Wed, 29 May 2024 22:16:41 +0000 (22:16 +0000)] 
fix(fips): remove reference to kernel module zlib in fips module

Remove reference to kernel module zlib (deprecated in kernel v4.6+) since the
pedantic dracut behavior causes initramfs generation to fail otherwise.

22 months agofix(TEST-35-ISCSI-MULTI): increrase storage space
Laszlo Gombos [Sun, 30 Jun 2024 17:55:39 +0000 (13:55 -0400)] 
fix(TEST-35-ISCSI-MULTI): increrase storage space

More storage is needed as more files gets installed.

22 months agofix(udev-rules): install all rules even if systemd is not installed
Laszlo Gombos [Sun, 30 Jun 2024 15:32:55 +0000 (11:32 -0400)] 
fix(udev-rules): install all rules even if systemd is not installed

22 months agofix(rt): use singular argument for timeout value
Paul Charlton [Sun, 30 Jun 2024 18:37:31 +0000 (01:37 +0700)] 
fix(rt): use singular argument for timeout value

use singular argument for timeout value -- plural values create an invalid cryptsetup command line

Fixes: https://github.com/dracut-ng/dracut-ng/issues/424
Signed-off-by: Paul Charlton <techguru@byiq.com>
22 months agoperf(dracut-install): memoize find_kmod_module_from_sysfs_node
Hector Martin [Sun, 23 Jun 2024 12:24:11 +0000 (21:24 +0900)] 
perf(dracut-install): memoize find_kmod_module_from_sysfs_node

find_kmod_module_from_sysfs_node() is called for every platform device
in the system via find_suppliers(). In turn, this calls
kmod_module_new_from_lookup() for every device modalias. This is an
expensive call that reads the modalias files every single time from
scratch.

On many platforms, there are many identical platform devices (e.g.
multiple serial ports, or dozens or hundreds of power domain devices).
Therefore, it's worth memoizing this so we only perform the expensive
lookup once per unique modalias.

This cuts down dracut generation time on an Apple M1 Pro MacBook Pro
from 26 seconds to 17 seconds, give or take (which is close to the
performance prior to 3de4c7313, which introduced a major regression
which has been incrementally improved in prior commits already).

22 months agofeat(dracut-install): add hashmap_get_exists()
Hector Martin [Sun, 23 Jun 2024 12:23:16 +0000 (21:23 +0900)] 
feat(dracut-install): add hashmap_get_exists()

This variant of hashmap_get() returns whether the item exists, which
allows distinguishing a NULL item from a nonexistent one.

22 months agofix(systemd-hostnamed): also enable socket units
Cornelius Hoffmann [Fri, 28 Jun 2024 09:41:02 +0000 (11:41 +0200)] 
fix(systemd-hostnamed): also enable socket units

Followup to https://github.com/dracut-ng/dracut-ng/pull/421

22 months agofeat(crypt): force the inclusion of crypttab entries with x-initrd.attach
Antonio Alvarez Feijoo [Mon, 24 Jun 2024 13:29:52 +0000 (15:29 +0200)] 
feat(crypt): force the inclusion of crypttab entries with x-initrd.attach

dracut has a "hidden" and undocumented `force` crypttab option (added with
commit b7058d0ce5e99cbc80b5f760a0b654d3ff03c094). This option forces the
inclusion of a crypttab entry in the initrd, which is useful in some cases where
the filesystem check (for whatever reason) does not report a required encrypted
device as "crypto_LUKS".

On the other hand, systemd provides the `x-initrd.attach` crypttab option since
v245. Excerpt from `crypttab(5)`:

```
x-initrd.attach

Setup this encrypted block device in the initrd, similarly to systemd.mount(5)
units marked with x-initrd.mount.
```

This crypttab option is commonly used to mark encrypted block devices that
contain filesystems mounted in the initrd. So, this patch aims to make use of
this well-known systemd crypttab option to match the functionality provided by
the not so well-known dracut crypttab option.

22 months agochore: remove trailing newlines
Benjamin Drung [Thu, 27 Jun 2024 07:55:11 +0000 (09:55 +0200)] 
chore: remove trailing newlines

Remove trailing newlines from all files in the repository.

22 months agofeat: add additional common configs
Laszlo Gombos [Fri, 21 Jun 2024 21:52:08 +0000 (17:52 -0400)] 
feat: add additional common configs

22 months agofix(test): reenable extended tests for Arch
Laszlo Gombos [Sun, 23 Jun 2024 01:28:27 +0000 (21:28 -0400)] 
fix(test): reenable extended tests for Arch

23 months agofix(systemd-hostnamed): add missing systemd-hostnamed.socket
Cornelius Hoffmann [Wed, 26 Jun 2024 21:41:50 +0000 (23:41 +0200)] 
fix(systemd-hostnamed): add missing systemd-hostnamed.socket

Added in systemd v256

23 months agochore(deps): bump softprops/action-gh-release from 2.0.5 to 2.0.6
dependabot[bot] [Tue, 25 Jun 2024 20:23:28 +0000 (20:23 +0000)] 
chore(deps): bump softprops/action-gh-release from 2.0.5 to 2.0.6

Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.5 to 2.0.6.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v2.0.5...v2.0.6)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
23 months agofix(dracut-initramfs-restore.sh): correct initrd globbing
Benjamin Drung [Mon, 24 Jun 2024 15:11:26 +0000 (17:11 +0200)] 
fix(dracut-initramfs-restore.sh): correct initrd globbing

Quoting the globbing `*` will prevent Bash from use globbing. So only
quote the kernel version variable that could potentially contain spaces.

Fixes: 28820e205328 ("feat(dracut.sh): make initramfs-${kernel}.img filename configurable")
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(systemd-networkd): remove default network if others were generated
BtbN [Sun, 23 Jun 2024 23:40:25 +0000 (01:40 +0200)] 
fix(systemd-networkd): remove default network if others were generated

23 months agofix(mdraid): try to assemble the missing raid device
Lidong Zhong [Mon, 24 Jun 2024 01:57:44 +0000 (09:57 +0800)] 
fix(mdraid): try to assemble the missing raid device

If some raid devices with specified UUIDs fail to be assembled in
initrd, we will try to assemble them again in this script to avoid
system falling into emergency mode. This patch is created because we can
offen see mdadm command failure during boot because of timing issue
introduced between mdadm and udevd.

23 months agofix(lsinitrd.sh): disable SC2317 for cat functions
Benjamin Drung [Mon, 24 Jun 2024 15:17:03 +0000 (17:17 +0200)] 
fix(lsinitrd.sh): disable SC2317 for cat functions

shellcheck 0.10 complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly). It fails to
detect that these functions are assigned to `CAT` and `$CAT` is called
later. Disable shellcheck in this case.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(dracut-catimages.sh): drop unused dwarning function
Benjamin Drung [Mon, 24 Jun 2024 15:21:01 +0000 (17:21 +0200)] 
fix(dracut-catimages.sh): drop unused dwarning function

shellcheck complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly).

The function `dwarning` is not called in `dracut-catimages.sh`. So drop
this unused function. It can be re-introduced once it is needed.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(dbus): drop unreachable return statement
Benjamin Drung [Mon, 24 Jun 2024 15:32:36 +0000 (17:32 +0200)] 
fix(dbus): drop unreachable return statement

shellcheck complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly).

The last `return 1` statement is not reachable. Remove it and move the
else clause one level up because the if clause returns from the
function.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(dracut): microcode loading named .initramfs
Benjamin Drung [Mon, 24 Jun 2024 11:28:00 +0000 (13:28 +0200)] 
fix(dracut): microcode loading named .initramfs

intel-microcode on Debian/Ubuntu uses the `.initramfs` suffix for the
ucode files (e.g. `/lib/firmware/intel-ucode/06-9e-0b.initramfs`).
`get_ucode_file` returns `family-model-stepping` on Intel (e.g.
`06-9e-0b`). If the microcode file is found, the loop is broken.
Otherwise `.early` is appended to the name (e.g. `06-9e-0b.early`) and
tried again. If that file is not found, `.initramfs` is appended to the
name (e.g. `06-9e-0b.early.initramfs`), but this suffix should be
appended to the initial name (e.g. `06-9e-0b.initramfs`).

Fixes: 16573680d1b6 ("fix(dracut): microcode loading")
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agotest: use --kernel-cmdline to set only dracut arguments
Laszlo Gombos [Fri, 21 Jun 2024 22:55:42 +0000 (18:55 -0400)] 
test: use --kernel-cmdline to set only dracut arguments

kernel arguments should not be set with --kernel-cmdline.

23 months agofix(test): tests needs more storage space
Laszlo Gombos [Fri, 21 Jun 2024 22:20:13 +0000 (18:20 -0400)] 
fix(test): tests needs more storage space

23 months agofix(TEST-NFS): use --add instead of --modules to create test-makeroot
Laszlo Gombos [Sat, 22 Jun 2024 21:41:47 +0000 (17:41 -0400)] 
fix(TEST-NFS): use --add instead of --modules to create test-makeroot

Reenable systemd-networkd for TEST-NFS on Arch.

23 months agofix(man): clarify semantics for --kernel-cmdline
Laszlo Gombos [Sat, 22 Jun 2024 12:04:40 +0000 (08:04 -0400)] 
fix(man): clarify semantics for --kernel-cmdline

23 months agofeat(qemu): include the virtio_crypto kernel module
Laszlo Gombos [Fri, 21 Jun 2024 22:01:04 +0000 (18:01 -0400)] 
feat(qemu): include the virtio_crypto kernel module

The virtio crypto is a virtual crypto device.

23 months agofix(dracut-functions): avoid awk in get_maj_min()
Daniel McIlvaney [Fri, 7 Jun 2024 18:38:54 +0000 (11:38 -0700)] 
fix(dracut-functions): avoid awk in get_maj_min()

The `get_maj_min()` cache lookup is commonly used
across many flows. While `awk` should be available,
some highly constrained environments may not have it.
A second call to `grep` can provide the same behaviour
without adding a dependnecy.

Lines in the cache will be of the form "/dev/sda2 8:2".
`awk '{print $NF}'` returns the last word of a matching line. Since
the initial matching regex is so specific a second call to grep can
easily extract the last word.

23 months agofix(systemd-networkd): add support for proper netroot invocation
Timo Rothenpieler [Fri, 21 Jun 2024 15:29:06 +0000 (17:29 +0200)] 
fix(systemd-networkd): add support for proper netroot invocation

23 months agofix(TEST-40-NBD): disable broken tests
BtbN [Sat, 22 Jun 2024 19:56:14 +0000 (21:56 +0200)] 
fix(TEST-40-NBD): disable broken tests

Also remove one that was a complete dupe of one of the broken ones.

23 months agofix(dracut-logger.sh): disable SC2317 for logger functions
Benjamin Drung [Fri, 21 Jun 2024 23:55:17 +0000 (01:55 +0200)] 
fix(dracut-logger.sh): disable SC2317 for logger functions

shellcheck 0.10 complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly). It fails to
detect that these logger functions are called later by scripts that
source `dracut-logger.sh`. Disable shellcheck in this case.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(convertfs): drop unused find_mount function
Benjamin Drung [Fri, 21 Jun 2024 23:46:17 +0000 (01:46 +0200)] 
fix(convertfs): drop unused find_mount function

shellcheck complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly).

The function `find_mount` is not called in `convertfs.sh` any more. So
drop this unused function.

Fixes: 101b683e1a2 ("refactor(convertfs): drop duplicate def. of ismounted()")
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agotest: disable SC2317 in test 98
Benjamin Drung [Fri, 21 Jun 2024 23:37:04 +0000 (01:37 +0200)] 
test: disable SC2317 in test 98

shellcheck 0.10 complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly). It fails to
detect cases where a function is defined and later called by `getarg` or
existing functions are overridden. Disable shellcheck in these cases.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(convertfs): disable SC2317 for EXIT trap function
Benjamin Drung [Fri, 21 Jun 2024 23:27:23 +0000 (01:27 +0200)] 
fix(convertfs): disable SC2317 for EXIT trap function

shellcheck complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly). It fails to
detect cases where a function is defined and later called by a trap.
Disable shellcheck in this case.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(TEST-40-NBD): return actual test run result from test_run()
BtbN [Fri, 21 Jun 2024 22:28:04 +0000 (00:28 +0200)] 
fix(TEST-40-NBD): return actual test run result from test_run()

23 months agofix(TEST-40-NBD): enable serial console for test runs
BtbN [Fri, 21 Jun 2024 22:25:24 +0000 (00:25 +0200)] 
fix(TEST-40-NBD): enable serial console for test runs

23 months agofix(TEST-40-NBD): don't double-pass test dir to marker check
BtbN [Fri, 21 Jun 2024 22:23:46 +0000 (00:23 +0200)] 
fix(TEST-40-NBD): don't double-pass test dir to marker check

23 months agorefactor: replace long-time deprecated $tempnode with $devnode
Antonio Alvarez Feijoo [Thu, 20 Jun 2024 12:22:11 +0000 (14:22 +0200)] 
refactor: replace long-time deprecated $tempnode with $devnode

23 months agofeat(dracut): search for zstd compressor first
Benjamin Drung [Thu, 20 Jun 2024 12:11:02 +0000 (14:11 +0200)] 
feat(dracut): search for zstd compressor first

Searching for an available compressor was introduced in commit
693b7a32833b ("Cleanup compressor handling") but the order was not
justified.

Ubuntu uses zstd for compressing the packages, the kernel modules,
firmware files, and the initrd (when using initramfs-tools). zstd has a
good compromise between compression ratio and speed. Therefore search
for zstd first.

Further readings:

 * https://lists.ubuntu.com/archives/ubuntu-devel/2021-December/041726.html
 * analysis.ipynb on https://github.com/waveform80/compression

23 months agofix(dracut.sh): drop unused read_arg function
Benjamin Drung [Thu, 20 Jun 2024 10:50:14 +0000 (12:50 +0200)] 
fix(dracut.sh): drop unused read_arg function

shellcheck complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly).

The function `read_arg` is not used anywhere any more (only `configure`
uses its own copy). So drop this unused function.

Fixes: ffa71b4afa3e ("dracut.sh: use getopt to parse arguments")
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agorefactor: use inst_sysusers to install sysusers files
Laszlo Gombos [Mon, 27 May 2024 22:55:59 +0000 (18:55 -0400)] 
refactor: use inst_sysusers to install sysusers files

23 months agofix(crypt): decryption when rd.luks.name is set
Laszlo Gombos [Sat, 15 Jun 2024 19:21:44 +0000 (15:21 -0400)] 
fix(crypt): decryption when rd.luks.name is set

23 months agofix(systemd-networkd): this module depends on systemd
Laszlo Gombos [Sat, 15 Jun 2024 19:36:11 +0000 (15:36 -0400)] 
fix(systemd-networkd): this module depends on systemd

23 months agofix(test): use --add instead of --modules to create test-makeroot
Laszlo Gombos [Tue, 18 Jun 2024 22:30:55 +0000 (18:30 -0400)] 
fix(test): use --add instead of --modules to create test-makeroot

Even with these changes the following tests are failing on Arch
with systemd 256: 12, 14, 16.

Temporary remove Arch from running the extended test suite until
the root cause of these failures are identified.

23 months agochore(deps): bump docker/build-push-action from 5 to 6
dependabot[bot] [Tue, 18 Jun 2024 20:42:18 +0000 (20:42 +0000)] 
chore(deps): bump docker/build-push-action from 5 to 6

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
23 months agofix: disable SC2317 for calls by for_each_host_dev_and_slaves
Benjamin Drung [Sat, 15 Jun 2024 20:17:51 +0000 (22:17 +0200)] 
fix: disable SC2317 for calls by for_each_host_dev_and_slaves

shellcheck 0.10 complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly). It fails to
detect cases where a function is defined and later called by
`for_each_host_dev_and_slaves`. Disable shellcheck in this case.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(dracut-logger.sh): quote _dlogfd variable
Benjamin Drung [Sat, 15 Jun 2024 13:35:13 +0000 (15:35 +0200)] 
fix(dracut-logger.sh): quote _dlogfd variable

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `_dlogfd` refers to an integer and therefore is safe to be
quoted.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(zipl): quote zipl_env variable
Benjamin Drung [Sat, 15 Jun 2024 13:29:05 +0000 (15:29 +0200)] 
fix(zipl): quote zipl_env variable

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

Only strings without spaces are assigned to the `zipl_env` variable.
Therefore it is safe to be quoted.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(zipl): quote ID_FS_TYPE variable
Benjamin Drung [Sat, 15 Jun 2024 13:26:33 +0000 (15:26 +0200)] 
fix(zipl): quote ID_FS_TYPE variable

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `ID_FS_TYPE` refers to a single file system type which is
not expected to contain a space and therefore is safe to be quoted.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(convertfs): quote single CP_HARDLINK variable
Benjamin Drung [Sat, 15 Jun 2024 13:23:53 +0000 (15:23 +0200)] 
fix(convertfs): quote single CP_HARDLINK variable

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `CP_HARDLINK` contains either nothing or exactly one
parameter. Use shell substitution to quote this single parameter in case
it is not empty.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(network-legacy): quote bridgename variable
Benjamin Drung [Sat, 15 Jun 2024 13:18:29 +0000 (15:18 +0200)] 
fix(network-legacy): quote bridgename variable

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `bridgename` refers to a bridge name which is not expected
to contain a space and therefore is safe to be quoted.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(znet): quote initdir variable
Benjamin Drung [Sat, 15 Jun 2024 13:11:22 +0000 (15:11 +0200)] 
fix(znet): quote initdir variable

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `initdir` refers to a path and therefore is safe to be
quoted.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(dmsquash-live-autooverlay): quote variables
Benjamin Drung [Sat, 15 Jun 2024 12:48:49 +0000 (14:48 +0200)] 
fix(dmsquash-live-autooverlay): quote variables

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

Instead of ignoring those complains fix them instead. The variable
`overlay` should be quoted since it might contain spaces. The variables
`rootDevice`, `rootDeviceAbsolutePath`, `rootDeviceSysfsPath`,
`fullDriveSysfsPath`, `blockDevice` refer to paths. Therefore they are
safe to quote.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(dracut-lib): quote _ctty variable
Benjamin Drung [Sat, 15 Jun 2024 12:35:20 +0000 (14:35 +0200)] 
fix(dracut-lib): quote _ctty variable

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `_ctty` contains a path and therefore is safe to quote.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix: quote single CTTY parameter
Benjamin Drung [Sat, 15 Jun 2024 12:35:05 +0000 (14:35 +0200)] 
fix: quote single CTTY parameter

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `CTTY` contains either nothing or exactly one parameter.
Use shell substitution to quote this single parameter in case it is not
empty.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(dracut-init): change lookup order for rules files
David Tardon [Tue, 11 Jun 2024 08:03:59 +0000 (10:03 +0200)] 
fix(dracut-init): change lookup order for rules files

Look for rules files in /etc/udev/rules.d first so that local
modifications of system files are included.

23 months agofix(dmsquash-live): quote variables
Benjamin Drung [Thu, 13 Jun 2024 23:34:20 +0000 (01:34 +0200)] 
fix(dmsquash-live): quote variables

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variables `pathspec`, `live_dir`, `squash_image`, `SQUASHED`, and
`FSIMG` refer to paths or filenames. Therefore they are safe to quote.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(iscsi): address shellcheck SC2319
Benjamin Drung [Thu, 13 Jun 2024 22:41:53 +0000 (00:41 +0200)] 
fix(iscsi): address shellcheck SC2319

shellcheck complains:

```
In modules.d/95iscsi/iscsiroot.sh line 232:
    [ -z "$targets" ] && warn "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && return 1
                                                                                                                                ^-- SC2319 (warning): This $? refers to a condition, not a command. Assign to a variable to avoid it being overwritten.
```

The `while` loop that gets the output from `iscsiadm` via a pipe will
exit with 0. Printing the exit code 0 does not help. So just drop it.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(lvmthinpool-monitor): adress shellcheck SC2319
Benjamin Drung [Thu, 13 Jun 2024 22:26:31 +0000 (00:26 +0200)] 
fix(lvmthinpool-monitor): adress shellcheck SC2319

shellcheck complains:

```
In modules.d/80lvmthinpool-monitor/start-thinpool-monitor.sh line 12:
    [ -n "$_lvm2_thin_device" ] && return $?
                                          ^-- SC2319 (warning): This $? refers to a condition, not a command. Assign to a variable to avoid it being overwritten.
```

Let `is_lvm2_thinp_device` directly return the test exit code.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(dracut): address shellcheck SC2004
Benjamin Drung [Thu, 13 Jun 2024 21:41:59 +0000 (23:41 +0200)] 
fix(dracut): address shellcheck SC2004

shellcheck complains:

```
In dracut.sh line 1382:
        && dracut_args[$i]="\"${dracut_args[$i]}\""
                       ^-- SC2004 (style): $/${} is unnecessary on arithmetic variables.
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
23 months agofix(syslog): quote conf variable
Benjamin Drung [Fri, 14 Jun 2024 21:41:36 +0000 (23:41 +0200)] 
fix(syslog): quote conf variable

shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `conf` refers to a path and therefore is safe to be quoted.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>