]> git.ipfire.org Git - thirdparty/dracut.git/log
thirdparty/dracut.git
9 months agofix(dracut-install): protect against broken links pointing to themselves
Antonio Alvarez Feijoo [Thu, 10 Aug 2023 07:22:28 +0000 (09:22 +0200)] 
fix(dracut-install): protect against broken links pointing to themselves

`readlink` does not return an error if a symbolic link points to itself, which
can cause a stack overflow due to infinite recursion in the `get_real_file`
function.

Although this type of recursive links should not exist, we discovered this
issue on a real system. It can be reproduced as follows:

```
> ls -l /lib64/libblkid.so
-rwxr-xr-x 1 root root 224368 Aug  9 15:13 /lib64/libblkid.so
> rm -f /lib64/libblkid.so
> ln -s /lib64/libblkid.so /lib64/libblkid.so
> ls -l /lib64/libblkid.so
lrwxrwxrwx 1 root root 18 Aug  9 15:06 /lib64/libblkid.so -> /lib64/libblkid.so
> dracut -f -I "/lib64/libblkid.so" test.img
...
dracut-install: Handle '/lib64/libblkid.so'
dracut-install: dracut_install('/lib64/libblkid.so', '/lib64/libblkid.so', 0, 0, 1)
dracut-install: get_real_file('/lib64/libblkid.so')
dracut-install: get_real_file: readlink('/lib64/libblkid.so') returns '/lib64/libblkid.so'
dracut-install: get_real_file('/lib64/libblkid.so') => '/lib64/libblkid.so'
...
[infinite recursion]
...
dracut-install: dracut_install('/lib64/libblkid.so', '/lib64/libblkid.so', 0, 0, 1)
dracut-install: get_real_file('/lib64/libblkid.so')
dracut-install: get_real_file: readlink('/lib64/libblkid.so') returns '/lib64/libblkid.so'
dracut-install: get_real_file('/lib64/libblkid.so') => '/lib64/libblkid.so'
dracut-install: dracut_install('/lib64/libblkid.so', '/lib64/libblkid.so', 0, 0, 1)
/usr/lib/dracut/dracut-init.sh: line 298: 20949 Segmentation fault      (core dumped) $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
dracut: FAILED: /usr/lib/dracut/dracut-install --debug -D /var/tmp/dracut.dqLmOS/initramfs -a /lib64/libblkid.so
...
```

After applying this patch:

```
> dracut -f -I "/lib64/libblkid.so" test.img
...
dracut-install: Handle '/lib64/libblkid.so'
dracut-install: dracut_install('/lib64/libblkid.so', '/lib64/libblkid.so', 0, 0, 1)
dracut-install: get_real_file('/lib64/libblkid.so')
dracut-install: get_real_file: readlink('/lib64/libblkid.so') returns '/lib64/libblkid.so'
dracut-install: ERROR: '/lib64/libblkid.so' is pointing to itself.
dracut-install: ERROR: installing '/lib64/libblkid.so'
dracut: FAILED: /usr/lib/dracut/dracut-install --debug -D /var/tmp/dracut.4w8FVL/initramfs -a /lib64/libblkid.so
...
```

9 months agofix(dracut.sh): exit if resolving executable dependencies fails
Antonio Alvarez Feijoo [Wed, 9 Aug 2023 09:28:15 +0000 (11:28 +0200)] 
fix(dracut.sh): exit if resolving executable dependencies fails

We came across an issue where, when resolving executable dependencies, a call to
a buggy glib function in `dracut-install` was causing a termination with
SIGSEGV, but dracut didn't stop the build process, which resulted in an
unbootable initrd, due to missing required libraries.

```
dracut: *** Resolving executable dependencies ***
xargs: /usr/lib/dracut/dracut-install: terminated by signal 11
dracut: *** Resolving executable dependencies done ***
```

Therefore, stop the initrd creation in this case.

9 months agofeat(dracut): add --sbat option to add sbat policy to UKI
Emanuele Giuseppe Esposito [Wed, 12 Jul 2023 07:50:47 +0000 (03:50 -0400)] 
feat(dracut): add --sbat option to add sbat policy to UKI

Take existing .sbat section from the uefi stub and merge it
with vmlinux .sbat (if it exists) and user-provided .sbat parameters
using the new --sbat option.

For some reasons, --update-section in objcopy does not resize the
.sbat section, so remove the section from the stub and add it
to the UKI as new one, to avoid having incomplete SBAT strings.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
9 months agoci: run all local tests on all containers (including Gentoo)
Henrik Gombos [Thu, 3 Aug 2023 01:08:27 +0000 (21:08 -0400)] 
ci: run all local tests on all containers (including Gentoo)

9 months agochore(dracut-init.sh): remove support for obsolete syntax
Laszlo Gombos [Sat, 18 Mar 2023 00:38:23 +0000 (00:38 +0000)] 
chore(dracut-init.sh): remove support for obsolete syntax

Old syntax dracut modules had its check install installkernel
scripts in dedicated shell files and did not support module
dependencies.

9 months agoci: change the order of lint jobs as lint_shell is more likely to fail
Henrik Gombos [Wed, 26 Jul 2023 12:32:36 +0000 (08:32 -0400)] 
ci: change the order of lint jobs as lint_shell is more likely to fail

9 months agoci: migrate from systemd-boot to systemd-utils in Gentoo container
Henrik Gombos [Mon, 31 Jul 2023 12:15:42 +0000 (08:15 -0400)] 
ci: migrate from systemd-boot to systemd-utils in Gentoo container

See https://www-cdn.gentoo.org/support/news-items/2022-04-19-systemd-utils.html

Also no longer include open-iscsi for musl as it fails to compile, see
https://bugs.gentoo.org/908587

9 months agoci: do not run test container generation on forked repos by default
Henrik Gombos [Sun, 30 Jul 2023 13:31:56 +0000 (09:31 -0400)] 
ci: do not run test container generation on forked repos by default

If CONTAINER Github variable set, reenable the github action
schedule.

9 months agorefactor(install): log about missing firmware only once
David Disseldorp [Wed, 26 Jul 2023 13:49:41 +0000 (15:49 +0200)] 
refactor(install): log about missing firmware only once

When attempting to locate a firmware path under each of the firwaredirs
parent directories, Dracut logs an error for every missing path.
Instead, only log the error if the firmware path isn't found under any
of the firmwaredirs.

Signed-off-by: David Disseldorp <ddiss@suse.de>
9 months agotest: increase test VM memory from 512M to 1024M to avoid OOM killer
Henrik Gombos [Sat, 29 Jul 2023 02:49:21 +0000 (22:49 -0400)] 
test: increase test VM memory from 512M to 1024M to avoid OOM killer

9 months agofix(integrity): do not require ls
Henrik Gombos [Wed, 26 Jul 2023 12:08:59 +0000 (08:08 -0400)] 
fix(integrity): do not require ls

ls is not used by the integrity dracut module.

9 months agoci: match comment with code
Henrik Gombos [Wed, 26 Jul 2023 12:04:45 +0000 (08:04 -0400)] 
ci: match comment with code

Properly document the time container generation runs daily.

9 months agoci: automate release generation
Henrik Gombos [Sun, 16 Jul 2023 17:03:47 +0000 (13:03 -0400)] 
ci: automate release generation

9 months agoci: allow the release generation script to compute the next release
Henrik Gombos [Sun, 16 Jul 2023 16:52:28 +0000 (12:52 -0400)] 
ci: allow the release generation script to compute the next release

9 months agorefactor(Makefile): improve AUTHORS and CONTRIBUTORS targets
Henrik Gombos [Thu, 13 Jul 2023 18:43:46 +0000 (14:43 -0400)] 
refactor(Makefile): improve AUTHORS and CONTRIBUTORS targets

Make make rules more generic to be able to use them not just in
manual release process but also in CI release process.

9 months agofix(dracut-init.sh): `module_check` method ignores `forced` option
Antonio Alvarez Feijoo [Fri, 14 Jul 2023 09:48:34 +0000 (11:48 +0200)] 
fix(dracut-init.sh): `module_check` method ignores `forced` option

When the `module_check` method is called passing 3 arguments (all calls right
now), the `forced` option is ignored, so the `hostonly` variable is never unset
before the module's `check` method is called.

9 months agofeat(systemd-rfkill): remove module
Antonio Alvarez Feijoo [Wed, 5 Jul 2023 06:24:21 +0000 (08:24 +0200)] 
feat(systemd-rfkill): remove module

The rfkill service and socket provided by systemd will not be activated in the
initrd since https://github.com/systemd/systemd/commit/49c55abc

9 months agofix(man): add missing initrd-root-device.target to flow chart
Antonio Alvarez Feijoo [Wed, 5 Jul 2023 13:25:43 +0000 (15:25 +0200)] 
fix(man): add missing initrd-root-device.target to flow chart

This target was added since https://github.com/dracutdevs/dracut/commit/d4efc0ae
and is ordered between `basic.target` and `sysroot.mount`, see `man bootup.7`
(`dracut-pre-mount.service` starts after).

9 months agofix(dracut-init.sh): use the local _ret variable
Frederick Grose [Sun, 23 Jul 2023 17:25:52 +0000 (13:25 -0400)] 
fix(dracut-init.sh): use the local _ret variable

Use the local _ret variable when declared.

9 months agoci: install util-linux-systemd and systemd-boot into openSUSE container
Antonio Alvarez Feijoo [Wed, 12 Jul 2023 15:25:36 +0000 (17:25 +0200)] 
ci: install util-linux-systemd and systemd-boot into openSUSE container

- `findmnt` is installed by `util-linux-systemd`
- `/usr/lib/systemd/boot/efi/linuxx64.efi.stub` is installed by `systemd-boot`

9 months agofix(dracut.sh): shellcheck warning SC1004
Pavel Valena [Sun, 23 Jul 2023 16:36:46 +0000 (18:36 +0200)] 
fix(dracut.sh): shellcheck warning SC1004

As stated in [1] it should work without literal backslash+linefeed.

[1] https://github.com/koalaman/shellcheck/issues/1246

9 months agofix(dracut.sh): use gawk for strtonum
Sam James [Thu, 20 Jul 2023 03:36:01 +0000 (04:36 +0100)] 
fix(dracut.sh): use gawk for strtonum

strtonum is a gawkism and is not available in all awks, e.g. mawk. Use gawk
to avoid failure.

Fixes: f32e95bcadbc5158843530407adc1e7b700561b1
Signed-off-by: Sam James <sam@gentoo.org>
10 months agofix(man): remove duplicate entry
Henrik Gombos [Sat, 15 Jul 2023 11:58:45 +0000 (07:58 -0400)] 
fix(man): remove duplicate entry

DRACUT_COMPRESS_BZIP2 was mentioned several times in the list.

10 months agoci: release
Henrik Gombos [Wed, 28 Jun 2023 12:04:08 +0000 (12:04 +0000)] 
ci: release

10 months agofeat(livenet): add memory size check depending on live image size
Thomas Blume [Mon, 17 Apr 2023 13:41:07 +0000 (15:41 +0200)] 
feat(livenet): add memory size check depending on live image size

For writeable live images, the memory must hold the complete image.
That means it must be at least the size of the image plus some RAM
necessary to run processes.
With too small RAM, the OOM Killer steps in and makes the boot hang.
This patch lets the system go into the emergency shell instead.

The default minimum RAM after subtracting the live image size is set to 1G.
The parameter rd.minmem is added to modify this.

10 months agochore(gentoo.conf): remove examples to avoid confusion
Henrik Gombos [Wed, 28 Jun 2023 16:50:00 +0000 (16:50 +0000)] 
chore(gentoo.conf): remove examples to avoid confusion

These examples are not used and not maintained and changing them
would not have an impact on Gentoo.

10 months agofix(modsign): load keys to correct keyring
Michał Zegan [Wed, 26 Oct 2022 16:10:38 +0000 (18:10 +0200)] 
fix(modsign): load keys to correct keyring

Until now, 03modsign module was loading keys from /lib/modules/keys/* into the
current session keyring.
This change makes it add keys to the secondary trusted keyring. This works
only as long as added certificate is signed by key from the same keyring.

10 months agofix(dmsquash-live-autooverlay): specify filesystemtype when it is already known
Laszlo Gombos [Wed, 17 May 2023 14:36:03 +0000 (14:36 +0000)] 
fix(dmsquash-live-autooverlay): specify filesystemtype when it is already known

10 months agochore: remove git2spec.pl, it is no longer used
Laszlo Gombos [Fri, 3 Mar 2023 00:49:26 +0000 (00:49 +0000)] 
chore: remove git2spec.pl, it is no longer used

10 months agofix(fs-lib): remove quoting form the first argument of the e2fsck call
Laszlo Gombos [Sat, 4 Mar 2023 23:28:17 +0000 (23:28 +0000)] 
fix(fs-lib): remove quoting form the first argument of the e2fsck call

Fix regression.

10 months agofix(Makefile): remove leftover rpm build rules
Laszlo Gombos [Mon, 20 Feb 2023 23:44:44 +0000 (23:44 +0000)] 
fix(Makefile): remove leftover rpm build rules

10 months agofix(Makefile): no longer upload to kernel.org
Laszlo Gombos [Tue, 21 Feb 2023 02:33:42 +0000 (02:33 +0000)] 
fix(Makefile): no longer upload to kernel.org

10 months agofeat(nvmf): add code for parsing the NBFT
Martin Wilck [Fri, 16 Sep 2022 19:36:52 +0000 (21:36 +0200)] 
feat(nvmf): add code for parsing the NBFT

Add code to parse the Nvme-oF Boot Firmware Table (NBFT) according
to the NVM Express Boot Specification 1.0 [1]. The implementation in
dracut follows a similar general approach as iBFT support in the
iscsi module.

NBFT support requires two steps:

(1) Setting up the network and routing according to the
    HFI ("Host Fabric Interface") records in the NBFT,
(2) Establishing the actual NVMe-oF connection.

(1) is accomplished by reading the NBFT using JSON output from
the "nvme nbft show" command, and transforming it into command
line options ("ip=", "rd.neednet", etc.) understood by dracut's
network module and its backends. The resulting network setup code
is backend-agnostic. It has been tested with the "network-legacy"
and "network-manager" network backend modules. The network setup
code supports IPv4 and IPv6 with static, RA, or DHCP configurations,
802.1q VLANs, and simple routing / gateway setup.

(2) is done using the "nvme connect-all" command [2] in the netroot handler,
which is invoked by networking backends when an interface gets fully
configured. This patch adds support for "netboot=nbft". The "nbftroot"
handler calls nvmf-autoconnect.sh, which contains the actual connect
logic. nvmf-autoconnect.sh itself is preserved, because there are
other NVMe-oF setups like NVMe over FC which don't depend on the
network.

The various ways to configure NVMe-oF are prioritized like this:

 1 FC autoconnect from kernel commandline (rd.nvmf.discover=fc,auto)
 2 NBFT, if present
 3 discovery.conf or config.json, if present, and cmdline.d parameters,
   if present (rd.nvmf.discovery=...)
 4 FC autoconnect (without kernel command line)

The reason for this priorization is that in the initial RAM fs, we try
to activate only those connections that are necessary to mount the root
file system. This avoids confusion, possible contradicting or ambiguous
configuration, and timeouts from unavailable targets.

A retry logic is implemented for enabling the NVMe-oF connections,
using the "settled" initqueue, the netroot handler, and eventually, the
"timeout" initqueue. This is similar to the retry logic of the iscsi module.
In the "timeout" case, connection to all possible NVMe-oF subsystems
is attempted.

Two new command line parameters are introduced to make it possible to
change the priorities above:

 - "rd.nvmf.nonbft" causes the NBFT to be ignored,
 - "rd.nvmf.nostatic" causes any statically configured NVMe-oF targets
   (config.json, discovery.conf, and cmdline.d) to be ignored.

These parameters may be helpful to skip attempts to set up broken
configurations.

At initramfs build time, the nvmf module is now enabled if an NBFT
table is detected in the system.

[1] https://nvmexpress.org/wp-content/uploads/NVM-Express-Boot-Specification-2022.11.15-Ratified.pdf
[2] NBFT support in nvme-cli requires the latest upstream code (> v2.4).

Signed-off-by: Martin Wilck <mwilck@suse.com>
Co-authored-by: John Meneghini <jmeneghi@redhat.com>
Co-authored-by: Charles Rose <charles.rose@dell.com>
10 months agofix(nvmf): support /etc/nvme/config.json
Martin Wilck [Thu, 9 Mar 2023 15:55:36 +0000 (16:55 +0100)] 
fix(nvmf): support /etc/nvme/config.json

Since nvme-cli 2.0, configuration of subsystems to connect to is
stored under `/etc/nvme` in either `discovery.conf` or `config.json`.
Attempt discovery also if the latter exists, but not the former.
Also, install "config.json" if it's present on the root FS.

As before, "rd.nvmf.discover=fc,auto" will force either file to be ignored,
and NBFT-defined targets take precedence if found.

10 months agofix(nvmf): install 8021q module unconditionally
Martin Wilck [Thu, 12 Jan 2023 10:06:35 +0000 (11:06 +0100)] 
fix(nvmf): install 8021q module unconditionally

In NBFT setups, VLAN can be configured in the firmware.
Add the 8021q module in hostonly mode even if VLAN is currently
not used to be prepared for such configuration change.

10 months agofix(install.d): respect even more kernel-install vars, plus style fixes
Andrew Ammerlaan [Thu, 22 Jun 2023 07:45:36 +0000 (09:45 +0200)] 
fix(install.d): respect even more kernel-install vars, plus style fixes

- More verbose with KERNEL_INSTALL_VERBOSE=1

- Use KERNEL_INSTALL_CONF_ROOT if defined

- Fallback to /usr/lib/os-release if /etc/os-release does not exist

- Fallback to "Linux $KERNEL_VERSION" if no PRETTY_NAME found

- Styling fixes

Co-authored-by: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
10 months agofix(install.d): respect more kernel-install env variables
Andrew Ammerlaan [Sat, 17 Jun 2023 06:18:55 +0000 (08:18 +0200)] 
fix(install.d): respect more kernel-install env variables

- If kernel-install has defined a staging area for us
(KERNEL_INSTALL_STAGING_AREA) install generated initrd/uki.efi there.
The actual install is then handled by 90-loaderentry.install or
90-uki-copy-install.

- Also skip regeneration if an uki.efi already exists.

- Pass --kernel-image to dracut, this is required to generate an uki (uefi=yes)

- Add --no-uefi argument to dracut rescue image generation, this ensures that
it at least installs correctly. TODO: Rework 51-dracut-rescue.install to also
work with uki's.

This fixes installing a kernel with uefi=yes in dracut config and layout=uki
in kernel/install.conf.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
10 months agofix(dracut.sh): also prevent fsfreeze for tmpfs
Andrew Ammerlaan [Sat, 17 Jun 2023 06:18:05 +0000 (08:18 +0200)] 
fix(dracut.sh): also prevent fsfreeze for tmpfs

KERNEL_INSTALL_STAGING_AREA is often on tmpfs, it cannot be frozen

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
10 months agofix(dmsquash-live): allow other fstypes
Laszlo Gombos [Sat, 17 Dec 2022 01:18:46 +0000 (01:18 +0000)] 
fix(dmsquash-live): allow other fstypes

Use det_fs to determine fstype and provide fallback instead of
just calling blkid.

Many other dracut modules (e.g. fs-lib, btrfs, mdraid) are already
using det_fs to determine fstype.

10 months agotest(DMSQUASH): add test for NTFS
Laszlo Gombos [Sat, 17 Dec 2022 01:00:28 +0000 (01:00 +0000)] 
test(DMSQUASH): add test for NTFS

Add a test case for mounting the root filesystem from
a squashfs image file that is store on an NTFS drive.

The test case is using ntfs3 module to mount the NTFS drive.

10 months agotest(16): check for failure after each sub-test run
Laszlo Gombos [Sat, 17 Dec 2022 00:34:25 +0000 (00:34 +0000)] 
test(16): check for failure after each sub-test run

The test case had a bug where it only checked for
at least one of the passing instead of all the subtests passing.

10 months agofix(bluetooth): make bluetooth rules more strict
Laszlo Gombos [Fri, 24 Feb 2023 17:12:44 +0000 (17:12 +0000)] 
fix(bluetooth): make bluetooth rules more strict

Only warn if bluetooth kernel module is loaded
at the time of initrd generation in hostonly mode.

10 months agofix(bluetooth): add missing files
Antonio Alvarez Feijoo [Tue, 9 May 2023 12:25:22 +0000 (14:25 +0200)] 
fix(bluetooth): add missing files

- org.bluez.service dbus system service
- bluetooth.service override conf

10 months agofix(bluetooth): include it if Appearance matches the value assigned for keyboard
Antonio Alvarez Feijoo [Tue, 9 May 2023 12:24:57 +0000 (14:24 +0200)] 
fix(bluetooth): include it if Appearance matches the value assigned for keyboard

Following the Bluetooth spec [1], Assigned Numbers Document, Rev. 2023-05-04,
Section 2.6.3, Appearance Sub-category, the Appearance value defined for
keyboards is 0x03C1.

This value must be checked to include the bluetooth module in hostonly mode,
because some Bluetooth keyboards do not set the Class attribute.

[1] https://www.bluetooth.com/specifications/assigned-numbers/

10 months agofix(bluetooth): warn user instead of including it by default
Henrik Gombos [Sat, 17 Jun 2023 18:15:03 +0000 (18:15 +0000)] 
fix(bluetooth): warn user instead of including it by default

Bluetooth module can result in a known race condition at boot.
Discourage its usage by default.

10 months agofix(systemd-timedated): correct typo in override path
Antonio Alvarez Feijoo [Fri, 12 May 2023 07:44:51 +0000 (09:44 +0200)] 
fix(systemd-timedated): correct typo in override path

10 months agofix(systemd-resolved): correct typo in override path
Antonio Alvarez Feijoo [Fri, 12 May 2023 07:43:59 +0000 (09:43 +0200)] 
fix(systemd-resolved): correct typo in override path

10 months agofix(systemd-networkd): correct typos in override paths
Antonio Alvarez Feijoo [Fri, 12 May 2023 07:43:37 +0000 (09:43 +0200)] 
fix(systemd-networkd): correct typos in override paths

10 months agofix(dracut-init.sh): correct check in `is_qemu_virtualized` function
Antonio Alvarez Feijoo [Thu, 27 Apr 2023 15:28:44 +0000 (17:28 +0200)] 
fix(dracut-init.sh): correct check in `is_qemu_virtualized` function

Do not redirect `systemd-detect-virt` to /dev/null, otherwise, the `vm` variable
is always empty. This function was working only thanks to the following /sys
check.

Reported-by: Raymund Will <rw@suse.com>
10 months agofix(btrfs): do not require module via cmdline when --no-kernel
Michal Koutný [Mon, 19 Jun 2023 14:40:49 +0000 (16:40 +0200)] 
fix(btrfs): do not require module via cmdline when --no-kernel

initrd built without modules would fail when it attempts to load a
kernel module. (Use case scenario: kernel with built-in module.)

synthesize an the cmdline only when modules are truly installed.

10 months agofix(btrfs): add missing cmdline function
Antonio Alvarez Feijoo [Wed, 19 Apr 2023 07:25:34 +0000 (09:25 +0200)] 
fix(btrfs): add missing cmdline function

Otherwise `dracut --print-cmdline` does not print the command line option added
by the btrfs module.

10 months agoci: conditionally add tgt to Gentoo container
Laszlo Gombos [Thu, 18 May 2023 19:04:24 +0000 (19:04 +0000)] 
ci: conditionally add tgt to Gentoo container

This commit allows to run test 30 and test 35 on a Gentoo.

Use the newly introduced conditional for nfs4 support as well.

10 months agoci: re-enable lvm on Gentoo container
Laszlo Gombos [Thu, 18 May 2023 16:43:38 +0000 (16:43 +0000)] 
ci: re-enable lvm on Gentoo container

Gentoo changed it's policy and now lvm needs to be enabled explicitly.

See https://www.gentoo.org/support/news-items/2022-11-19-lvm2-default-USE-flags.html

No need to install thin-provisioning-tools explicitelly, it is
pulled in as a dependency of the lvm2 package.

10 months agoci: disable initramfs generation inside Gentoo container
Laszlo Gombos [Mon, 8 May 2023 14:36:58 +0000 (14:36 +0000)] 
ci: disable initramfs generation inside Gentoo container

Disabling initramfs generation saves installing 4 additional packages.

10 months agoci: add extra packages for tests to Gentoo container
Laszlo Gombos [Mon, 8 May 2023 14:31:38 +0000 (14:31 +0000)] 
ci: add extra packages for tests to Gentoo container

Add cryptsetup, multipath-tools and open-iscsi
to the Gentoo container for tests 10, 14, 30, 35.

10 months agoci: switching the musl test to 18 (uefi)
Henrik Gombos [Sat, 17 Jun 2023 19:04:25 +0000 (19:04 +0000)] 
ci: switching the musl test to 18 (uefi)

11 months agotest(ISCSI): make test-30 use the test dracut modules
Henrik Gombos [Thu, 8 Jun 2023 13:38:06 +0000 (13:38 +0000)] 
test(ISCSI): make test-30 use the test dracut modules

Introduce test_dracut that is meant to be shared between tests
in test-functions.

11 months agoci: add dependencies to Debian container
Henrik Gombos [Wed, 14 Jun 2023 19:17:20 +0000 (19:17 +0000)] 
ci: add dependencies to Debian container

- add systemd-boot-efi for test 18
- tgt is needed for test 30 and 35
- nbd-server is needed for test 40
- gawk dependency has been introduced by f32e95bcadbc5158843530407adc1e7b700561b1
- install dracut instead of initramfs-tools to match actual usage
- remove workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962300
as it is now fixed on Debian 12.

11 months agotest(UEFI): add test case for UEFI boot
Laszlo Gombos [Wed, 22 Mar 2023 19:56:25 +0000 (19:56 +0000)] 
test(UEFI): add test case for UEFI boot

Include OVMF in containers if it is not already present.

11 months agodocs: remove rd.lvm.snapsize and rd.lvm.snapshot
Henrik Gombos [Sun, 11 Jun 2023 22:34:35 +0000 (22:34 +0000)] 
docs: remove rd.lvm.snapsize and rd.lvm.snapshot

11 months agofix(Makefile): execute command -v instead of which
Henrik Gombos [Sun, 11 Jun 2023 23:04:27 +0000 (23:04 +0000)] 
fix(Makefile): execute command -v instead of which

11 months agofix(network-legacy): typo
lilinjie [Tue, 18 Apr 2023 03:22:26 +0000 (11:22 +0800)] 
fix(network-legacy): typo

Signed-off-by: lilinjie <lilinjie@uniontech.com>
11 months agofix(network,dbus): improve dependency checking
Laszlo Gombos [Thu, 2 Feb 2023 21:22:26 +0000 (21:22 +0000)] 
fix(network,dbus): improve dependency checking

Decouple implementation details of the backend
dependencies from the meta module.

Call check_module for each submodule instead
of reimplementing sub-package dependencies
inside the meta module itself.

Add missing NetworkManager binary to the
network-manager dracut module check.

11 months agofix(systemd-pcrphase): only include systemd-pcrphase-initrd.service
Antonio Alvarez Feijoo [Thu, 9 Feb 2023 12:55:47 +0000 (13:55 +0100)] 
fix(systemd-pcrphase): only include systemd-pcrphase-initrd.service

The only systemd-pcrphase related unit configured to run in the initrd is
systemd-pcrphase-initrd.service.
Both systemd-pcrphase.service and systemd-pcrphase-sysinit.service contain
`ConditionPathExists=!/etc/initrd-release`.

11 months agofix(systemd-tmpfiles): do not include systemd-tmpfiles-clean.timer
Antonio Alvarez Feijoo [Thu, 9 Feb 2023 12:55:31 +0000 (13:55 +0100)] 
fix(systemd-tmpfiles): do not include systemd-tmpfiles-clean.timer

The systemd-tmpfiles-clean.timer unit is configured not to run in the initrd
since https://github.com/systemd/systemd/commit/fe7f113c

11 months agofix(systemd-journald): do not include systemd-journal-flush.service
Antonio Alvarez Feijoo [Thu, 9 Feb 2023 12:55:11 +0000 (13:55 +0100)] 
fix(systemd-journald): do not include systemd-journal-flush.service

The systemd-journal-flush.service unit is configured not to run in the initrd
since https://github.com/systemd/systemd/commit/fe7f113c

11 months agofix(systemd): do not include systemd-random-seed.service
Antonio Alvarez Feijoo [Thu, 9 Feb 2023 12:54:46 +0000 (13:54 +0100)] 
fix(systemd): do not include systemd-random-seed.service

The systemd-random-seed.service unit is configured not to run in the initrd
since https://github.com/systemd/systemd/commit/fe7f113c

Also, the systemd-random-seed-load.service does not exist since
https://github.com/systemd/systemd/commit/c35b956d

11 months agofix(dracut.sh): correct path for UEFI stub on split-usr systems
Mike Gilbert [Fri, 26 May 2023 23:04:27 +0000 (19:04 -0400)] 
fix(dracut.sh): correct path for UEFI stub on split-usr systems

systemd always installs the UEFI stub in ${prefix}/lib/systemd/boot/efi.

On split-usr systems, systemdutildir is ${rootprefix}/lib/systemd, which
makes dracut look in the wrong place.

Instead, grab 'prefix' from systemd.pc and store it in 'systemd_prefix'.

Bug: https://bugs.gentoo.org/765208
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
11 months agofeat(dracut-init.sh): do not print by default if an udev rule is skipped
Henrik Gombos [Sun, 4 Jun 2023 17:34:45 +0000 (17:34 +0000)] 
feat(dracut-init.sh): do not print by default if an udev rule is skipped

11 months agotest: move more makeroot dependencies into test-makeroot dracut module
Henrik Gombos [Sun, 21 May 2023 13:56:46 +0000 (13:56 +0000)] 
test: move more makeroot dependencies into test-makeroot dracut module

11 months agofix(kernel-modules): add interconnect drivers
Andrew Halaney [Mon, 5 Jun 2023 17:16:24 +0000 (12:16 -0500)] 
fix(kernel-modules): add interconnect drivers

Many devicetree based systems require interconnect drivers to function
properly. Include those in the initramfs.

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
11 months agotest(LVM-THIN): avoid thin pool size warning
Henrik Gombos [Sun, 14 May 2023 12:22:22 +0000 (12:22 +0000)] 
test(LVM-THIN): avoid thin pool size warning

Avoid the following warning by reducing thin pool size

> "Sum of all thin volume sizes exceeds the size of thin pool
> and the size of whole volume group.

11 months agoci: cleanup containers
Henrik Gombos [Fri, 2 Jun 2023 14:05:12 +0000 (14:05 +0000)] 
ci: cleanup containers

Remove /etc/profile.d/dracut-test.sh from test containers
No use to override default command
Remove references to docker. These files work just fine
with podman as well.

11 months agotest: add empty default test_cleanup implementation
Henrik Gombos [Sun, 4 Jun 2023 14:40:06 +0000 (14:40 +0000)] 
test: add empty default test_cleanup implementation

11 months agotest: move more common test code to test-functions
Henrik Gombos [Tue, 23 May 2023 22:03:08 +0000 (22:03 +0000)] 
test: move more common test code to test-functions

Move KVERSION and USE_NETWORK definition to test-functions.
Add option for qemu_add_drive_args to initialize drive with size.

11 months agofix(resolve-deps): check the existing file—not the source
Frederick Grose [Sun, 21 May 2023 22:05:12 +0000 (18:05 -0400)] 
fix(resolve-deps): check the existing file—not the source

Check for dependencies on the file actually installed, otherwise,
such as when the shebang is a link not equal to the initramfs link,
the wrong file may be tested.

11 months agofix(dracut-lib.sh): remove successful finished initqueue scripts
Martin Wilck [Wed, 3 May 2023 20:21:38 +0000 (22:21 +0200)] 
fix(dracut-lib.sh): remove successful finished initqueue scripts

If some "finished" initscripts keep failing, dracut will start
printing warnings after a while. But it will warn about all scripts
in the finished initqueue, not only those that have failed. That
makes it difficult to identify the script that has actually
caused the failure.

To avoid this, delete finished initqueue scripts when they succeed.
Also, instead of returning as soon as one of the scripts fails, try
all scripts, deleting those that succeed, and return failure if at
least one script failed.

If a previously deleted script is recreated by some other part of
the code, it will be re-run the next time the check_finished() function
is called, and will be re-deleted if it still succeeds.

The only case where I see that this might cause issues is if some
condition needs to be tested over and over again, because it succeeds
and then fails later (for example, a device showing up and then being
removed again). But I think that this is not the intended logic.
In general, when a device shows up or another "finished" condition
is met, we assume that this condition will hold at least until the
initramfs switches root and exits. If all conditions are met, the
current code will also exit the initqueue without retrying any of
the conditions again.

11 months agofix(udev-rules): remove firmware.rules
Henrik Gombos [Sun, 21 May 2023 14:05:07 +0000 (14:05 +0000)] 
fix(udev-rules): remove firmware.rules

11 months agodocs: change ext3 to ext4
Henrik Gombos [Fri, 19 May 2023 00:10:33 +0000 (00:10 +0000)] 
docs: change ext3 to ext4

Promote ext4 instead of ext3 in the manual.

11 months agofix(dracut.sh): silence the output of hardlinking files by default
Henrik Gombos [Sun, 4 Jun 2023 14:26:37 +0000 (14:26 +0000)] 
fix(dracut.sh): silence the output of hardlinking files by default

11 months agofix(github): exempt issues in a milestone
Henrik Gombos [Sun, 21 May 2023 14:17:19 +0000 (14:17 +0000)] 
fix(github): exempt issues in a milestone

11 months agofix(virtiofs): add virtio_pci kernel module to virtiofs
Sergio E. Nemirowski [Sun, 21 May 2023 22:36:05 +0000 (02:36 +0400)] 
fix(virtiofs): add virtio_pci kernel module to virtiofs

fix #2357

Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
11 months agoci: install multipath-tools into openSuse container
Henrik Gombos [Mon, 22 May 2023 00:34:02 +0000 (00:34 +0000)] 
ci: install multipath-tools into openSuse container

11 months agotest: remove references of dhcpd3 from tests
Henrik Gombos [Fri, 19 May 2023 00:20:38 +0000 (00:20 +0000)] 
test: remove references of dhcpd3 from tests

dhcp3-server is no longer supported by Debian
and it is replaced by isc-dhcp-server.

12 months agotest: move test condition to test_check
Henrik Gombos [Wed, 17 May 2023 00:46:19 +0000 (00:46 +0000)] 
test: move test condition to test_check

This enables skipping the test instead of failing it.

12 months agotest: upgrade to ext4
Henrik Gombos [Fri, 12 May 2023 13:47:29 +0000 (13:47 +0000)] 
test: upgrade to ext4

Most users use ext4 instead of ext3 or ext2. Upgrade tests to ext4.

12 months agofix(dracut-systemd): rootfs-generator cannot write outside of generator dir
Antonio Alvarez Feijoo [Wed, 8 Mar 2023 07:25:38 +0000 (08:25 +0100)] 
fix(dracut-systemd): rootfs-generator cannot write outside of generator dir

Although it was already documented in systemd.generator(7) that generators must
not write to locations other than those passed as arguments, since
https://github.com/systemd/systemd/commit/ca6ce62d systemd executes generators
in a mount namespace "sandbox", so now the hooks created by the rootfs-generator
are lost.

These hooks are created using the root= cmdline argument, so this patch moves
the creation of these hooks to a cmdline hook.

Fixes issue #2211
Fixes issue #2225

12 months agofix(dracut-systemd): check and create generator dir outside of inner function
Antonio Alvarez Feijoo [Wed, 1 Mar 2023 11:07:29 +0000 (12:07 +0100)] 
fix(dracut-systemd): check and create generator dir outside of inner function

12 months agofix(dracut-systemd): do not hardcode the systemd generator directory
Antonio Alvarez Feijoo [Wed, 1 Mar 2023 10:21:16 +0000 (11:21 +0100)] 
fix(dracut-systemd): do not hardcode the systemd generator directory

The normal directory is the first argument passed to the systemd generator,
so use it instead of hardcoding /run/systemd/generator.

12 months agoci: add more packages to allow testing more dracut containers
Laszlo Gombos [Fri, 3 Mar 2023 05:02:38 +0000 (05:02 +0000)] 
ci: add more packages to allow testing more dracut containers

12 months agoci: simplify and sort
Laszlo Gombos [Fri, 3 Mar 2023 04:50:04 +0000 (04:50 +0000)] 
ci: simplify and sort

12 months agofix(dracut.sh): handle imagebase for uefi
keentux [Wed, 22 Mar 2023 10:40:39 +0000 (10:40 +0000)] 
fix(dracut.sh): handle imagebase for uefi

* UEFI creation didn't handle the ImageBase data for the PE file
  generation. Create an UKI thanks a stub file with a non zero BaseImage
  logs some warning ans generate a bad file offset management. The efi
  becomes unloadable.
* This commit parse the PE file header, get the data and apply the
  ImageBase on the objcopy command.

Fixes dracutdevs#2284

Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
12 months agofix(dracut-functions): avoid calling grep with PCRE (-P)
Daniel McIlvaney [Fri, 28 Apr 2023 21:02:05 +0000 (14:02 -0700)] 
fix(dracut-functions): avoid calling grep with PCRE (-P)

Invoking grep in Perl mode requires JIT'ing the Perl regex.
This can run into issues with SELinix policy which will generally try to
limit use of execmem in general purpose scripts. This occurs since the
JIT'd code will live in executable  memory.

The PCRE only '\K' command in the Perl REGEX can be replaced by a call
to awk instead.

12 months agofix(dracut-initramfs-restore.sh): handle /etc/machine-id empty or uninitialized
Antonio Alvarez Feijoo [Mon, 20 Mar 2023 13:10:35 +0000 (14:10 +0100)] 
fix(dracut-initramfs-restore.sh): handle /etc/machine-id empty or uninitialized

Handle the case where the user tries to debug the shutdown after explicitly
resetting the /etc/machine-id file.

12 months agofix(lsinitrd.sh): handle /etc/machine-id empty or uninitialized
Antonio Alvarez Feijoo [Mon, 20 Mar 2023 13:09:43 +0000 (14:09 +0100)] 
fix(lsinitrd.sh): handle /etc/machine-id empty or uninitialized

Handle the case where the user tries to query the initrd content after
explicitly resetting the /etc/machine-id file.

12 months agofix(dracut.sh): handle /etc/machine-id empty or uninitialized
Antonio Alvarez Feijoo [Tue, 7 Mar 2023 15:17:16 +0000 (16:17 +0100)] 
fix(dracut.sh): handle /etc/machine-id empty or uninitialized

Handle the case where the user tries to generate the initrd after explicitly
resetting the /etc/machine-id file.

Fixes issue #2267

12 months agofeat(systemd-creds): introducing the systemd-creds module
Antonio Alvarez Feijoo [Mon, 27 Mar 2023 13:12:05 +0000 (15:12 +0200)] 
feat(systemd-creds): introducing the systemd-creds module

Introducing the systemd-creds module.

12 months agofix(systemd-networkd): add missing conf files and services
Antonio Alvarez Feijoo [Thu, 23 Mar 2023 09:48:39 +0000 (10:48 +0100)] 
fix(systemd-networkd): add missing conf files and services

13 months agofix(dracut-functions.sh): convert mmcblk to the real kernel module name
Tao Liu [Wed, 12 Apr 2023 15:02:25 +0000 (23:02 +0800)] 
fix(dracut-functions.sh): convert mmcblk to the real kernel module name

In some x86_64 platforms such as Intel Elkhartlake, an issue of missing
necessary modules due to udevadm drivers field unmatch the real kernel module
name is found:

  $ udevadm info -a /dev/block/179:1

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/mmc_host/mmc0/mmc0:0001':
    KERNELS=="mmc0:0001"
    SUBSYSTEMS=="mmc"
    DRIVERS=="mmcblk"
    ....

The DRIVERS field, aka mmcblk will be given to instmods to install the
corresponding mmc_block.ko kernel module. However mmc_block.ko cannot be
selected by string mmcblk, as a result, mmc_block.ko cannot be installed
in hostonly-mode strict, which will fail to bootup the machine such as in
kdump cases:

  $ /usr/lib/dracut/dracut-install -D /var/tmp --kerneldir /lib/modules/$(uname -r)/ -m mmcblk
  dracut-install: Failed to find module 'mmcblk'

In this patch, we will convert the string mmcblk to mmc_block, so the
kernel module can be successfully loaded.

Signed-off-by: Tao Liu <ltao@redhat.com>
13 months agofix(multipath): remove dependency on multipathd.socket
Tianhao Chai [Tue, 11 Apr 2023 00:36:12 +0000 (20:36 -0400)] 
fix(multipath): remove dependency on multipathd.socket

This reverts commit e39ff407eca1d783ab44093c44db5ee401ff5b1d, removes
an incorrect `Also=` directive from multipathd.service.

`Also=multipathd.socket` is not the correct behavior for a
socket-activated service. This directive has been removed upstream
and dracut should do the same.

This fixes #2289, #2175 where in the cleanup hook running multipath
binary triggers activation of multipathd.service after it is stopped
as dracut prepares to switch root in initrd-cleanup.service.