]> git.ipfire.org Git - thirdparty/dracut-ng.git/log
thirdparty/dracut-ng.git
17 months agotest(FULL SYSTEMD): no need to include dbus to the target rootfs 59/head
Laszlo Gombos [Sat, 4 Nov 2023 06:25:18 +0000 (02:25 -0400)] 
test(FULL SYSTEMD): no need to include dbus to the target rootfs

systemd does not depend on dbus.

17 months agofix(check_live_ram): increase /run tmpfs size, if needed
Frederick Grose [Wed, 8 Nov 2023 18:08:19 +0000 (13:08 -0500)] 
fix(check_live_ram): increase /run tmpfs size, if needed

Check the size and available space in /run to enlarge it,
  if needed.
Introduce the check_meminfo() function to dracut-lib.sh
  to replace a less versatile sed call.
Also, use local variables,
  use parameter expansion to assign a default value,
  use test exit logic directly, where possible,
  tweak comments,
  and move the check_live_ram() function to img-lib.sh.

17 months agofeat(dracut.sh): protect `push_host_devs` function
Antonio Alvarez Feijoo [Tue, 19 Dec 2023 14:26:17 +0000 (15:26 +0100)] 
feat(dracut.sh): protect `push_host_devs` function

Check at least that the arguments are not an empty string.

17 months agofix(dracut.sh): do not add device if `find_block_device` returns an error
Antonio Alvarez Feijoo [Tue, 19 Dec 2023 14:09:00 +0000 (15:09 +0100)] 
fix(dracut.sh): do not add device if `find_block_device` returns an error

If `find_block_device` returns an error, the device must not be added to the
list of host devices. E.g., a system with /etc mounted as overlay is pushing
the empty string '' as host device.

```
//usr/bin/dracut@1658(): readlink -f /etc
/usr/bin/dracut@1658(): mp=/etc
/usr/bin/dracut@1659(): mountpoint /etc
//usr/bin/dracut@1660(): find_block_device /etc
//usr/lib/dracut/dracut-functions.sh@366(find_block_device): local _dev _majmin _find_mpt
//usr/lib/dracut/dracut-functions.sh@367(find_block_device): _find_mpt=/etc
//usr/lib/dracut/dracut-functions.sh@369(find_block_device): [[ '' != yes ]]
//usr/lib/dracut/dracut-functions.sh@370(find_block_device): [[ -d /etc/. ]]
//usr/lib/dracut/dracut-functions.sh@371(find_block_device): findmnt -e -v -n -o MAJ:MIN,SOURCE --target /etc
//usr/lib/dracut/dracut-functions.sh@372(find_block_device): read -r _majmin _dev
//usr/lib/dracut/dracut-functions.sh@373(find_block_device): [[ -b overlay ]]
//usr/lib/dracut/dracut-functions.sh@384(find_block_device): [[ overlay == *:* ]]
//usr/lib/dracut/dracut-functions.sh@372(find_block_device): read -r _majmin _dev
//usr/lib/dracut/dracut-functions.sh@372(find_block_device): '[' -n '' ']'
//usr/lib/dracut/dracut-functions.sh@389(find_block_device): return 1
//usr/lib/dracut/dracut-functions.sh@393(find_block_device): [[ ! -f /etc/fstab ]]
//usr/lib/dracut/dracut-functions.sh@395(find_block_device): findmnt -e --fstab -v -n -o MAJ:MIN,SOURCE --target /etc
//usr/lib/dracut/dracut-functions.sh@396(find_block_device): read -r _majmin _dev
//usr/lib/dracut/dracut-functions.sh@397(find_block_device): [[ -n '' ]]
//usr/lib/dracut/dracut-functions.sh@398(find_block_device): _dev=overlay
//usr/lib/dracut/dracut-functions.sh@399(find_block_device): unset _majmin
//usr/lib/dracut/dracut-functions.sh@401(find_block_device): [[ -b overlay ]]
//usr/lib/dracut/dracut-functions.sh@410(find_block_device): [[ overlay == *:* ]]
//usr/lib/dracut/dracut-functions.sh@396(find_block_device): read -r _majmin _dev
//usr/lib/dracut/dracut-functions.sh@396(find_block_device): '[' -n '' ']'
//usr/lib/dracut/dracut-functions.sh@415(find_block_device): return 1
//usr/lib/dracut/dracut-functions.sh@418(find_block_device): return 1
/usr/bin/dracut@1660(): _dev=
//usr/bin/dracut@1661(): readlink -f /dev/block/
/usr/bin/dracut@1661(): _bdev=/dev/block
/usr/bin/dracut@1662(): [[ -b /dev/block ]]
/usr/bin/dracut@1663(): [[ /etc == \/ ]]
/usr/bin/dracut@1664(): push_host_devs ''
```

Fixes #2592

17 months agofix(dracut-install): file created without restricting permissions
Laszlo Gombos [Thu, 23 Feb 2023 05:58:06 +0000 (05:58 +0000)] 
fix(dracut-install): file created without restricting permissions

Resolve: https://github.com/dracutdevs/dracut/security/code-scanning/10

17 months agofix(rootfs-block): remove support for [no]readonlyroot and fastboot
Laszlo Gombos [Sun, 5 Mar 2023 02:05:14 +0000 (02:05 +0000)] 
fix(rootfs-block): remove support for [no]readonlyroot and fastboot

This PR removes some obsolete and undocumented functionality from a
core dracut module.

"readonlyroot" and "noreadonlyroot" command line option are no longer
supported. Use "ro" or "rw" instead.

17 months agofix: do not use modprobe --all
Laszlo Gombos [Sun, 10 Dec 2023 14:13:46 +0000 (09:13 -0500)] 
fix: do not use modprobe --all

busybox modprobe does not support the --all flag

17 months agofix(i18n): silence spurious setfont stderr warning
Laszlo Gombos [Sat, 10 Feb 2024 03:35:04 +0000 (22:35 -0500)] 
fix(i18n): silence spurious setfont stderr warning

Co-authored-by: Zach Dykstra <dykstra.zachary@gmail.com>
17 months agofix(udev-rules): remove legacy persistent network device name rule
Laszlo Gombos [Tue, 28 Feb 2023 17:31:19 +0000 (17:31 +0000)] 
fix(udev-rules): remove legacy persistent network device name rule

17 months agofeat(network): include 98-default-mac-none.link if it exists
Dusty Mabe [Wed, 22 Feb 2023 03:21:35 +0000 (22:21 -0500)] 
feat(network): include 98-default-mac-none.link if it exists

In Fedora Linux there was a new 98-default-mac-none.link file added
to set the MACAddressPolicy=none for bond/bridge/team devices. We'd
like for this policy to apply in the initramfs as well. See

- https://fedoraproject.org/wiki/Changes/MAC_Address_Policy_none
- https://src.fedoraproject.org/rpms/systemd/pull-request/100#

17 months agofix(dmsquash-live): handle relative pathspec
Laszlo Gombos [Mon, 6 Mar 2023 20:26:08 +0000 (20:26 +0000)] 
fix(dmsquash-live): handle relative pathspec

This change is required to make the earlier canonical
example work that is mentioned in the documentation:

At the same time, improve the documentation with a more
specific example.

17 months agotest(RAID): make test 10 use the test dracut modules
Laszlo Gombos [Sat, 25 Feb 2023 01:46:34 +0000 (01:46 +0000)] 
test(RAID): make test 10 use the test dracut modules

17 months agofix(overlayfs): to allow overlay on top of network device (nfs)
Laszlo Gombos [Thu, 30 Mar 2023 14:08:47 +0000 (14:08 +0000)] 
fix(overlayfs): to allow overlay on top of network device (nfs)

Execute mount-overlayfs later in the boot process as a pre-pivot
hook. The existing mount hook is skipped for network boot.

Without this change
`dracut  -a "overlayfs nfs"`
would not work as expected.

Improved the existing test case to test for this scenario.

17 months agofix(overlayfs): allow hostonly
Laszlo Gombos [Tue, 7 Mar 2023 03:26:15 +0000 (03:26 +0000)] 
fix(overlayfs): allow hostonly

Check for overlay kernel module support.

17 months agochore(github): update CODEOWNERS file
Laszlo Gombos [Sun, 31 Mar 2024 17:35:43 +0000 (13:35 -0400)] 
chore(github): update CODEOWNERS file

All CODEOWNERS are automatically added as reviewers.
This should help new contributors to discover from whom to get reviews.

17 months agofix(man): rd.break parameter can be specified multiple times
Laszlo Gombos [Sun, 31 Mar 2024 11:12:38 +0000 (07:12 -0400)] 
fix(man): rd.break parameter can be specified multiple times

17 months agofix(dracut): correct regression with multiple `rd.break=` options
Antonio Alvarez Feijoo [Mon, 12 Feb 2024 12:56:19 +0000 (13:56 +0100)] 
fix(dracut): correct regression with multiple `rd.break=` options

Since the introduction of the `dracut-util` binary to parse kernel command line
arguments, if the user inputs multiple `rd.break=` options, dracut only stops
the boot process at the last one.

```
[    0.985362] localhost dracut-cmdline[245]: /bin/dracut-cmdline@18(): info 'Using kernel command line parameters:' ' ... rd.debug rd.break=cmdline rd.break=pre-pivot'
...
[    1.044979] localhost dracut-cmdline[245]: /bin/dracut-cmdline@48(): getarg rd.break=cmdline -d rdbreak=cmdline
[    1.044979] localhost dracut-cmdline[245]: /lib/dracut-lib.sh@155(getarg): debug_off
[    1.044979] localhost dracut-cmdline[245]: /lib/dracut-lib.sh@23(debug_off): set +x
[    1.044979] localhost dracut-cmdline[245]: /lib/dracut-lib.sh@218(getarg): return 1
```

For options that can be specified multiple times, `getargs` should be used
instead.

```
master> export CMDLINE="rd.break=cmdline rd.break=pre-udev rd.break=pre-pivot"
master> ./dracut-getarg rd.break=cmdline
master> echo $?
1
master> ./dracut-getarg rd.break=pre-udev
master> echo $?
1
master> ./dracut-getarg rd.break=pre-pivot
master> echo $?
0
master> ./dracut-getargs rd.break=cmdline
cmdline
master> echo $?
0
master> ./dracut-getargs rd.break=pre-udev
pre-udev
master> echo $?
0
master> ./dracut-getargs rd.break=pre-pivot
pre-pivot
master> echo $?
0
```

Fixes 501d82f79675a6bf9b37e8250152515863a80236

17 months agofix(dracut-util): do not call `strcmp` if the `value` argument is NULL
Antonio Alvarez Feijoo [Mon, 12 Feb 2024 12:55:20 +0000 (13:55 +0100)] 
fix(dracut-util): do not call `strcmp` if the `value` argument is NULL

The behavior of `strcmp` is undefined if any of its arguments is NULL, which
can lead to a segfault depending on the implementation. So, this check is
required to be able to use `getargs` with options where the value is optional,
e.g., with `rd.break`.

17 months agotest: remove dead code regarding building rpm
Laszlo Gombos [Sat, 18 Feb 2023 07:11:26 +0000 (07:11 +0000)] 
test: remove dead code regarding building rpm

17 months agoci: run legacy network tests on openSUSE instead of Fedora
Laszlo Gombos [Sun, 31 Mar 2024 17:49:43 +0000 (13:49 -0400)] 
ci: run legacy network tests on openSUSE instead of Fedora

openSUSE has been actively maintaining network-legacy dracut module.

Fedora is no longer packaging network-legacy dracut module,
so it is not a good container to test the network-legacy dracut module.

17 months agofix(net-lib): add a new dracut module called net-lib
Laszlo Gombos [Tue, 28 Feb 2023 19:59:13 +0000 (19:59 +0000)] 
fix(net-lib): add a new dracut module called net-lib

17 months agoci: drop maintainer entry from container descriptor files
Laszlo Gombos [Sun, 31 Mar 2024 16:18:06 +0000 (12:18 -0400)] 
ci: drop maintainer entry from container descriptor files

These Dockerfiles are only used in the context of this repo,
no need to point back to the github url.

17 months agofix(45ifcfg): mark as deprecated and strictly opt-in
Jonathan Lebon [Fri, 29 Sep 2023 13:39:15 +0000 (09:39 -0400)] 
fix(45ifcfg): mark as deprecated and strictly opt-in

The `45ifcfg` module should be considered deprecated now since
ifcfg files themselves are deprecated. They've been replaced by e.g.
NetworkManager keyfiles or systemd-networkd files.

Currently, the `45ifcfg` module checks if the `/etc/sysconfig/network-
scripts` directory exists to know if to automatically get pulled in.
However, on systems with NetworkManager, this directory always exists
even if the functionality to read ifcfg files is disabled by default (NM
kindly ships a README in there to ease migrating to keyfiles).

Since almost everyone should've already migrated to a more modern
alternative, let's make this module purely opt-in now.

17 months agotest: skip test 50,60 if ifcfg dracut module can not be installed
Henrik Gombos [Sun, 29 Oct 2023 11:42:20 +0000 (07:42 -0400)] 
test: skip test 50,60 if ifcfg dracut module can not be installed

Test 50 and 60 have a dependency on the ifcfg dracut module.
If ifcfg dracut module is not available, than the preconditions
for these tests are not met.

Since ifcfg dracut module is not available in many Linux enviroments
(such as Arch or Debian), it make sense to explicitelly skip these
tests instead of failing them as they are simply not applicable
to many Linux distributions in their current form.

Instead of disabling the tests, they should be reimplement
so that they do not require ifcfg dracut module in the future.

17 months agochore(deps): bump softprops/action-gh-release from 0.1.15 to 2.0.4
dependabot[bot] [Sat, 30 Mar 2024 00:49:32 +0000 (00:49 +0000)] 
chore(deps): bump softprops/action-gh-release from 0.1.15 to 2.0.4

Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 0.1.15 to 2.0.4.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v0.1.15...v2.0.4)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
17 months agofix(90kernel-modules): add surface_aggregator_registry for Surface Laptop 4
Benjamin Drung [Tue, 14 Nov 2023 16:53:31 +0000 (17:53 +0100)] 
fix(90kernel-modules): add surface_aggregator_registry for Surface Laptop 4

The help text for the kernel module `surface_aggregator_registry` says:
"Device-registry for Surface System Aggregator Module (SSAM) devices.
Provides a module and driver which act as a device-registry for SSAM
client devices that cannot be detected automatically, e.g. via ACPI.
Such devices are instead provided and managed via this registry. Devices
provided via this registry are:
 - Platform profile (performance-/cooling-mode) device (5th- and later
   generations).
 - Battery/AC devices (7th-generation).
 - HID input devices (7th-generation)."

This kernel module is needed on the Surface Laptop 4 for the keyboard.

Bug-Ubuntu: https://launchpad.net/bugs/2007050
Bug-linux-surface: https://github.com/linux-surface/linux-surface/issues/839
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
17 months agofix(install): handle new -Walloc-size for GCC 14
Sam James [Sun, 12 Nov 2023 03:56:41 +0000 (03:56 +0000)] 
fix(install): handle new -Walloc-size for GCC 14

GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
src/install/hashmap.c: In function ‘hashmap_new’:
src/install/hashmap.c:83:11: warning: allocation of insufficient size ‘1’ for type ‘Hashmap’ with size ‘40’ [-Walloc-size]
   83 |         h = malloc0(size);
      |           ^
```

malloc0 is a macro deifned by Dracut (and systemd, see below):
```
malloc0(n) (calloc((n), 1))
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(...)`. GCC then sees we're not
doing anything wrong.

This was fixed upstream in systemd in commit f80bb1f7eaf31476a44c2093d3ee02aba817a0b0 [0].

[0] https://github.com/systemd/systemd/commit/f80bb1f7eaf31476a44c2093d3ee02aba817a0b0

Signed-off-by: Sam James <sam@gentoo.org>
17 months agorefactor(nfs): remove leftover code
Antonio Alvarez Feijoo [Fri, 1 Dec 2023 10:58:45 +0000 (11:58 +0100)] 
refactor(nfs): remove leftover code

- Leftover `grep`s used when `chown` was perfomed after them.
- `$initdir/var/lib/rpcbind` already created with `mkdir -m 0770`, it is not
necessary to `chmod 770` again.

Follow-up to 5ebf48d2baa7d7cbad7cfc663319f8ca80f76398

17 months agoci: improve the readability of job names
Henrik Gombos [Mon, 20 Feb 2023 17:36:30 +0000 (17:36 +0000)] 
ci: improve the readability of job names

Changes the job name from
"Integration Test / test (arch:latest, 10)" to
"Test / 10 on arch".

This change makes the job names shorter and more readable.

Co-authored-by: Laszlo Gombos <laszlo.gombos@gmail.com>
17 months agoci: replace qemu-system-x86 by qemu-kvm in Debian Docker image
Benjamin Drung [Sat, 19 Aug 2023 12:39:17 +0000 (14:39 +0200)] 
ci: replace qemu-system-x86 by qemu-kvm in Debian Docker image

To make the list of required packages more architecture independent,
replace `qemu-system-x86` by `qemu-kvm` in the Debian Docker image.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
17 months agoci: drop debhelper and quilt from Debian Docker image
Benjamin Drung [Sat, 19 Aug 2023 12:38:22 +0000 (14:38 +0200)] 
ci: drop debhelper and quilt from Debian Docker image

The debhelper and quilt packages are only needed for packaging dracut.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
17 months agoci: drop dash from Debian Docker image
Benjamin Drung [Sat, 19 Aug 2023 12:32:12 +0000 (14:32 +0200)] 
ci: drop dash from Debian Docker image

The dash package is a required that must be present on all Debian
systems.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
17 months agochore(deps): bump docker/login-action from 2 to 3
dependabot[bot] [Tue, 12 Sep 2023 18:54:13 +0000 (18:54 +0000)] 
chore(deps): bump docker/login-action from 2 to 3

Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
17 months agofix(base): correct handling of quiet in loginit
Bernhard M. Wiedemann [Mon, 20 Mar 2023 07:42:26 +0000 (08:42 +0100)] 
fix(base): correct handling of quiet in loginit

dracut-lib.sh sets DRACUT_QUIET=no
and passes this to loginit

17 months agorevert(ci): install multipath-tools into openSUSE container
Antonio Alvarez Feijoo [Tue, 22 Aug 2023 12:59:02 +0000 (14:59 +0200)] 
revert(ci): install multipath-tools into openSUSE container

The way multipath works in SUSE distros differs from upstream,
causing some tests to fail.

This reverts commit c08ae406bc7c7d815b0911d9429f400719afc2ae.

Fixes https://github.com/dracutdevs/dracut/commit/c08ae406

17 months agofix(plymouth): return 1 if binary requirements are not met
Antonio Alvarez Feijoo [Tue, 18 Jul 2023 08:34:59 +0000 (10:34 +0200)] 
fix(plymouth): return 1 if binary requirements are not met

17 months agofix(caps): return 1 if binary requirements are not met
Antonio Alvarez Feijoo [Tue, 18 Jul 2023 08:34:43 +0000 (10:34 +0200)] 
fix(caps): return 1 if binary requirements are not met

17 months agorefactor(systemd): remove duplicate entries in inst_multiple
Antonio Alvarez Feijoo [Thu, 4 Jan 2024 15:39:31 +0000 (16:39 +0100)] 
refactor(systemd): remove duplicate entries in inst_multiple

Fixes 28eae10b7007c6a2b64876244e976eb4788e95b1

17 months agochore(deps): bump docker/build-push-action from 4 to 5
dependabot[bot] [Tue, 12 Sep 2023 18:54:09 +0000 (18:54 +0000)] 
chore(deps): bump docker/build-push-action from 4 to 5

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
17 months agofix(test): running tests no longer requires to be root
Laszlo Gombos [Tue, 21 Feb 2023 00:20:29 +0000 (00:20 +0000)] 
fix(test): running tests no longer requires to be root

Remove sudo from test containers.

17 months agotest(UEFI): make test determinsitic
Laszlo Gombos [Sat, 25 Nov 2023 03:42:20 +0000 (22:42 -0500)] 
test(UEFI): make test determinsitic

identify the boot drive by id

17 months agofix(TEST-62-SKIPCPIO): test always skipped due to buggy `test_check`
Antonio Alvarez Feijoo [Tue, 22 Aug 2023 07:50:06 +0000 (09:50 +0200)] 
fix(TEST-62-SKIPCPIO): test always skipped due to buggy `test_check`

Fixes https://github.com/dracutdevs/dracut/commit/4235c03

17 months agofix(i18n): handle symlinked keymap
Thomas Blume [Mon, 22 Jan 2024 09:28:00 +0000 (10:28 +0100)] 
fix(i18n): handle symlinked keymap

handle keymaps that are symlinks to others, for example:

KEYMAP=de-nodeadkeys in vconsole.conf is:

lrwxrwxrwx 1 root root 20 17. Mai 2023  /usr/share/kbd/keymaps/xkb/de-nodeadkeys.map.gz -> at-nodeadkeys.map.gz

17 months agofix(systemd-255): handle systemd-pcr{phase -> extend} rename
Brian Harring [Tue, 12 Dec 2023 01:10:20 +0000 (17:10 -0800)] 
fix(systemd-255): handle systemd-pcr{phase -> extend} rename

The binary systemd-pcrphase was renamed to systemd-pcrextend
in systemd 255, but the backing units were all left named
systemd-pcrphase.

Fixes: #2583
Signed-off-by: Brian Harring <ferringb@gmail.com>
17 months agofix(90multipath): drop unneeded dependencies from configure service
Benjamin Marzinski [Wed, 17 Jan 2024 01:37:41 +0000 (20:37 -0500)] 
fix(90multipath): drop unneeded dependencies from configure service

multipathd-configure.service previously had the same "After"
dependencies as the multipathd.service, with the idea of running
immediately before it. Multipathd now supports being started much
earlier, but the dependencies in multipathd-configure.service stop it
from being able to.

Since all multipathd-configure.service does is write out a configuration
file, it doesn't need any of its "After" udev dependencies. Remove them,
and clean up some other unneeded dependencies.

17 months agofix(dracut.sh): skip README for AMD microcode generation
Antonio Alvarez Feijoo [Mon, 30 Oct 2023 13:56:39 +0000 (14:56 +0100)] 
fix(dracut.sh): skip README for AMD microcode generation

This file was added in https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/amd-ucode/README?id=89ec6198f13d1007563ff87aae5de209e993be07
and it should be skipped.

Fixes #2541

17 months agoci: remove mkfs.ntfs from openSUSE test containers
Laszlo Gombos [Sat, 30 Mar 2024 19:11:04 +0000 (15:11 -0400)] 
ci: remove mkfs.ntfs from openSUSE test containers

openSUSE blacklisted ntfs3

17 months agochore(deps): bump docker/setup-buildx-action from 2 to 3
dependabot[bot] [Tue, 12 Sep 2023 18:54:16 +0000 (18:54 +0000)] 
chore(deps): bump docker/setup-buildx-action from 2 to 3

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
17 months agoci: disable test 20
Laszlo Gombos [Sat, 30 Mar 2024 13:15:22 +0000 (09:15 -0400)] 
ci: disable test 20

20 seems to be unstable and running a very long time.
Once the CI is green, we will revisit this test.

17 months agofix(resume): include in hostonly mode if resume= on cmdline
Andrew Ammerlaan [Sun, 20 Aug 2023 09:47:22 +0000 (11:47 +0200)] 
fix(resume): include in hostonly mode if resume= on cmdline

The grep introduced in commit e3a7112bef794e2f2dd741ec2c74fa9cb9117651
does not work as intended. The resume module is always excluded in hostonly
mode.

Made this a bit more explicit with if/else so it is more clear what is going
on. The in-line ||/&& makes the line really long and makes it more difficult
to understand what is going on.

Bug: https://github.com/dracutdevs/dracut/issues/924
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
17 months agofix(pcsc): add --disable-polkit to pcscd.service
Manuel Fombuena [Fri, 3 Nov 2023 11:53:38 +0000 (11:53 +0000)] 
fix(pcsc): add --disable-polkit to pcscd.service

Needs pcsc >= 2.0.0

polkit is not included in dracut and without this option, pcscd simply fails

17 months agofix(pcsc): add opensc load module file
Manuel Fombuena [Fri, 3 Nov 2023 09:04:53 +0000 (09:04 +0000)] 
fix(pcsc): add opensc load module file

On Fedora, and possibly others, this file loads opensc-pkcs11.so which you need to interact with the smart card to unlock a LUKS encrypted volume.

17 months agofeat(kernel-modules): Install SPMI modules on ARM/RISC-V
Benjamin Drung [Tue, 14 Nov 2023 16:14:17 +0000 (17:14 +0100)] 
feat(kernel-modules): Install SPMI modules on ARM/RISC-V

MediaTek's PCIe (pcie-mediatek-gen3) and the PHY driver depends on
`spmi-mtk-pmif` which is related to power domain. Power domain relate
driver `spmi-mtk-pmif` must be included in the initramfs for supporting
PCIe if user want to access peripherals during boot, for example, NVMe
disks.

So install all System Power Management Interface (SPMI) modules on
ARM/RISC-V.

Bug-openSUSE: https://bugzilla.suse.com/show_bug.cgi?id=1216767
Bug-Ubuntu: https://launchpad.net/bugs/2038512
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
17 months agofix(livenet): split `imgsize` calculation to avoid misleading error message
Antonio Alvarez Feijoo [Fri, 19 Jan 2024 17:03:03 +0000 (18:03 +0100)] 
fix(livenet): split `imgsize` calculation to avoid misleading error message

If `curl` fails to reach the URL of the live image, or if the header received
does not provide `Content-Length`, the error message displayed is misleading.

```
[    8.118432] dracut-initqueue[800]: /usr/sbin/livenetroot: line 21: / (1024 * 1024): syntax error: operand expected (error token is "/ (1024 * 1024)")
```

Therefore, split the calculation and provide proper error messages.

Reported-by: Knut Anderssen <kanderssen@suse.com>
17 months agofix(livenet): check also `content-length` from live image header
Antonio Alvarez Feijoo [Fri, 19 Jan 2024 17:02:07 +0000 (18:02 +0100)] 
fix(livenet): check also `content-length` from live image header

Some servers send `content-length` instead of `Content-Length`, so ignore the
case. E.g.:

```
> curl -sIL https://pkg.adfinis.com/opensuse/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20240118-Media.iso
HTTP/2 200
server: nginx
date: Fri, 19 Jan 2024 16:29:54 GMT
content-type: application/octet-stream
content-length: 4643094528
last-modified: Fri, 19 Jan 2024 03:34:00 GMT
etag: "65a9eda8-114c00000"
accept-ranges: bytes
```

17 months agofix(livenet): propagate error code
Antonio Alvarez Feijoo [Fri, 19 Jan 2024 17:01:16 +0000 (18:01 +0100)] 
fix(livenet): propagate error code

17 months agofeat(kernel-modules): add Qualcomm IPC router to enable USB
Jeremy Linton [Fri, 6 Oct 2023 15:33:22 +0000 (10:33 -0500)] 
feat(kernel-modules): add Qualcomm IPC router to enable USB

The x13s, and possibly other Qualcomm based devices need the QC
IPC router driver in order to enable USB. Without it, its not
possible to boot from USB-C attached disks.

IPC in this case is Inter _Processor_ Communication and forms
the message bus used to communicate between differing processing
elements in a given system/SoC running and managing various
hardware devices. This means that while it appears this driver
should be in the dracut network modules that is incorrect
because its not for enabling host networking in the initrd,
but rather for communicating with other hardware blocks.

Those other blocks aren't limited to modems, but any SMD (shared
memory device), which on QC based machines includes the audio DSPs,
RPM (resource power manager) and of course the application
processor cores linux is running on.

References:
https://osmocom.org/projects/quectel-modems/wiki/Qualcomm_Linux_SMD
https://android.googlesource.com/kernel/msm/+/android-7.1.0_r0.2/Documentation/arm/msm/msm_ipc_router.txt
https://github.com/dracutdevs/dracut/pull/2531

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
17 months agofix(90kernel-modules): add intel_lpss_pci for MacBook Pro 2017
Benjamin Drung [Tue, 14 Nov 2023 14:27:34 +0000 (15:27 +0100)] 
fix(90kernel-modules): add intel_lpss_pci for MacBook Pro 2017

The MacBook Pro 2017 (MacBookPro14,1) connects the keyboard via SPI:

```
$ dmesg
input: Apple SPI Keyboard as /devices/pci0000:00/0000:00:1e.3/pxa2xx-spi.3/spi_master/spi2/spi-APP000D:00/input/input4
```

The SPI controller requires the `intel_lpss_pci` kernel module:

```
$ lspci -vv
00:1e.3 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO SPI Controller #1 (rev 21)
Subsystem: Intel Corporation Sunrise Point-LP Serial IO SPI Controller
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 256 bytes
Interrupt: pin D routed to IRQ 23
Region 0: Memory at 9282c000 (64-bit, non-prefetchable) [size=4K]
Capabilities: [80] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D3 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [90] Vendor Specific Information: Len=14 <?>
Kernel driver in use: intel-lpss
Kernel modules: intel_lpss_pci
```

Fedora builds `intel_lpss_pci` into the kernel:

```
$ grep INTEL_LPSS_PCI /lib/modules/6.5.11-300.fc39.x86_64/config
CONFIG_MFD_INTEL_LPSS_PCI=y
```

But Ubuntu builds `intel_lpss_pci` only as module:

```
$ grep INTEL_LPSS_PCI /boot/config-6.5.0-10-generic
CONFIG_MFD_INTEL_LPSS_PCI=m
```

So explicitly include `intel_lpss_pci` to support the keyboard.

Bug-Ubuntu: https://launchpad.net/bugs/2042710
fixes: df381b7e0cd95f78e40ac70f0f3c96a2fa8dd189 ("feat(kernel-modules): driver support for macbook keyboards")
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
17 months agofix(resume): add new systemd-hibernate-resume.service
Antonio Alvarez Feijoo [Tue, 26 Sep 2023 07:43:37 +0000 (09:43 +0200)] 
fix(resume): add new systemd-hibernate-resume.service

Since https://github.com/systemd/systemd/commit/a628d933, the generator only
does the initial validation of the system info and then enables the new
`systemd-hibernate-resume.service`.

Fixes #2513

17 months agoci: adapt Dockerfile-Gentoo for recent systemd-utils change
Sam James [Fri, 17 Nov 2023 12:46:52 +0000 (12:46 +0000)] 
ci: adapt Dockerfile-Gentoo for recent systemd-utils change

systemd-utils can now install kernel-install independently of systemd-boot,
but systemd-boot requires that option to be enabled.

Fixes: https://github.com/dracutdevs/dracut/issues/2554
Signed-off-by: Sam James <sam@gentoo.org>
17 months agochore: switch to new Matrix chat room
Neal Gompa [Sat, 30 Mar 2024 03:26:24 +0000 (23:26 -0400)] 
chore: switch to new Matrix chat room

17 months agochore: rename master to main
Laszlo Gombos [Sat, 30 Mar 2024 02:31:49 +0000 (22:31 -0400)] 
chore: rename master to main

Changed the default branch name from master to main.

17 months agochore: rename dracutdevs/dracut to dracut-ng/dracut-ng
Laszlo Gombos [Sat, 30 Mar 2024 01:31:42 +0000 (21:31 -0400)] 
chore: rename dracutdevs/dracut to dracut-ng/dracut-ng

This change is required to initialize CI for dracut-ng.

17 months agofix(zfcp_rules): correct shellcheck regression when parsing ccw args
Ihno Krumreich [Wed, 28 Feb 2024 07:24:35 +0000 (08:24 +0100)] 
fix(zfcp_rules): correct shellcheck regression when parsing ccw args

Fixes 032ecd95c94b77f3f08237e0f765b355dacb9573

20 months agofix(configure): misleading error if C compiler is not installed
Antonio Alvarez Feijoo [Thu, 7 Dec 2023 11:08:17 +0000 (12:08 +0100)] 
fix(configure): misleading error if C compiler is not installed

While preparing a new system for development, `./configure` reaches a point
where it fails with:

```
$ ./configure
dracut needs fts development files.
```

After installing the fts library, `./configure` keeps throwing the same error:

```
$ rpm -qf /usr/include/fts.h
glibc-devel-2.38-6.1.x86_64
$ ./configure
dracut needs fts development files.
```

The problem is `${CC} $CFLAGS $LDFLAGS conftest.c` can also fail if the compiler
referenced by `$CC` is not installed.

20 months agofix(github): update format of labeler
Antonio Alvarez Feijoo [Tue, 2 Jan 2024 16:10:11 +0000 (17:10 +0100)] 
fix(github): update format of labeler

Since we are using `actions/labeler@main`, its format changed, displaying the
following error with every new PR:

```
Run actions/labeler@main
The configuration file (path: .github/labeler.yml) was not found locally, fetching via the api
Error: Error: found unexpected type for label 'repository' (should be array of config options)
Error: found unexpected type for label 'repository' (should be array of config options)
```

21 months agofix(systemd-journald): add systemd-sysusers dependency
Antonio Alvarez Feijoo [Thu, 27 Jul 2023 09:08:49 +0000 (11:08 +0200)] 
fix(systemd-journald): add systemd-sysusers dependency

22 months agofix(dracut-initramfs-restore.sh): do not set selinux labels if disabled
Antonio Alvarez Feijoo [Tue, 12 Sep 2023 13:07:16 +0000 (15:07 +0200)] 
fix(dracut-initramfs-restore.sh): do not set selinux labels if disabled

Also, it's not enough to check if `SELINUX=disabled` in /etc/selinux/config,
because it can be disabled via kernel command line options.

22 months agofix(systemd-repart): correct undefined $libdir
Daniel P. Berrangé [Tue, 17 Oct 2023 16:42:13 +0000 (17:42 +0100)] 
fix(systemd-repart): correct undefined $libdir

Nothing in dracut appears to define the '$libdir' environment
variable when module scripts are being run. As a result when
the 01-systemd-repart module script runs, it fails to copy any
of the config files into the initrd. Replace it with '/usr/lib'
which reflects where systemd-repart expects its global config
files.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
22 months agofix(overlayfs): split overlayfs mount in two steps
David Cassany [Fri, 22 Sep 2023 14:28:48 +0000 (16:28 +0200)] 
fix(overlayfs): split overlayfs mount in two steps

This commit splits the creation of required overlayfs underlaying
directories and the actual overlayfs mount. This way it is still
possible to mount the overlayfs with the generated sysroot.mount that
dmsquash-live creates.

The overlayfs tree is created in a pre-mount hook so it is executed
before sysroot.mount is started. Otherwise sysroot.mount starts and
fails before mount hooks are executed.

Signed-off-by: David Cassany <dcassany@suse.com>
22 months agofix(pkcs11): delete trailing dot on libcryptsetup-token-systemd-pkcs11.so
innovara [Fri, 27 Oct 2023 10:53:49 +0000 (11:53 +0100)] 
fix(pkcs11): delete trailing dot on libcryptsetup-token-systemd-pkcs11.so

libcryptsetup-token-systemd-pkcs11.so.* doesn't match the file libcryptsetup-token-systemd-pkcs11.so

22 months agodocs: update NEWS.md and AUTHORS 060
Henrik Gombos [Sat, 28 Oct 2023 23:11:39 +0000 (19:11 -0400)] 
docs: update NEWS.md and AUTHORS

22 months agofix(install.d): do not create initramfs if the supplied image is UKI
Vitaly Kuznetsov [Tue, 19 Sep 2023 15:36:37 +0000 (17:36 +0200)] 
fix(install.d): do not create initramfs if the supplied image is UKI

When the supplied kernel image is a UKI, there's no point in creating
initramfs as the UKI has it built-in already. This is the situation when
dracut.install is called for a distro shipped UKI.

Note, KERNEL_INSTALL_IMAGE_TYPE == "uki" is different from
KERNEL_INSTALL_LAYOUT == "uki", the later can be used to create UKI upon
installing a standard kernel image.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
22 months agofeat(systemd): install systemd-executor
Frantisek Sumsal [Sat, 14 Oct 2023 21:45:57 +0000 (23:45 +0200)] 
feat(systemd): install systemd-executor

In [0] systemd gained a new binary - systemd-executor - that's used to
spawn processes forked off systemd. Let's copy it into the initrd if
it's available.

[0] https://github.com/systemd/systemd/pull/27890

2 years agochore: remove unnecessary shellcheck disable for SC1087
Laszlo Gombos [Fri, 24 Feb 2023 22:16:21 +0000 (22:16 +0000)] 
chore: remove unnecessary shellcheck disable for SC1087

2 years agofix(dracut.sh): remove microcode check based on CONFIG_MICROCODE_[AMD|INTEL]
Antonio Alvarez Feijoo [Mon, 14 Aug 2023 10:28:11 +0000 (12:28 +0200)] 
fix(dracut.sh): remove microcode check based on CONFIG_MICROCODE_[AMD|INTEL]

`CONFIG_MICROCODE_AMD` and `CONFIG_MICROCODE_INTEL` are hidden since
https://lore.kernel.org/all/20230810160805.081212701@linutronix.de/, therefore
this check is wrong and early microcode is always disabled.

2 years agofix(release): maintain dracut-version.sh in the source tree
Henrik Gombos [Wed, 26 Jul 2023 16:43:37 +0000 (12:43 -0400)] 
fix(release): maintain dracut-version.sh in the source tree

Update dracut-version.sh as part of release generation.

2 years agodocs: set KVERSION for running test suite
Benjamin Drung [Sat, 19 Aug 2023 14:34:52 +0000 (16:34 +0200)] 
docs: set KVERSION for running test suite

Running the test suite in podman will most likely require setting
`KVERSION` because the running Linux kernel version will most likely be
different to the kernel version in the container.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agochore: remove unnecessary shellcheck disable for SC2154
Laszlo Gombos [Fri, 24 Feb 2023 17:34:33 +0000 (17:34 +0000)] 
chore: remove unnecessary shellcheck disable for SC2154

2 years agofeat(install.d): allow using dracut in combination with ukify
Andrew Ammerlaan [Sun, 20 Aug 2023 10:19:10 +0000 (12:19 +0200)] 
feat(install.d): allow using dracut in combination with ukify

This can be simply accomplished with the KERNEL_INSTALL_INITRD_GENERATOR
and KERNEL_INSTALL_UKI_GENERATOR variables. `60-ukify.install` looks for
the initrd in the KERNEL_INSTALL_STAGING_AREA and then takes care of building
the uki.

This change makes it possible to use a configuration like this:
/etc/kernel/install.conf
layout=uki
uki_generator=ukify
initrd_generator=dracut

Without this change this configuration will fail since dracut would also
generate an uki instead of initrd, which will cause a problem in
`60-ukify.install` since it can't find an initrd to use.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2 years agotest: support disabling KVM by setting NO_KVM
Benjamin Drung [Sun, 20 Aug 2023 00:20:01 +0000 (02:20 +0200)] 
test: support disabling KVM by setting NO_KVM

KVM fails on the Ubuntu ppc64el autopkgtest runners:

```
$ /usr/bin/qemu-system-ppc64el -enable-kvm -cpu host [...]
ioctl(KVM_CREATE_VM) failed: 22 Invalid argument
PPC KVM module is not loaded. Try modprobe kvm_hv.
qemu-system-ppc64el: failed to initialize kvm: Invalid argument
$ modprobe kvm_hv
modprobe: ERROR: could not insert 'kvm_hv': No such device
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agotest: set QEMU machine for ARM and PowerPC
Benjamin Drung [Fri, 18 Aug 2023 11:17:59 +0000 (13:17 +0200)] 
test: set QEMU machine for ARM and PowerPC

Set QEMU machine for ARM and PowerPC to run on Debian/Ubuntu.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agofix(test): only use QEMU machine q35 on x86
Benjamin Drung [Thu, 17 Aug 2023 17:35:04 +0000 (19:35 +0200)] 
fix(test): only use QEMU machine q35 on x86

The QEMU machine `q35` is only available on x86:

```
qemu-system-aarch64: unsupported machine type
Use -machine help to list supported machines
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agotest: support /boot/vmlinux
Benjamin Drung [Wed, 16 Aug 2023 23:03:20 +0000 (01:03 +0200)] 
test: support /boot/vmlinux

On the Ubuntu ppc64el architecture the kernel is named `/boot/vmlinux`.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agotest: log qemu calls to ease debugging
Benjamin Drung [Wed, 16 Aug 2023 17:21:26 +0000 (19:21 +0200)] 
test: log qemu calls to ease debugging

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agotest: introduce overridable ARCH variable in run-qemu
Benjamin Drung [Wed, 16 Aug 2023 13:53:27 +0000 (15:53 +0200)] 
test: introduce overridable ARCH variable in run-qemu

Allow specifying the architecture for `run-qemu`. E.g. this enables
running armhf containers on arm64 hosts.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agofix(test): use bash for jobs -r parameter
Benjamin Drung [Mon, 21 Aug 2023 16:46:59 +0000 (18:46 +0200)] 
fix(test): use bash for jobs -r parameter

Test 20 - "NFSv3 root=dhcp DHCP IP:path" fails on Debian with following
error message in `server.log`:

```
jobs -rp
/sbin/init: 105: jobs: Illegal option -r
```

The jobs parameter `-r` requires bash.

Partially fixes #1901
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agoci: also run integration test on Ubuntu
Benjamin Drung [Mon, 21 Aug 2023 10:03:54 +0000 (12:03 +0200)] 
ci: also run integration test on Ubuntu

Add a Dockerfile for Ubuntu (very similar to Debian) and run the
integration tests also on Ubuntu.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agofeat(Makefile): allow setting dracut version via environment variables
Benjamin Drung [Sat, 19 Aug 2023 11:15:00 +0000 (13:15 +0200)] 
feat(Makefile): allow setting dracut version via environment variables

To ease packaging dracut for Debian/Ubuntu, please support setting the
dracut main/full version via environment variables:

```
$ DRACUT_MAIN_VERSION=007
$ export DRACUT_FULL_VERSION=007-bond
$ make dracut-version.sh
$ grep VERSION dracut-version.sh
DRACUT_VERSION=007-bond
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agofix: codespell
Henrik Gombos [Sat, 19 Aug 2023 12:35:56 +0000 (08:35 -0400)] 
fix: codespell

2 years agotest: fix skipcpio path for installed binary
Benjamin Drung [Wed, 16 Aug 2023 12:03:10 +0000 (14:03 +0200)] 
test: fix skipcpio path for installed binary

The `skipcpio` binary is installed in `${PKGLIBDIR}/skipcpio`.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agotest: skip test 98 if dracut-util is not available
Benjamin Drung [Wed, 16 Aug 2023 11:56:41 +0000 (13:56 +0200)] 
test: skip test 98 if dracut-util is not available

Building `dracut-util` requires the source code to be present and
prevents running the test against the installed system. Check that
`dracut-util` and rely on the test environment to build `dracut-util`
beforehand.

2 years agotest: make package libdir configurable
Benjamin Drung [Wed, 16 Aug 2023 11:50:47 +0000 (13:50 +0200)] 
test: make package libdir configurable

Make the package libdir configurable to allow running the test suite
out-of-tree. `PKGLIBDIR` can be pointed to the installed dracut libdir.
Use `PKGLIBDIR` for the location of `dracut-init.sh`, `dracut-install`,
`dracut-util`, `dracut-cpio`, and `modules.d`.

This change is used to run the test suite against the installed dracut
in an autopkgtest for the Debian/Ubuntu package.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agotest: make dracut directory configurable
Benjamin Drung [Wed, 16 Aug 2023 09:06:16 +0000 (11:06 +0200)] 
test: make dracut directory configurable

Make the directory of the `dracut.sh` script configurable to allow
running the test suite out-of-tree.

This change is used to run the test suite against the installed dracut
in an autopkgtest for the Debian/Ubuntu package.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2 years agofix(systemd): add new systemd-tmpfiles-setup-dev-early.service
Antonio Alvarez Feijoo [Mon, 14 Aug 2023 07:11:15 +0000 (09:11 +0200)] 
fix(systemd): add new systemd-tmpfiles-setup-dev-early.service

`systemd-tmpfiles-setup-dev.service`, `kmod-static-nodes.service` and
`systemd-sysusers.service` have an ordering dependency on this new service since
https://github.com/systemd/systemd/commit/353c849

2 years agofix(systemd-udevd): add missing override paths
Antonio Alvarez Feijoo [Thu, 27 Jul 2023 13:37:46 +0000 (15:37 +0200)] 
fix(systemd-udevd): add missing override paths

2 years 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
...
```

2 years 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.

2 years 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>
2 years 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)