]> git.ipfire.org Git - thirdparty/dracut-ng.git/log
thirdparty/dracut-ng.git
4 months agofeat(configure): autoconfigure configprofile
Jo Zzsi [Sun, 10 Aug 2025 12:20:09 +0000 (08:20 -0400)] 
feat(configure): autoconfigure configprofile

The original motivation of this PR was to set the openSUSE config
inside the openSUSE CI container.

This commit will autoconfigure those configprofiles that are
maintained upstream for fedora, debian and opensuse based distro's.

One notable change from this commit is that it would now allow testing
hostonly_cmdline=yes configuration which is currently untested
on the CI.

4 months agotest(NETWORK): remove the hostonly_mode=sloppy workaround
Jo Zzsi [Tue, 12 Aug 2025 02:47:52 +0000 (22:47 -0400)] 
test(NETWORK): remove the hostonly_mode=sloppy workaround

The test now passes regardless of the value of hostonly_mode.

4 months agofix(network-manager): load required kernel modules
Jo Zzsi [Tue, 12 Aug 2025 03:02:05 +0000 (23:02 -0400)] 
fix(network-manager): load required kernel modules

network-manager always requires nf_tables and other kernel modules
in the generated initramfs to function, regardless if these
modules are loaded on the host or not at the time of initramfs
generation.

4 months agofix(net-lib): always include af_packet
Jo Zzsi [Sat, 9 Aug 2025 22:24:32 +0000 (18:24 -0400)] 
fix(net-lib): always include af_packet

For static IPv4 configurations, we use arping to check for duplicate
IP addresses. arping requires the af_packet module to work, and if arping
fails, the IP address will not be set and booting will fail.
af_packet may not be loaded / required in the running system, for example if
the system had been booted in an IPv6 configuration, or if it had been
manually unloaded. Make sure it's included in initramfs in hostonly mode, too.

Follow-up to b0742165e1fec168 and to de862885e .

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1437
4 months agochore: always set hostonly and hostonly_mode
Jo Zzsi [Sat, 2 Aug 2025 23:08:44 +0000 (19:08 -0400)] 
chore: always set hostonly and hostonly_mode

It makes it easier to reason both for built-in and out-of-tree dracut
modules with the assumption that hostonly and hostonly_mode variables
are always set.

Document most commonly used shell variables for dracut modules and
document that they are always set.

Partial revert of c85c93245bf .

4 months agorevert(efaee44): hostonly_cmdline should continue to default to yes
Jo Zzsi [Tue, 12 Aug 2025 11:17:52 +0000 (07:17 -0400)] 
revert(efaee44): hostonly_cmdline should continue to default to yes

Despite the Fedora setting, let's keep the default to yes
for distributions that do not whish to overwrite the default.

4 months agofix(dracut-install): broken calls to mmap with 0 length
James Le Cuirot [Tue, 12 Aug 2025 09:15:58 +0000 (10:15 +0100)] 
fix(dracut-install): broken calls to mmap with 0 length

This results in an invalid argument error, so check for 0 length first.

Fixes: https://bugs.gentoo.org/961340
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
4 months agofix(debian): remove Debian 12 support
Jo Zzsi [Sat, 2 Aug 2025 17:40:55 +0000 (13:40 -0400)] 
fix(debian): remove Debian 12 support

Debian v13 (Trixie) is now the minimal Debian version supported
by the CI.

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1458
4 months agofix(lsinitrd): avoid rechecking for squash images
Benjamin Drung [Mon, 11 Aug 2025 12:01:23 +0000 (14:01 +0200)] 
fix(lsinitrd): avoid rechecking for squash images

The function `extract_squash_img` uses `SQUASH_TMPDIR` to check that it
was already called but did not find any squash image.

Instead of setting `SQUASH_TMPDIR` `SQUASH_TMPFILE` was set and
therefore the cpio file is searched again on every `extract_squash_img`
call.

4 months agofix(Makefile): use install for installing files
Benjamin Drung [Tue, 5 Aug 2025 17:16:17 +0000 (19:16 +0200)] 
fix(Makefile): use install for installing files

The `cp` command will copy the file/directory permissions from the
source files. The local source files might have group write permission
set which should not be applied to the installation.

Tighten the file/directory permission by using the `install` command
with specifying the mode.

4 months agorefactor(lsinitrd): introduce cpio_list function
Benjamin Drung [Wed, 6 Aug 2025 17:50:49 +0000 (19:50 +0200)] 
refactor(lsinitrd): introduce cpio_list function

In preparation to support 3cpio as alternative archive tool, move the
cpio listing call into `cpio_list`.

4 months agorefactor(lsinitrd): introduce cpio_extract_to_stdout function
Benjamin Drung [Wed, 6 Aug 2025 17:50:08 +0000 (19:50 +0200)] 
refactor(lsinitrd): introduce cpio_extract_to_stdout function

In preparation to support 3cpio as alternative archive tool, move the
cpio extraction to stdout call into `cpio_extract_to_stdout`.

4 months agorefactor(lsinitrd): introduce cpio_extract function
Benjamin Drung [Wed, 6 Aug 2025 16:57:15 +0000 (18:57 +0200)] 
refactor(lsinitrd): introduce cpio_extract function

In preparation to support 3cpio as alternative archive tool, move the
cpio extraction call into `cpio_extract`.

4 months agofix(kernel-modules): add Cadence USB driver to base
Benjamin Drung [Thu, 31 Jul 2025 19:45:17 +0000 (21:45 +0200)] 
fix(kernel-modules): add Cadence USB driver to base

Installed Debian Trixie d-i rc2 (dvd-1) on USB storage on Pine64 Star64
is not bootable due to missing modules `cdns3_starfive` and `cdns3` from
initramfs.

Note the above USB support on Pine64 Star64 is directly part of StarFive
JH7110 CPU and differs from StarFive VisionFive2 which uses an external
controller attached to the PCIe bus.

Bug-Debian: https://bugs.debian.org/1108924

4 months agofix(systemd-portabled, initqueue): enable systemd type units
Jo Zzsi [Sun, 10 Aug 2025 17:55:08 +0000 (13:55 -0400)] 
fix(systemd-portabled, initqueue): enable systemd type units

Use systemctl enable command (instead of add-wants command) to
enable systemd type units.

Without these changes the following error message is seen on
TEST-FULL-SYSTEMD:

```
Failed to add dependency on unit: Unit initrd.target does not exist
Failed to add dependency on unit: Unit initrd.target does not exist
```

4 months agotest(KERNEL-INSTALL): config path for test dracut config
Jo Zzsi [Sun, 10 Aug 2025 11:30:29 +0000 (07:30 -0400)] 
test(KERNEL-INSTALL): config path for test dracut config

The path for test dracut config has changed. Fix it.

4 months agotest(NETWORK): coverage for bringing up network interface
Jo Zzsi [Sun, 13 Jul 2025 05:35:51 +0000 (01:35 -0400)] 
test(NETWORK): coverage for bringing up network interface

Currently, all networking tests in the dracut CI require a client and a
server VM, and all the server VMs are enabled to work with network-legacy only.

Introduce a simpler networking test that tests the rd.neednet dracut
boot time argument and ensures that the interface is up without needing
a server VM.

This simple networking test could be run in most networking configurations
and pass in the Void test containers as well, which previously have not had
any network tests enabled.

4 months agotest: remove leftover comment
Jo Zzsi [Sun, 10 Aug 2025 10:55:20 +0000 (06:55 -0400)] 
test: remove leftover comment

The 'install the files needed to make the root filesystem' comment
no longer adds value to the understanding of the test cases.
Remove it.

4 months agofix(systemd-sysext): skip manual systemct enablement for systemd>=258
Vitaly Kuznetsov [Mon, 11 Aug 2025 09:36:41 +0000 (11:36 +0200)] 
fix(systemd-sysext): skip manual systemct enablement for systemd>=258

systemd-258 ships the required initrd.target.wants symlinks, there is
no need to enable services manually. Use the existence of old
systemd-confext/systemd-sysext units as an indication of when manual
(legacy) enablement is still needed.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
4 months agofix(systemd-sysext): package initrd.target.wants symlinks
Vitaly Kuznetsov [Mon, 11 Aug 2025 09:34:56 +0000 (11:34 +0200)] 
fix(systemd-sysext): package initrd.target.wants symlinks

Systemd-258 provides the 'initrd.target.wants' symlinks for systemd-confext/
systemd-sysext initrd services. Include them to the image when present.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
4 months agoci: remove testing with ubuntu:latest
Jo Zzsi [Sun, 10 Aug 2025 15:44:15 +0000 (11:44 -0400)] 
ci: remove testing with ubuntu:latest

ubuntu:latest could be as old as two years old, and, while testing with
debian:stable makes sense, testing with ubuntu:latest seems redundant.

Ubuntu is now well integrated with dracut and dracut usptream main no
longer needs to target (or backported) to ubuntu:latest.

4 months agofix(doc_site): remove reference to udev < 143
Jo Zzsi [Sun, 10 Aug 2025 23:04:43 +0000 (19:04 -0400)] 
fix(doc_site): remove reference to udev < 143

Let's keep the documentation fresh and do not reference an udev
version that is more than a decade old.

4 months agofix(dracut-install): the handling of absolute paths in sonames
James Le Cuirot [Fri, 8 Aug 2025 12:18:07 +0000 (13:18 +0100)] 
fix(dracut-install): the handling of absolute paths in sonames

If the soname is an absolute path, expand it like the RUNPATH, and
return it (with the sysroot) without further checks like glibc and musl
do.

They also support relative paths, but we cannot feasibly support them.
Such paths are relative to the current directory of the calling process
at runtime, which we cannot know in this context.

This was observed with Neovim.

Bug: https://bugs.gentoo.org/961101
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
4 months agofix(dracut-install): the RUNPATH expansion returning empty strings
James Le Cuirot [Fri, 8 Aug 2025 11:52:23 +0000 (12:52 +0100)] 
fix(dracut-install): the RUNPATH expansion returning empty strings

The input was not initially copied into the result, so the result would
start with a null pointer and be treated as an empty string. Expansion
will not occur in most cases, leading to a straight copy of input being
returned, so just do that in the first place.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
4 months agofix(dracut-install): the -n short option for --dry-run
James Le Cuirot [Fri, 8 Aug 2025 11:50:12 +0000 (12:50 +0100)] 
fix(dracut-install): the -n short option for --dry-run

I forgot to update the getopt call.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
4 months agofeat(dracut.sh): output error message for --regenerate-all
Pavel Valena [Thu, 29 May 2025 12:47:18 +0000 (14:47 +0200)] 
feat(dracut.sh): output error message for --regenerate-all

Without it, users might be confused on which initrd is failing.

4 months agofix(livenet): source img-lib.sh for check_live_ram
Jo Zzsi [Wed, 6 Aug 2025 11:15:27 +0000 (07:15 -0400)] 
fix(livenet): source img-lib.sh for check_live_ram

When livenetroot.sh is called and tries to find the check_live_ram()
function, livenetroot.sh cannot source from img-lib.sh.

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1523
4 months agoci: adopt test configuration without test module
Jo Zzsi [Sat, 9 Aug 2025 19:25:08 +0000 (15:25 -0400)] 
ci: adopt test configuration without test module

Test module no longer exists. This is a follow-up to 4598998 .

4 months agofix(base): silence error log if shadow does not exists
Jo Zzsi [Sat, 2 Aug 2025 10:44:36 +0000 (06:44 -0400)] 
fix(base): silence error log if shadow does not exists

4 months agofix: make sure final hostonly value is computed before reading it
Jo Zzsi [Sat, 2 Aug 2025 16:53:50 +0000 (12:53 -0400)] 
fix: make sure final hostonly value is computed before reading it

hostonly variable is unset later in a later code block after
decisions are made based on the value of the hostonly variable
which is unexpected, hard to reason about and inconsistent.

Fix it by rearranging the order of execution of the code blocks.

4 months agotest: remove test module
Jo Zzsi [Thu, 31 Jul 2025 11:21:44 +0000 (07:21 -0400)] 
test: remove test module

test module can be simplified down to just a configuration file instead
as it no longer has its own additional scripts files that would
require a module.

This commit is an additional step to reinforce testing in a similar configuration
as actual end-user configuration.

4 months agotest(SYSTEMD-INITRD): be more careful with `set -e` and subshells
Frantisek Sumsal [Wed, 6 Aug 2025 14:22:34 +0000 (16:22 +0200)] 
test(SYSTEMD-INITRD): be more careful with `set -e` and subshells

When the condition in the subshell fails (i.e. none of the
dracut*.service files is found), it doesn't trigger shell exit due to
`set -e` as it's a part of a larger condition (&& ...), but since it's
the last command of that subshell, it sets the subshell error code to 1.
This is then treated by the parent shell as an error and the test is
incorrectly interrupted and marked as failed.

For comparison:

$ (set -ex; echo begin; (for f in dracut*.service; do [[ -e "$f" ]] && echo fail; done); echo end); echo $?
+ echo begin
begin
+ for f in dracut*.service
+ [[ -e dracut*.service ]]
1

$ (set -ex; echo begin; (for f in dracut*.service; do if [[ -e "$f" ]]; then echo nope; fi; done); echo end); echo $?
+ echo begin
begin
+ for f in dracut*.service
+ [[ -e dracut*.service ]]
+ echo end
end
0

Follow-up for 80350104949708c60806a255765e87d7b1d5a98c

4 months agotest: drop setting DRACUT_PATH
Benjamin Drung [Sat, 9 Aug 2025 16:54:33 +0000 (18:54 +0200)] 
test: drop setting DRACUT_PATH

Commit 2606f985d6f3 ("feat(dracut): drop DRACUT_PATH and rely on PATH")
removed the `DRACUT_PATH` variable. So `DRACUT_PATH` does not need to be
set in the tests any more.

4 months agofeat(dracut.conf.d): move examples into subdirectories
Benjamin Drung [Sat, 9 Aug 2025 16:55:11 +0000 (18:55 +0200)] 
feat(dracut.conf.d): move examples into subdirectories

Instead of shipping example configuration files that need to be
installed in the right place, move those configuration files into
configuration directories. Then they can be easily installed via a
configure option. Example: `./configure --configprofile=fedora`.

4 months agoci: enable SYSROOT test more to run on arm daily
Jo Zzsi [Sun, 25 May 2025 20:33:49 +0000 (16:33 -0400)] 
ci: enable SYSROOT test more to run on arm daily

The arm64 bot seems to be stable, lets add more tests.

4 months agotest(UEFI): remove version check test for kernel-install
Jo Zzsi [Thu, 17 Jul 2025 12:03:41 +0000 (08:03 -0400)] 
test(UEFI): remove version check test for kernel-install

The current way of checking the version of kernel-install is not
portable between distributions and it no longer adds any value to the CI.

Remove the version check to make it easier to reason about the
test run and enable this subtest in more test environments.

4 months agofix(dracut): do not call uname -r in chroot environments
Benjamin Drung [Mon, 4 Aug 2025 12:41:41 +0000 (14:41 +0200)] 
fix(dracut): do not call uname -r in chroot environments

Running dracut in a schroot environment (even with `systemd-detect-virt`
installed) will pick `uname -r` as kernel version despite that kernel
not being available.

So also check `systemd-detect-virt --chroot` before relying on
`uname -r`.

4 months agofeat(systemd-networkd): do not require bash
Benjamin Drung [Tue, 5 Aug 2025 08:41:54 +0000 (10:41 +0200)] 
feat(systemd-networkd): do not require bash

The systemd-networkd module ships `networkd-run.sh` that uses bash, but
there is no bash specific code inside this script. So drop the bash
requirement.

4 months agofix(hwdb): make module-setup.sh executable
Benjamin Drung [Tue, 5 Aug 2025 11:17:15 +0000 (13:17 +0200)] 
fix(hwdb): make module-setup.sh executable

The `module-setup.sh` scripts are shell scripts and should be
executable.

4 months agofeat(Makefile): introduce distclean target
Benjamin Drung [Mon, 4 Aug 2025 22:09:31 +0000 (00:09 +0200)] 
feat(Makefile): introduce distclean target

Add a `distclean` target to remove all generated files including the one
(`Makefile.inc`) created by `configure`. Calling `make distclean` should
have the same result as `git clean -fdx`.

4 months agofeat(Makefile): set Dracut version on install
Benjamin Drung [Mon, 4 Aug 2025 21:52:20 +0000 (23:52 +0200)] 
feat(Makefile): set Dracut version on install

Distributions can override `DRACUT_VERSION` or `DRACUT_FULL_VERSION` to
include the distribution's revision in the dracut version. This override
is not reflected in the installed `dracut-version.sh` and needs to be
modified by the distribution.

Persist the version in the installed `dracut-version.sh` during
`make install`.

4 months agotest: fix Linux kernel detection for qemu runs
Jo Zzsi [Sat, 2 Aug 2025 11:38:09 +0000 (07:38 -0400)] 
test: fix Linux kernel detection for qemu runs

Determine KVERSION from the generated initramfs for qemu runs.

Extend fallback detection even when KVERSION is specified.

4 months agofix(release): force push (for updating)
Benjamin Drung [Fri, 1 Aug 2025 19:13:27 +0000 (21:13 +0200)] 
fix(release): force push (for updating)

In case the `release` branch already exists, `tools/release.sh` will
fail instead of pushing an updated version.

4 months agotest(NFS): use of test dracut modules
Jo Zzsi [Sun, 3 Aug 2025 13:11:01 +0000 (09:11 -0400)] 
test(NFS): use of test dracut modules

Make use of test dracut modules and configuration and make the
test consistent with the rest of the CI.

4 months agotest(ISCSI-MULTI, NBD): reenable running these tests on the CI
Jo Zzsi [Fri, 8 Aug 2025 00:45:13 +0000 (20:45 -0400)] 
test(ISCSI-MULTI, NBD): reenable running these tests on the CI

4 months agofix(dracut-util): crash if CMDLINE ends with quotation mark
Benjamin Drung [Thu, 7 Aug 2025 16:04:01 +0000 (18:04 +0200)] 
fix(dracut-util): crash if CMDLINE ends with quotation mark

Sudhakar Verma from the Ubuntu security team found a memory corruption:

```
$ pwd
/tmp/dracut-ng/src/util
$ CC=clang-17 CXX=clang++-17 CFLAGS="-fsanitize=address" cmake .
-- The C compiler identification is Clang 17.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-17 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/dracut-ng/src/util
$ CC=clang-17 CXX=clang++-17 CFLAGS="-fsanitize=address" make
[ 50%] Building C object CMakeFiles/dracut-util.dir/util.c.o
[100%] Linking C executable dracut-util
[100%] Built target dracut-util
$ ln -s $PWD/dracut-util dracut-getargs
$ ln -s $PWD/dracut-util dracut-getarg

$ CMDLINE=' "' ./dracut-getarg ' '
AddressSanitizer:DEADLYSIGNAL
=================================================================
==163118==ERROR: AddressSanitizer: SEGV on unknown address 0x50210000001d (pc 0x599a6b7d4c07 bp 0x7ffe44ea9ef0 sp 0x7ffe44ea9da0 T0)
==163118==The signal is caused by a READ memory access.
    #0 0x599a6b7d4c07 in next_arg util.c
    #1 0x599a6b7d3e75 in getarg util.c
    #2 0x599a6b7d3448 in main (/tmp/dracut-ng/src/util/dracut-util+0x108448) (BuildId: ea28a61b3c6dd0a75c505cd1749f8711779bd819)
    #3 0x72381be2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #4 0x72381be2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #5 0x599a6b6f7304 in _start (/tmp/dracut-ng/src/util/dracut-util+0x2c304) (BuildId: ea28a61b3c6dd0a75c505cd1749f8711779bd819)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV util.c in next_arg
==163118==ABORTING
```

The variable `i` in `next_arg` is an unsigned integeter. `i - 1` will
result in an underflow in case `i` is 0.

5 months agoci(debian): install open-iscsi
Benjamin Drung [Wed, 6 Aug 2025 13:20:58 +0000 (15:20 +0200)] 
ci(debian): install open-iscsi

Install `open-iscsi` in the Debian/Ubuntu container which is needed in
the iscsi tests.

5 months agofix(test): make sure $1 is not read as an unbound variable
Jo Zzsi [Wed, 6 Aug 2025 11:41:58 +0000 (07:41 -0400)] 
fix(test): make sure $1 is not read as an unbound variable

Document generation fails on the CI as test-container.sh is called
with an empty $1.

Follow-up to 5c9230f.

5 months agofix(dracut): look for both vmlinuz and vmlinux for UKI creation
Jo Zzsi [Sat, 2 Aug 2025 15:58:57 +0000 (11:58 -0400)] 
fix(dracut): look for both vmlinuz and vmlinux for UKI creation

Dracut does not look for or find kernels named vmlinux-${kernel} in uefi mode.

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1366
5 months agofix(dracut-init): remove the heuristic to determine fallback kernel version
Jo Zzsi [Sat, 19 Jul 2025 02:24:47 +0000 (22:24 -0400)] 
fix(dracut-init): remove the heuristic to determine fallback kernel version

If kernel version is not passed in the command line for a dracut invocation then
dracut.sh should be the only place where kernel version is determined.

Remove the heuristic to determine kernel version from dracut-init.sh.

5 months agofix(Makefile): remove the heuristic to determine fallback kernel version
Jo Zzsi [Sat, 19 Jul 2025 02:19:35 +0000 (22:19 -0400)] 
fix(Makefile): remove the heuristic to determine fallback kernel version

If kernel version is not passed in the command line for a dracut invocation
then dracut.sh should be the only place where kernel version is determined.

Remove the heuristic to determine kernel version from Makefile.

5 months agoci: disable running arm64 tests on Fedora
Jo Zzsi [Thu, 3 Jul 2025 12:33:46 +0000 (08:33 -0400)] 
ci: disable running arm64 tests on Fedora

If CI is not kept green, than it is hard to separate regressions
caused by PRs from regressions not caused by PRs.

The primary purpose of the CI is to help contributors to highlight
regressions caused by PRs. Leaving tests broken caused by
changes in distributions and not by dracut changes would make it
harder to contribute to dracut.

Ideally we want to respond changes in distributions,                                                                                                                                                                                  but for this the project is leaning on specific
Linux distribution contributors (Fedora in this case)                                                                                                                                                                                 to help out who are more familiar with distribution
specific regressions and changes.

Issue filed https://github.com/dracut-ng/dracut-ng/issues/1406

5 months agofeat(network-manager): remove support for ifcfg-rh
Jo Zzsi [Sat, 28 Jun 2025 17:41:28 +0000 (13:41 -0400)] 
feat(network-manager): remove support for ifcfg-rh

This commit removes the dracut module for the NetworkManager fcfg-rh
plugin (`nm-fcfg-rh`), effectively discontinuing its support within dracut.

The `fcfg-rh` plugin for NetworkManager provides backward compatibility
with the legacy `ifcfg` network configuration format.
This format, traditionally found in `/etc/sysconfig/network-scripts/`,
was the standard method for configuring network interfaces on Red Hat-based
distributions for many years. It relies on a collection of shell-script-like
files to define network connections.

While functional for basic configurations, the `ifcfg` format has several
limitations in the context of modern networking and the capabilities of NetworkManager.

The removal of the `nm-fcfg-rh` support from dracut is a forward-looking change
that aligns with the broader trend in the Linux ecosystem to modernize network configuration.
The key reasons for this decision are as follows:

* **Deprecation by Upstream and Distributions:**
The `fcfg-rh` plugin is considered deprecated by the NetworkManager project
and major Linux distributions, such as Fedora and its derivatives.
These distributions are actively migrating users away from the legacy `ifcfg` format
in favor of the more robust `keyfile` format.

See https://networkmanager.dev/docs/api/latest/nm-settings-ifcfg-rh.html.

5 months agochore: remove dead code that is no longer expected to be executed
Jo Zzsi [Sat, 2 Aug 2025 15:44:26 +0000 (11:44 -0400)] 
chore: remove dead code that is no longer expected to be executed

/lib/modules should always exists, which is consistent with the
assumptions made in the rest of the dracut mode.

5 months agotest: use "set -u" in in test-container.sh
Jo Zzsi [Sat, 2 Aug 2025 17:30:43 +0000 (13:30 -0400)] 
test: use "set -u" in in test-container.sh

To make testing more robust, use `set -u`.

5 months agofix(dracut.sh,lsinitrd.sh): use obj{copy,dump} set by toolchain
Nowa Ammerlaan [Sun, 13 Jul 2025 14:40:38 +0000 (16:40 +0200)] 
fix(dracut.sh,lsinitrd.sh): use obj{copy,dump} set by toolchain

If dracut is invoked in a context where the toolchain is configured
to use a certain objcopy implementation, use that one. This may be
the case if dracut is invoked via systemd's kernel-install in a
Gentoo ebuild on a llvm-only system.

Closes: https://github.com/dracut-ng/dracut-ng/issues/1424
Signed-off-by: Nowa Ammerlaan <nowa@gentoo.org>
5 months agofix(btrfs): write cmdline in install()
Antonio Alvarez Feijoo [Fri, 1 Aug 2025 07:11:38 +0000 (09:11 +0200)] 
fix(btrfs): write cmdline in install()

This fixes the build with `--kernel-only` option.

```
$ dracut -f --kernel-only
...
dracut[I]: *** Including module: btrfs ***
/usr/lib/dracut/modules.d/90btrfs/module-setup.sh: line 35: /var/tmp/dracut.dqV4ugj/initramfs/etc/cmdline.d/00-btrfs.conf: No such file or directory
```

5 months agodocs(release): document how to create release tag
Benjamin Drung [Mon, 4 Aug 2025 10:54:10 +0000 (12:54 +0200)] 
docs(release): document how to create release tag

Document how to create release tag in `tools/release.sh`.

5 months agoci(opensuse.conf.example): change log levels
Antonio Alvarez Feijoo [Mon, 4 Aug 2025 07:47:58 +0000 (09:47 +0200)] 
ci(opensuse.conf.example): change log levels

Upstream new log levels in openSUSE, present in Tumbleweed since
snapshot 20250612. Reduce default standard log verbosity from `info` to
`warning`, and increase syslog verbosity from none to `info`.

5 months agodocs: update NEWS.md and AUTHORS for release 108 108
dracutng[bot] [Fri, 1 Aug 2025 19:17:43 +0000 (19:17 +0000)] 
docs: update NEWS.md and AUTHORS for release 108

5 months agofeat(Makefile): explicitly list configs to install
Benjamin Drung [Thu, 31 Jul 2025 16:15:39 +0000 (18:15 +0200)] 
feat(Makefile): explicitly list configs to install

Instead of copying all configuration files in `dracut.conf.d`, copy the
wanted files explicitly. Install all configuration files that could be
useful for `--confdir`/`--add-confdir`, but exclude the distribution
configuration examples.

Move the Dracut test configurations back to `dracut.conf.d`.

5 months agotest: eliminate redundant code by eliminating determine_kernel_version
Jo Zzsi [Sun, 20 Jul 2025 15:11:26 +0000 (11:11 -0400)] 
test: eliminate redundant code by eliminating determine_kernel_version

Both dracut and determine_kernel_version contains a similar code block
for determining linux kernel version.

Instead of duplicating code, let dracut compute the kernel version and
call lsinitrd on the generated initramfs to determine the kernel
version for testing as well.

remove unbound KVERSION variable.

5 months agotest: extract KVERSION from the generated initramfs
Jo Zzsi [Sun, 20 Jul 2025 17:53:49 +0000 (13:53 -0400)] 
test: extract KVERSION from the generated initramfs

Use lsinitrd to list the files of the generated initramfs and extract
the the KVERSION that was computed by the dracut call.

5 months agofeat: add Debian/Ubuntu specific Dracut configuration
Benjamin Drung [Wed, 30 Jul 2025 14:21:15 +0000 (16:21 +0200)] 
feat: add Debian/Ubuntu specific Dracut configuration

Add the Debian/Ubuntu specific Dracut configuration, but do not install
this configuration by default. It is meant to be used via
`./configure --configprofile debian` during Debian/Ubuntu package build.

5 months agochore: rename suse.conf.example to opensuse.conf.example
Jo Zzsi [Sat, 19 Jul 2025 11:24:26 +0000 (07:24 -0400)] 
chore: rename suse.conf.example to opensuse.conf.example

opensuse is a more inclusive and more appropriate name for this
example file.

5 months agotest(SYSROOT): always run it in hostonly mode
Jo Zzsi [Wed, 30 Jul 2025 16:52:54 +0000 (12:52 -0400)] 
test(SYSROOT): always run it in hostonly mode

The recent addition of root password test coverage only passing in
hostonly mode. For now turn this test into hostonly test, as it does not
reduce test coverage significantly (BASIC test is running a similar test
without forcing hostonly).

5 months agodocs: switch to asciidoctor for man generation, with fallback
Ian Wienand [Tue, 29 Jul 2025 12:36:20 +0000 (14:36 +0200)] 
docs: switch to asciidoctor for man generation, with fallback

lintian complains about the man pages in the Debian/Ubuntu package. The
following warnings are only present when building the man pages with
asciidoc and they will be fixed by using asciidoctor:

```
W: dracut-core: groff-message troff:<standard input>:183: warning: macro 'an-trap' not defined [usr/share/man/man8/dracut.8.gz:1]
W: dracut-core: groff-message troff:<standard input>:537: warning: macro 'an-trap' not defined [usr/share/man/man7/dracut.cmdline.7.gz:1]
W: dracut-core: groff-message troff:<standard input>:537: warning: macro 'an-trap' not defined [usr/share/man/man7/dracut.kernel.7.gz:1]
W: dracut-core: groff-message troff:<standard input>:68: warning: macro 'an-trap' not defined [usr/share/man/man7/dracut.modules.7.gz:1]
W: dracut-core: groff-message troff:<standard input>:72: warning: macro 'an-trap' not defined [usr/share/man/man5/dracut.conf.5.gz:1]
```

Other projects like git use asciidoctor.

This switches the man page generator to asciidoctor, with a fallback option to
configure to use the existing asciidoc/docbook path.

The reason to do this is to consolidate the published site generation and man
page generation around asciidoctor.  With that in place, we can use some
asciidoctor features like extensions to better link the man pages together, or
provide other tweaks to the documentation.

This switches the default generation to asciidoctor, but adds a
--disable-asciidoctor switch as a temporary escape hatch for packagers.

The testing is converted to asciidoctor, with an additional test of the
asciidoc toolchain just to avoid major regressions there.

5 months agoci(suse.conf.example): set openSUSE-specific initrdname
Antonio Alvarez Feijoo [Wed, 30 Jul 2025 12:39:37 +0000 (14:39 +0200)] 
ci(suse.conf.example): set openSUSE-specific initrdname

5 months agofix(dracut-initramfs-restore): check for Debian initrd.img symlink
Benjamin Drung [Tue, 29 Jul 2025 18:59:45 +0000 (20:59 +0200)] 
fix(dracut-initramfs-restore): check for Debian initrd.img symlink

In case no initrd was found for the kernel version, also check the the
symlinks `/boot/initrd.img` (for Ubuntu) and `/initrd.img` (for Debian).

5 months agotest: use "set -u" in all tests
Benjamin Drung [Wed, 11 Jun 2025 18:05:07 +0000 (20:05 +0200)] 
test: use "set -u" in all tests

To make all tests more robust, use `set -u` in all tests.

5 months agotest: initialize variables for dracut-init.sh
Benjamin Drung [Mon, 16 Jun 2025 08:54:52 +0000 (10:54 +0200)] 
test: initialize variables for dracut-init.sh

dracut-init.sh sources dracut-functions.sh which expect several
variables to be specified when sourced. dracut.sh sets those variables.

5 months agotest(STORAGE): initialize global variables
Benjamin Drung [Wed, 11 Jun 2025 18:42:07 +0000 (20:42 +0200)] 
test(STORAGE): initialize global variables

Initialize the global variables in `test/TEST-20-STORAGE/test.sh` to
make the test work with `set -u`.

5 months agofeat: allow the use of $kernel in initrdname= config
Jo Zzsi [Thu, 19 Jun 2025 16:54:59 +0000 (12:54 -0400)] 
feat: allow the use of $kernel in initrdname= config

Assign $kernel before conf files are sourced.

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1310
5 months agofix(base): base module failure if root password is already set
Jo Zzsi [Tue, 29 Jul 2025 17:59:35 +0000 (13:59 -0400)] 
fix(base): base module failure if root password is already set

Replace sed with grep and simplify logic by removing a conditional
and if needed simply copying the line from the host shadow file to
the initramfs shadow file.

Add test coverage for root entry in /etc/shadow.

Fixes https://github.com/dracut-ng/dracut-ng/issues/1478

5 months agofix(systemd-sysusers): maintain users and groups
Jo Zzsi [Sun, 13 Jul 2025 00:31:12 +0000 (20:31 -0400)] 
fix(systemd-sysusers): maintain users and groups

Currently dracut deletes entries for users and groups created
by systemd-sysusers.

This PR maitaines users and groups created by systemd-sysusers
and merges root password from the host with the shadow file
created by systemd-sysusers.

Add test assertion to check if systemd-coredump user is present,
which is expected on a systemd-enabled system.

Allow the owner to read and write /etc/shadow and /etc/gshadow
in the initramfs.

This fixes a permission error during dracut when it's not run
as root:

dracut[I]: *** Creating image file '.../initramfs.img' ***
cpio: etc/gshadow: Cannot open: Permission denied
cpio: etc/shadow: Cannot open: Permission denied
dracut[F]: Creation of .../initramfs.img failed

Indeed, the permissions were set empty:

$ cd $initdir
$ ls -l etc/gshadow etc/shadow
----------. 1 myuser mygroup  179 mar  26 10:29 gshadow
----------. 1 myuser mygroup   32 mar  26 10:29 shadow

This approach also enables systemd-sysusers credentials, see
https://www.freedesktop.org/software/systemd/man/latest/systemd-sysusers.html#Credentials

5 months agofix(dracut): only call uname -r if it is safe to do
Jo Zzsi [Tue, 29 Jul 2025 09:54:41 +0000 (05:54 -0400)] 
fix(dracut): only call uname -r if it is safe to do

Change the priority order to determine the kernel version of it is
not specified on the command line.

Only call uname -r if it is safe to do, meaning if it is confirmed
that dracut is not called from within a container.

Follow-up to 2b2debd.

5 months agofix(fcoe-uefi): exit early on empty vlan
Pavel Valena [Sat, 12 Jul 2025 16:47:28 +0000 (12:47 -0400)] 
fix(fcoe-uefi): exit early on empty vlan

Exit early in case get_fcoe_boot_vlan exits with error or just an empty string,
instead of producing invalid config entry.

5 months agotest: remove unnecessary drivers from test dracut modules
Jo Zzsi [Thu, 3 Jul 2025 13:59:05 +0000 (09:59 -0400)] 
test: remove unnecessary drivers from test dracut modules

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1324
To increase test coverage for kernel-modules and instead
of hard-coding required Linux kernel modules,
use the kernel-modules dracut module instead.

This change is enabled by 8730476 .

5 months agofix(generic.conf): increase ordering for generic.conf
Jo Zzsi [Tue, 15 Jul 2025 16:26:15 +0000 (12:26 -0400)] 
fix(generic.conf): increase ordering for generic.conf

In the unlikely case that both hostonly and generic config
is installed generic should take an explicit precedence.

Currently both hostonly and generic config has the same ordering
number (10), so the precedence is based on the rest of the name
and not based on the ordering number.

Now that hostonly is the default configuration that gets installed
by default, it is particularly important for generic has higher
precedence as generic is likely only installed as an opt-in
configuration and not as the "default".

5 months agofix: load essential storage kernel modules in sloppy hostonly mode
Jo Zzsi [Sat, 24 May 2025 01:56:56 +0000 (21:56 -0400)] 
fix: load essential storage kernel modules in sloppy hostonly mode

Essential storage kernel modules (e.g. sd_mod) should be
always included unless hostonly_mode is set to strict.

This PR installs even more drivers in hostonly sloppy mode
as a follow-up to 8519dcd .

Fixes: https://github.com/dracut-ng/dracut-ng/issues/748
5 months agofix(systemd-udevd): handle root=gpt-auto for systemd-v258
Antonio Alvarez Feijoo [Mon, 28 Jul 2025 08:10:45 +0000 (10:10 +0200)] 
fix(systemd-udevd): handle root=gpt-auto for systemd-v258

A new file 90-image-dissect.rules was split from 99-systemd.rules to handle
gpt-root.

Since https://github.com/systemd/systemd/commit/e3f6ae1d09d28dbe31ccf67122486ad037d25ed0

5 months agoperf(systemd-udevd): 99-systemd.rules added in two places
Antonio Alvarez Feijoo [Mon, 28 Jul 2025 08:07:49 +0000 (10:07 +0200)] 
perf(systemd-udevd): 99-systemd.rules added in two places

5 months agofeat(dracut): drop DRACUT_PATH and rely on PATH
Benjamin Drung [Sun, 20 Jul 2025 12:14:00 +0000 (14:14 +0200)] 
feat(dracut): drop DRACUT_PATH and rely on PATH

This reverts commit eab9b75c8a9b ("dracut.sh: add DRACUT_PATH").

Drop `DRACUT_PATH` and rely on `PATH` instead to avoid user confusion
and behave like most other programs.

To avoid failing on misconfiguration (e.g. when `/usr/sbin` is not in
`PATH`), ensure that the common default paths `/usr/sbin`, `/usr/bin`,
`/sbin`, and `/bin` are included in `PATH`.

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1467
5 months agofix(dracut): detect if systemd-detect-virt is available before calling it
Jo Zzsi [Sun, 20 Jul 2025 23:37:31 +0000 (19:37 -0400)] 
fix(dracut): detect if systemd-detect-virt is available before calling it

When systemd-detect-virt is not available (e.g. in a non-systemd host)
The following error is reported

```
/usr/sbin/dracut: line 1435: systemd-detect-virt: command not found
```

Let's detect if systemd-detect-virt is available before calling it.

5 months agotest: compute VMLINUZ in run-qemu only when it is needed
Jo Zzsi [Sat, 19 Jul 2025 20:13:20 +0000 (16:13 -0400)] 
test: compute VMLINUZ in run-qemu only when it is needed

Currently VMLINUZ is computed and set even when it is not needed
(e.g. for test 80). Move the computation to run-qemu instead
and only set it when needed.

5 months agotest: prefer testing dracut over testing ukify
Jo Zzsi [Sat, 19 Jul 2025 19:54:28 +0000 (15:54 -0400)] 
test: prefer testing dracut over testing ukify

Dracut can call ukify when available to generate UKI
(see acfddd69f). Prefer testing this flow, over testing calling ukify
directly from the test-case.

This change also remove the need for test-cases to have direct access
to VMLINUZ variable.

5 months agofix(dracut): consolidate reporting running in a container
Jo Zzsi [Sat, 19 Jul 2025 03:05:58 +0000 (23:05 -0400)] 
fix(dracut): consolidate reporting running in a container

dinfo call to report running in a container does not work as expected
as dinfo is not yet defined in the first code block.

In addition we're already reporting running in a container in some
other conditions, which would lead to reporting it twice.

Consolidate reporting running in a container into one single place
and make it work, and reporting is as information and not as a warning
as using dracut inside container is common.

Reordered two code blocks to enable the usage of dinfo to simplify
reporting.

Follow-up to 2b2debd .

5 months agofeat(dracut): support SOURCE_DATE_EPOCH
Benjamin Drung [Sat, 19 Jul 2025 08:30:19 +0000 (10:30 +0200)] 
feat(dracut): support SOURCE_DATE_EPOCH

`SOURCE_DATE_EPOCH` is a standardised environment variable that
distributions can set centrally and have build tools consume this in
order to produce reproducible output (see
https://reproducible-builds.org/docs/source-date-epoch/).

Enable reproducible builds when `SOURCE_DATE_EPOCH` is set and use this
timestamp when clamping the mtime.

5 months agodocs(test): add new test/README.md
Marc Herbert [Tue, 15 Jul 2025 22:33:53 +0000 (22:33 +0000)] 
docs(test): add new test/README.md

As discussed on July 14th in #1268, add a new and small test/README.md
file for convenience. This is just a list of pointers/shortcuts to
existing documentation. Add enough English around the pointers to make
it easy to find the new location even if stuff moves. Even when pointers
go out of date, it makes a big difference to have an idea of what you're
looking for - and that it even exists in the first place!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
5 months agofix: increase deteminism by not relying on the default sorting from ls
Jo Zzsi [Wed, 16 Jul 2025 19:36:00 +0000 (15:36 -0400)] 
fix: increase deteminism by not relying on the default sorting from ls

In the unlikely case where there are several kernels installed on the host
and kernel is not specified on the command line, let's not rely
on the the default sorting from ls and call ls with -v for natural
sort of (version) numbers within text.

5 months agofix(dracut.sh): do not use uname to detect kernel version in a container
Jo Zzsi [Wed, 16 Jul 2025 14:21:01 +0000 (10:21 -0400)] 
fix(dracut.sh): do not use uname to detect kernel version in a container

A big general papercut with dracut right now in that it always assumes
the kernel it's running on is the kernel to target.

This commit lets dracut to detect that it's in a container (e.g. systemd-detect-virt -c),
and check for a single /usr/lib/modules/$kver directory and automatically use that kernel.

Currently this kernel version detection has three copies in the source
(dracut.sh, lsinitrd.sh,test-functions). This commit keeps the
logic for the three copies the same. As a follow-up commit, we should
try to actually share the code for this logic instead of copying it.

Fixes https://github.com/dracut-ng/dracut-ng/issues/1455.

5 months agofix(dmsquash-live): erofs collision with latest util-linux
Karel Zak [Thu, 19 Jun 2025 16:32:13 +0000 (12:32 -0400)] 
fix(dmsquash-live): erofs collision with latest util-linux

This PR fixes the issue that recent kernels can mount EROFS
directly without loop devices, and this feature is enabled in Fedora
kernels (>=6.12; CONFIG_EROFS_FS_BACKED_BY_FILE=y).
This feature is now supported by mount/libmount, too.

I think the best approach would be to avoid the second mount altogether,
independently of the util-linux version.
It is more robust to use a bind mount there than to attempt to create
a second instance of the same file system.

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1384
5 months agochore: eliminate overlapping functions
Jo Zzsi [Tue, 15 Jul 2025 02:06:42 +0000 (22:06 -0400)] 
chore: eliminate overlapping functions

In its current form inst_library function executes the same set of
commands as the inst function.

Copying (instead of reusing code) is usually preferred, especially
in this particular case where inst_library function is not used by
dracut, so it is not tested by dracut CI.

After this commit, inst_library would just call inst, and inst
is being used and as such tested by dracut CI, so it makes it
less likely to egress out-of tree coide depending on dracut.

5 months agofix(dracut): ensure hardlink deduplication is reproducible
Chris Riches [Wed, 9 Jul 2025 16:40:18 +0000 (16:40 +0000)] 
fix(dracut): ensure hardlink deduplication is reproducible

By default, hardlink will only deduplicate files with identical mtimes,
down to one-second granularity. If a dracut module rapidly generates
multiple identical files, it is completely up to chance as to whether
their mtimes cross a second boundary or not, and thus whether they get
deduplicated or not. This results in non-reproducible output.

Re-order hardlink with respect to clamping to avoid this problem.

Fixes: https://issues.redhat.com/browse/RHEL-101901
5 months agotest(SYSTEMD): convert test to run without initqueue
Jo Zzsi [Tue, 15 Jul 2025 02:55:31 +0000 (22:55 -0400)] 
test(SYSTEMD): convert test to run without initqueue

Systemd itself provides similar functionality to the
dracut initqueue module. It has been a long-standing
criticism of dracut systemd integration that
initqueue should not be necessary for most system boot scenarios.

While there is still a long way to go, we can start testing some of
the common systemd boot scenarios without initqueue.

See https://github.com/dracut-ng/dracut-ng/issues/1191

5 months agotest: remove hard-off test hooks hooks
Jo Zzsi [Thu, 3 Jul 2025 16:15:21 +0000 (12:15 -0400)] 
test: remove hard-off test hooks hooks

These hard-off test hooks make the test shut down in a
non-graceful way.

These hooks are no longer required.

Removing these hooks would make the test run similarly
to production environments.

5 months agofix: network-manager dracut module no longer depends on systemd
Jo Zzsi [Sun, 13 Jul 2025 22:26:03 +0000 (18:26 -0400)] 
fix: network-manager dracut module no longer depends on systemd

Previously dracut network-manager module only worked with systemd.

Now after 58baf86, network-manager dracut module should work
in non-systemd Linux distributions as well, such as Void Linux.

This commit re-enables network-manager dracut module for all
Linux distributions.

5 months agofix(dracut.conf.d): reserve namespace 50 to out-of-tree configurations
Jo Zzsi [Sat, 12 Jul 2025 17:08:20 +0000 (13:08 -0400)] 
fix(dracut.conf.d): reserve namespace 50 to out-of-tree configurations

50 should be reserved for out-of-tree dracut configurations, just like
50 is reserved for out-of-tree dracut modules. This policy makes dracut
more consistent and easier to reason about.

Change the built-in dracut configurations from namespace 50 to namespace 10.

Document that the recommended ordering for distribution or user provided
configuration files is in the range of 50-59.

5 months agoci(gentoo): remove workaround for forcing hostonly mode
Jo Zzsi [Sat, 12 Jul 2025 16:58:08 +0000 (12:58 -0400)] 
ci(gentoo): remove workaround for forcing hostonly mode

Forcing hostonly mode for Gentoo was introduced in commit
9fc9128, as a step towards enabling hostonly mode by default
for all distributions.

After 62fdf59 this workaround for Gentoo is no longer needed to
be maintained as now hostonly is the default for all Linux
installation (set in configure).

5 months agoci: install NetworkManager into the Void CI container
Jo Zzsi [Sun, 13 Jul 2025 22:36:56 +0000 (18:36 -0400)] 
ci: install NetworkManager into the Void CI container

Previously dracut network-manager package only worked with systemd.
Now after 58baf86, network-manager dracut package should work in
non-systemd Linux distributions as well, such as Void Linux.

Install NetworkManager into the Void CI container to enable
testing it on the CI.