Benjamin Drung [Wed, 26 Nov 2025 00:22:08 +0000 (01:22 +0100)]
fix(dracut): ignore shellcheck SC2329 in addition to SC2317
Shellcheck <= 0.10 complains about SC2317 (info): Command appears to be
unreachable. Check usage (or ignore if invoked indirectly). Shellcheck
0.11 changes this complaint to SC2329 (info): This function is never
invoked. Check usage (or ignored if invoked indirectly).
So ignore shellcheck SC2329 in addition to SC2317 to make both
shellcheck versions happy.
Benjamin Drung [Thu, 11 Dec 2025 20:32:35 +0000 (21:32 +0100)]
feat(dracut): always check DRACUT_INSTALL being executable
If `DRACUT_INSTALL` is set externally (to `valgrind dracut-install` for
example), dracut will skip the check for the dracut-install command.
Better check the first parameter in `DRACUT_INSTALL` being executable
(e.g. check `valgrind` being present when `DRACUT_INSTALL` is set to
`valgrind dracut-install`).
Jo Zzsi [Thu, 6 Nov 2025 12:28:38 +0000 (07:28 -0500)]
feat(Makefile): do not install network-legacy by default
This commit is the next step in the multi year effort to
discourage the usage or network-legacy dracut module.
This commit changes the default build/packaging so that
distributions wish to continue using network-legacy would
have to explicitly opt in to it in the packaging step.
Benjamin Drung [Tue, 2 Dec 2025 15:17:04 +0000 (16:17 +0100)]
ci: run network tests also on arm64
Increase test coverage by also running the network tests on arm64. Since
arm64 is slower than amd64 and test 60 already takes five minutes on
amd64, double the timeout for arm64.
Jo Zzsi [Sat, 22 Nov 2025 22:38:48 +0000 (17:38 -0500)]
chore: set expectation for function compatibility
Set clear boundaries for which functions are maintained for
compatibility with existing dracut modules.
Document the compatibility differences between dracut.sh and
dracut-functions.sh, and move any functions from dracut.sh to
dracut-functions.sh that are clearly required for dracut
module compatibility.
This commit moves all functions from dracut.sh to dracut-functions.sh
that are already documented in man/dracut.modules.7.adoc.
Benjamin Drung [Mon, 1 Dec 2025 15:28:20 +0000 (16:28 +0100)]
ci: use ubuntu:rolling instead of ubuntu:latest
`ubuntu:latest` points to the latest LTS version (currently 24.04) and
`ubuntu:rolling` to the latest release (currently 25.10). Use
`ubuntu:rolling` instead of `ubuntu:latest` consistently everywhere.
systemd-hibernate-resume [1] and systemd-hibernate-resume-generator [2] were
added in systemd-v217 (2014), so the fallback using the custom dracut code to
handle resume is not used with systemd.
perf(resume): do not search cmdline options in /etc/cmdline{,.d}
Both `/etc/cmdline` and `/etc/cmdline.d` are only created in the initrd, they do
not exist in the host, where dracut calls `module-setup.sh` functions, so there
is no need to grep there.
Jo Zzsi [Thu, 27 Nov 2025 13:15:32 +0000 (08:15 -0500)]
ci: explicitly skip tests are not meant to be supported
The motivation of this commit is to not run tests on the CI
that would be skipped. This saves some CI resources and
enables to get back to restore green CI, now that
skipped tests are reported as failures after f120814.
This PR does not change code coverage. This is simply
a different and more efficient way to skip tests on the CI.
Benjamin Drung [Thu, 27 Nov 2025 01:48:26 +0000 (02:48 +0100)]
test: print end of client tests even in failure case
If client tests started and failed with a command failing, the test will
exit and the ERR trap will execute `print_test_result`. But the client
test end will not be printed.
So call `client_test_end` in `print_test_result` to print a client test
end result in case a client test was in progress.
Benjamin Drung [Wed, 26 Nov 2025 15:17:16 +0000 (16:17 +0100)]
test: exit with code 77 if test is skipped
Exiting tests that are skipped with exit code 0 will hide that the test
environment probably miss some tools. That can reduce the test coverage
without anybody noting it.
Therefore exit tests that are skipped with exit code 77. In case tests
are intentionally expected to be skipped, an environment variable could
be introduce to exit with code 0 again.
fix(dracut-install): build with -Werror=discarded-qualifiers
```
src/install/dracut-install.c:475:11: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
475 | q = strstr(lib, ".so.");
```
- `q` cannot be const, because it's also used for `q = strstr(clib, ".so.");`,
removing the suffix from clib via `q[3] = '\0';`, so create two variables to get
the suffix offsets, one const for `lib`, other non-const for `clib`.
```
src/install/dracut-install.c:2592:11: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
2592 | p = strstr(abskpath, "/lib/modules/");
```
- `p` can be const like `abskpath`, since it's not modified.
Jens Schmidt [Sat, 22 Nov 2025 20:15:24 +0000 (21:15 +0100)]
fix(functions): do not use path escapes for non-paths
Function dev_unit_name unconditionally calls `systemd-escape -p` on the device
argument, even if that is a non-path, for example, a LUKS UUID.
`systemd-escape -p` writes a warning for non-paths, so just use plain
`systemd-escape` for these.
Benjamin Drung [Tue, 25 Nov 2025 23:16:43 +0000 (00:16 +0100)]
test(run-qemu): support UEFI on ARM
The OVMF firmware files are builds of EDK II for 64-bit x86 virtual
machines. They do not work on other architectures.
So search for AAVMF files on ARM. Remove the `cfi.pflash01` driver
setting because it does not work on Ubuntu arm64 and `readonly=on` is
already set for the firmware file.
Benjamin Drung [Sat, 8 Nov 2025 13:54:43 +0000 (14:54 +0100)]
test: determine rootfs size dynamically
Do not hard-code the size of the rootfs, but determine the needed size
dynamically. This will speed up the creation time for smaller content
and prevent failures in case of bigger content.
Inode numbers are unique (for non-hardlinks) within the archive, so
device ID mapping is unnecessary. Confirm that dracut-cpio behaves like
GNU cpio --ignore-devno. Check this by archiving the /tmp directory
alongside a working-directory nested file; despite differing source
device IDs, the archived major/minor numbers should be zero.
The test is skipped if stat(/tmp) fails, or working-directory and /tmp
device ids match.
initramfs / cpio allow for the tracking of hardlinks for nlink >= 2
entries using a combination of the inode, device major and minor
numbers.
dracut-cpio uses unique inode numbers within an archive via the global
state.ino counter. Device major/minor numbers are also renumbered, with
each unique source device obtaining a major/minor number mapped from the
index within dev_seen()/DevState array.
With archive-unique inode numbers, device major/minor mapping is
unnecessary. This change sees dracut-cpio behave the same as GNU
cpio --ignore-devno, where archive device major/minor numbers are
hardcoded to zero.
Hardlink tracking is simplified, replacing per-device HardlinkState
arrays with a global state.hls array. A hash could be used for faster
source inode+dev -> archive HardlinkState mapping, but the extra
size and complexity isn't worth it IMO, given that hardlinks should be
rare.
A typo that I made in the initial dracut-cpio implementation sees the
stat()-dev_t-derived major number used for both major and minor number
in the cpio archive.
This bug shouldn't cause any real-world issues, as archive-renumbered
inode numbers are already unique and hardlink tracking checks against
the proper dev_t tuple.
Benjamin Drung [Tue, 18 Nov 2025 18:34:52 +0000 (19:34 +0100)]
test: replace rev command by sed
On Debian-based systems, the `rev` command is shipped by the
bsdextrautils package. Replace the `rev` command by `sed` which is an
essential command and does not need additional packages.
feat(network-manager): add systemd generator if available
A systemd generator was added in [1] to fix an upstream issue [2]. It also
brings the removal of the "[Install]" section from the upstream initrd services;
it is used to mask the initrd services on the host, and to mask the host
services and provide installation links of the initrd services in the initrd.
Additionally, increase the minimum NetworkManager version set to remove custom
systemd services from dracut.
Benjamin Drung [Wed, 19 Nov 2025 03:28:38 +0000 (04:28 +0100)]
test: set console cmdline depending on the architecture
The QEMU process hangs (without printing anything) on some Debian/Ubuntu
architectures. This is caused by the console device is called
differently on those architectures.
So move setting `console` to `run-qemu` and set it to `ttyAMA0` on ARM
systems and to `hvc0` on ppc64el.
fix(nfs): set the default group of the rpcbind user to the state dir
Commit 4a236f015905f598e2976ae6f0f460ec9a567f2b sets the fixed "root" group to
`/run/rpcbind`, but it can be different depending on the distribution (for
example, `rpc` in openSUSE and Fedora).
perf(nfs): remove references to old rpcbind state dir
The default state directory (needed by `rpcbind` to save warm start info) was
initially `/tmp`, but it can be configured with `--with-statedir=` since [1].
This default state directory changed to a more appropriate `/var/run` [2], and
then explicitly to `/run` [3].
So, `/var/lib/rpcbind` existed when this dracut module was created because RH/
Fedora had it configured with `--with-statedir=`, like openSUSE until 2016 [4]
fix(dracut-systemd): use expected PS1 in the emergency shell
Before starting `dracut-emergency.service`, the function `_emergency_shell()`
writes `PS1` to `/etc/profile`. Then `/etc/profile` is sourced in
`dracut-emergency.sh`, but `PS1` is not exported, so the current hook name is
never displayed in the emergency shell. Also, the default name "dracut" is not
printed either in the fallback `PS1`, because the variable `_name` is not set;
it should be `_rdshell_name`.
Jo Zzsi [Sat, 1 Nov 2025 23:20:42 +0000 (19:20 -0400)]
feat: rename rd.live.overlay.overlayfs to rd.overlayfs
The overlayfs dracut module can be used without the dmsquash-live
dracut module. This change improves on naming of command line options
with better namespace scoping.
Move overlayfs documentation out of the live images section.