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

22 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

22 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>
23 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>
23 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>
23 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>
23 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

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

23 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>
23 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>
23 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")
23 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>
23 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>
23 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

23 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

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

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

23 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>
2 years agofeat(90dm): close crypt devices using cryptsetup
Kamil Szczęk [Sun, 19 May 2024 16:12:52 +0000 (18:12 +0200)] 
feat(90dm): close crypt devices using cryptsetup

This commit changes the behavior of the shutdown script in the 90dm
module to use more specialized tools for removing dm-crypt mappers.
When dealing with a dm-crypt mapper, the shutdown script will try to use
systemd-cryptsetup, cryptsetup or dmsetup, whichever is available in the
specified order. This lets systemd-cryptsetup or cryptsetup perform any
necessary cleanup steps when detaching volumes activated by those tools.

Resolves #204

2 years agotest: no need to include network meta module when network-legacy is included
Laszlo Gombos [Sat, 25 May 2024 16:21:33 +0000 (12:21 -0400)] 
test: no need to include network meta module when network-legacy is included

2 years agotest: only run test 30 with network-legacy as it is unstable otherwise
Laszlo Gombos [Sat, 25 May 2024 16:10:02 +0000 (12:10 -0400)] 
test: only run test 30 with network-legacy as it is unstable otherwise

2 years agotest(RAID-DEG): run the test only with the required modules
Laszlo Gombos [Sat, 25 May 2024 15:51:31 +0000 (11:51 -0400)] 
test(RAID-DEG): run the test only with the required modules

2 years agotest(DRACUT-CPIO): resolve regression
Laszlo Gombos [Sat, 25 May 2024 03:46:33 +0000 (23:46 -0400)] 
test(DRACUT-CPIO): resolve regression

Test regressed on void container after 7ad57d696c451d9f85d612f9aebee52d54dbf1b1.

2 years agotest: only install sfdisk if it is needed to make the root filesystem
Laszlo Gombos [Sat, 25 May 2024 03:11:54 +0000 (23:11 -0400)] 
test: only install sfdisk if it is needed to make the root filesystem

2 years agotest: install mkfs.ext4 in test-makeroot dracut module
Laszlo Gombos [Sat, 25 May 2024 02:56:16 +0000 (22:56 -0400)] 
test: install mkfs.ext4 in test-makeroot dracut module

2 years agotest: add watchdog dracut module for each test run for consistency
Laszlo Gombos [Wed, 22 May 2024 13:11:14 +0000 (09:11 -0400)] 
test: add watchdog dracut module for each test run for consistency

2 years agofeat(pcmcia): factor out pcmcia support into its own module
Laszlo Gombos [Sat, 25 May 2024 13:20:19 +0000 (09:20 -0400)] 
feat(pcmcia): factor out pcmcia support into its own module

2 years agofix(systemd-cryptsetup): add potentially needed modules to generic initrd
Daniel Winzen [Sat, 25 May 2024 15:38:06 +0000 (17:38 +0200)] 
fix(systemd-cryptsetup): add potentially needed modules to generic initrd

2 years agofix(crypt): unlock encrypted devices by default during boot
Daniel Winzen [Sat, 25 May 2024 16:20:12 +0000 (18:20 +0200)] 
fix(crypt): unlock encrypted devices by default during boot

2 years agofix(01systemd-ldconfig): install ldconfig.real
Nick Rosbrook [Thu, 23 May 2024 14:28:14 +0000 (10:28 -0400)] 
fix(01systemd-ldconfig): install ldconfig.real

Also restore enablement of ldconfig.service in TEST-04-FULL-SYSTEMD.

2 years agofix(base): add support for rd.udev.log_level
Laszlo Gombos [Mon, 20 May 2024 02:57:04 +0000 (22:57 -0400)] 
fix(base): add support for rd.udev.log_level

2 years agofix(fips): remove /dev/{random,urandom} pre-creation
Vitaly Kuznetsov [Thu, 23 May 2024 12:20:43 +0000 (14:20 +0200)] 
fix(fips): remove /dev/{random,urandom} pre-creation

Random device nodes were required to workaround libgcrypt initialization
problem (see https://bugzilla.redhat.com/show_bug.cgi?id=1401444) which
is gone since libgcrypt-1.10 (2022): modern Linux kernels (3.17+) support
getrandom() syscall and libgcrypt has switch to using getentropy()
(glibc-2.25+).

The requirement to run dracut as root (which is needed to mknod
/dev/{random,urandom}) is a particular problem for building UKIs in distro
build systems where packages are not built by a privileged user.

Note, dracut itself always pre-creates /dev/{null,kmsg,console,random,urandom}
devices when running privileged so the patch has no effect on 'traditional'
setup.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2 years agofix(systemd-ask-password): no graphical output in aarch64
Antonio Alvarez Feijoo [Fri, 24 May 2024 11:40:57 +0000 (13:40 +0200)] 
fix(systemd-ask-password): no graphical output in aarch64

A password cannot be entered if there is no graphical output during boot, as is
the case in aarch64, where efifb does not work with qemu-system-aarch64:
- virtio-gpu-pci does not expose a linear framebuffer
- virtio-vga is not supported
- ramfb is not enough

Therefore, depend on the drm module if virtio_gpu is loaded on the system.

2 years agorevert(dracut-install): check the existing file—not the source
Laszlo Gombos [Thu, 23 May 2024 02:16:30 +0000 (22:16 -0400)] 
revert(dracut-install): check the existing file—not the source

This reverts commit 5ac581ef66dd8f1939e771419824137aebbc8f66.

2 years agofix(base): install /etc/udev/udev.conf in hostonly mode only
Laszlo Gombos [Mon, 20 May 2024 04:24:37 +0000 (00:24 -0400)] 
fix(base): install /etc/udev/udev.conf in hostonly mode only

Remove duplicated rule from systemd-udevd.

2 years agofix(base): log the full udev database in rdsosreport
Laszlo Gombos [Mon, 20 May 2024 04:11:02 +0000 (00:11 -0400)] 
fix(base): log the full udev database in rdsosreport

2 years agotest: configure watchdog-action in run-qemu
Laszlo Gombos [Mon, 20 May 2024 03:41:39 +0000 (23:41 -0400)] 
test: configure watchdog-action in run-qemu

2 years agofix(dracut): bsdcpio compatibility
Tomasz Paweł Gajc [Sun, 19 May 2024 22:30:03 +0000 (18:30 -0400)] 
fix(dracut): bsdcpio compatibility

2 years agofix: /etc/modprobe.d --> /run/modprobe.d
Laszlo Gombos [Sun, 19 May 2024 18:58:17 +0000 (14:58 -0400)] 
fix: /etc/modprobe.d --> /run/modprobe.d

Change /etc/modprobe.d path to /run/modprobe.d in hooks.

/etc might be mounted as read-only.

2 years agofix(configure): resolve regression for crosscompiling
Bernhard Rosenkraenzer [Sun, 19 May 2024 17:57:44 +0000 (13:57 -0400)] 
fix(configure): resolve regression for crosscompiling

2 years agoci: add tpm2-tools package to all test containers to test tpm2-tss dracut module
Laszlo Gombos [Sun, 19 May 2024 17:05:25 +0000 (13:05 -0400)] 
ci: add tpm2-tools package to all test containers to test tpm2-tss dracut module