]> git.ipfire.org Git - thirdparty/dracut-ng.git/log
thirdparty/dracut-ng.git
14 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

14 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

14 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

14 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.

14 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.

14 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.

14 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.

14 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.

14 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.

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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.

14 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.

14 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

14 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>
14 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).

14 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.

14 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

14 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.

14 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.

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

14 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

14 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

14 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>
14 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>
14 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

14 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.

14 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>
14 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>
14 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>
14 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>
14 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.

14 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

14 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.

14 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

14 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.

14 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.

14 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

14 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.

14 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>
14 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>
14 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>
14 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>
14 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()

14 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

14 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

14 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

14 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

14 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>
14 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

14 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

14 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

14 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.

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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.

14 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>
14 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>
14 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>
14 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>
14 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>
14 months agofix(lunmask): quote LUN variable
Benjamin Drung [Fri, 14 Jun 2024 21:49:13 +0000 (23:49 +0200)] 
fix(lunmask): quote LUN variable

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

The variable `LUN` refers to a single logical unit number (LUN) and
therefore is safe to be quoted.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(dracut-lib): quote var variable
Benjamin Drung [Thu, 13 Jun 2024 23:26:03 +0000 (01:26 +0200)] 
fix(dracut-lib): quote var variable

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

The variable `var` refers to one environment variable and therefore is
safe to quote.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(dracut-lib): quote _b variable
Benjamin Drung [Thu, 13 Jun 2024 23:25:09 +0000 (01:25 +0200)] 
fix(dracut-lib): quote _b variable

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

The variable `_b` contains a digit without spaces (as validated by
`isdigit`) and therefore is safe to quote.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(90kernel-modules): install blk modules using symbol blk_alloc_disk
Pavel Valena [Tue, 6 Dec 2022 20:46:01 +0000 (21:46 +0100)] 
fix(90kernel-modules): install blk modules using symbol blk_alloc_disk

Corresponding kernel symbol blk_cleanup_disk is no longer used in the nvdimm
driver and calls are made directly instead.

blk_alloc_disk is used:
https://elixir.bootlin.com/linux/v6.1-rc8/source/drivers/nvdimm/pmem.c#L522

Resolves: RHEL-32237

14 months agofix(dracut-init.sh): quote dracutbasedir variable
Benjamin Drung [Fri, 14 Jun 2024 13:45:39 +0000 (15:45 +0200)] 
fix(dracut-init.sh): quote dracutbasedir variable

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

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

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(nfs): quote rpcpipefspath variable
Benjamin Drung [Fri, 14 Jun 2024 13:41:44 +0000 (15:41 +0200)] 
fix(nfs): quote rpcpipefspath variable

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

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

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(dracut): quote strip_cmd variable
Benjamin Drung [Fri, 14 Jun 2024 13:38:21 +0000 (15:38 +0200)] 
fix(dracut): quote strip_cmd variable

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

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

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(test-root): quote _terminfodir variable
Benjamin Drung [Thu, 13 Jun 2024 23:40:32 +0000 (01:40 +0200)] 
fix(test-root): quote _terminfodir variable

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

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

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix: address shellcheck SC2166
Benjamin Drung [Thu, 13 Jun 2024 22:16:08 +0000 (00:16 +0200)] 
fix: address shellcheck SC2166

shellcheck complains about SC2166:
> Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.

See https://github.com/koalaman/shellcheck/wiki/SC2166

Address the valid shellcheck complaint instead of ignoring it globally.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(01fips): replace read -d that is not supported by dash
Benjamin Drung [Thu, 13 Jun 2024 11:28:23 +0000 (13:28 +0200)] 
fix(01fips): replace read -d that is not supported by dash

shellcheck complains:

```
In modules.d/01fips/fips.sh line 97:
    read -d '' -r FIPSMODULES < /etc/fipsmodules
         ^-- SC3045 (warning): In POSIX sh, read -d is undefined.
```

`read -d` is not supported by dash. `/etc/fipsmodules` is generated by
`installkernel` in `modules.d/01fips/module-setup.sh` and contains
kernel module names. So use a while read construct for reading this
file.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix: move shellcheck SC3045 override to occurrences
Benjamin Drung [Thu, 13 Jun 2024 11:24:47 +0000 (13:24 +0200)] 
fix: move shellcheck SC3045 override to occurrences

Move the shellcheck overrides for `SC3045` to the individual occurrences
instead of disabling this check globally to not hide valid complains
like:

```
In modules.d/01fips/fips.sh line 97:
    read -d '' -r FIPSMODULES < /etc/fipsmodules
         ^-- SC3045 (warning): In POSIX sh, read -d is undefined.
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(test): use `-cpu max` by default
Benjamin Drung [Thu, 13 Jun 2024 18:26:07 +0000 (20:26 +0200)] 
fix(test): use `-cpu max` by default

Running the tests on an AMD Ryzen 7 5700G without KVM,
qemu-system-x86_64 will print following warnings:

```
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EDX.spec-ctrl [bit 26]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EDX.spec-ctrl [bit 26]
```

Use `-cpu max` by default to avoid those warnings.

Commit 3f56d481e8a3 ("test: don't use `-cpu max` in GH Actions") added
`-cpu IvyBridge-v2` in 2021. Let's try using `-cpu max` on GitHub
actions again.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agochore(shellcheck): remove retired SC2039
Benjamin Drung [Thu, 13 Jun 2024 18:32:48 +0000 (20:32 +0200)] 
chore(shellcheck): remove retired SC2039

The shellcheck SC2039 warning has been retired in favor of individual
SC3xxx warnings for each individual issue. So remove the override from
`.shellcheckrc`.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofeat(test): support V=2 without logtee
Benjamin Drung [Thu, 13 Jun 2024 12:05:00 +0000 (14:05 +0200)] 
feat(test): support V=2 without logtee

The Debian/Ubuntu autopkgtest runs the tests out of tree. In that
environment `gcc` might not be installed, but it is needed to compile
`logtee`.

So support running the tests with `V=2` but without `logtee`. Only use
`logtee` if it is available.

14 months agorefactor(test): combine V=1 and V=2 cases
Benjamin Drung [Thu, 13 Jun 2024 12:03:32 +0000 (14:03 +0200)] 
refactor(test): combine V=1 and V=2 cases

The code for `V=1` and `V=2` only differ in the `tee` vs `logtee`
command.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agofix(shell-completion): remove hashbang from bash completions
Benjamin Drung [Wed, 12 Jun 2024 22:49:57 +0000 (00:49 +0200)] 
fix(shell-completion): remove hashbang from bash completions

Debian's lintian complains about bash-completion-with-hashbang: "This
file starts with the #! sequence that marks interpreted scripts, but it
is a bash completion script that is merely intended to be sourced.
Please remove the line with hashbang, including any designated
interpreter. Please refer to
https://salsa.debian.org/lintian/lintian/-/merge_requests/292#note_139494
for details."

Remove hashbang from bash completions and add a shellcheck directive
instead.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
14 months agotest(RAID-DEG): fix running test out of tree
Benjamin Drung [Wed, 12 Jun 2024 17:02:34 +0000 (19:02 +0200)] 
test(RAID-DEG): fix running test out of tree

`test-functions` defines `DRACUT` to allow running the test out of tree
against the system-installed dracut.

Fixes: 55e7b7ce6fcf ("test(RAID-DEG): make test 12 use the test dracut modules")
15 months agodocs: fix some typos
Louis Sautier [Sat, 1 Jun 2024 12:50:35 +0000 (14:50 +0200)] 
docs: fix some typos

Signed-off-by: Louis Sautier <sautier.louis@gmail.com>
15 months agoperf(dracut-install): preload kmod resources for quicker module lookup
Alper Nebi Yasak [Wed, 29 May 2024 15:19:35 +0000 (18:19 +0300)] 
perf(dracut-install): preload kmod resources for quicker module lookup

libkmod reads the `modules.*.bin` files in the kernel dir every time we
call one of the `kmod_module_new_from_lookup()` function. We end up
calling it a lot especially in ARM64 systems where we handle fw_devlink
supplier relations, which slows down things by a significant margin.

Instead, have it read these files at the start of the dracut-install run
so the module information can be looked up quicker. We don't need to
unload these resources in the cleanup function because libkmod handles
that itself in `kmod_unref()`.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
15 months agofix(systemd-pcrphase): in hostonly mode do not try to include systemd-pcrphase
Laszlo Gombos [Thu, 30 May 2024 14:06:04 +0000 (10:06 -0400)] 
fix(systemd-pcrphase): in hostonly mode do not try to include systemd-pcrphase

15 months agodocs: update NEWS.md and AUTHORS 102
dracutng[bot] [Wed, 29 May 2024 11:54:30 +0000 (11:54 +0000)] 
docs: update NEWS.md and AUTHORS

15 months agoci: add sbsigntool and ukify to test containers
Laszlo Gombos [Sun, 26 May 2024 16:44:29 +0000 (12:44 -0400)] 
ci: add sbsigntool and ukify to test containers

This is in preparation for increasing the test coverage for
UKI generation.

15 months agofix(dracut): microcode loading
Laszlo Gombos [Sun, 26 May 2024 04:19:56 +0000 (00:19 -0400)] 
fix(dracut): microcode loading

intel-microcode uses the .initramfs suffix for the ucode files.

15 months agofix(Dockerfile-Gentoo): resolve glibc/libxcrypt conflict
Andrew Ammerlaan [Sun, 26 May 2024 13:05:48 +0000 (15:05 +0200)] 
fix(Dockerfile-Gentoo): resolve glibc/libxcrypt conflict

Closes: https://github.com/dracut-ng/dracut-ng/issues/323
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>