]> git.ipfire.org Git - thirdparty/dracut.git/log
thirdparty/dracut.git
14 months agofix(dracut.sh): use dynamically uefi's sections offset
Valentin Lefebvre [Mon, 13 Mar 2023 11:06:13 +0000 (12:06 +0100)] 
fix(dracut.sh): use dynamically uefi's sections offset

* Uefi section are creating by `objcopy` with hardcoded sections
offset. This commit allow to have the correct offset between
each part of the efi file, needed to create an UKI. Offsets
are simply calculated so no sections overlap, as recommended
in  https://wiki.archlinux.org/title/Unified_kernel_image#Manually
Moreover, efi stub file's header is parsed to apply the correct
offsets according the section alignment factor.
* Remove EFI_SECTION_VMA_INITRD, no need anymore as initrd
section offset dynamically calculated

Fixes dracutdevs#2275

Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
14 months agofix(lvmthinpool-monitor): activate lvm thin pool before extend its size
Tao Liu [Fri, 3 Mar 2023 10:27:25 +0000 (18:27 +0800)] 
fix(lvmthinpool-monitor): activate lvm thin pool before extend its size

The state of lvm thin pool may change into inactived state when kdump into
2nd kernel. As a result, lvextend will fail to extend its size. For example:

In 1st kernel:

  $ lvs
  LV       VG         Attr       LSize   Pool     Origin Data%  Meta%
  vol      vg00       Vwi-a-tz-- 300.00m thinpool        70.54
  thinpool vg00       twi-aotz-- 236.00m                 89.67  12.50
  ...

In 2nd kernel:

  LV       VG         Attr       LSize   Pool     Origin Data%  Meta%
  vol      vg00       Vwi-aotz-- 300.00m thinpool        70.54
  thinpool vg00       twi---tz-- 236.00m                 89.67  12.50
  ...

And the lvextend failing log:
[  8.483878] start-thinpool-monitor[590]: lvextend using policy requires the thin pool to be active.

In this patch, we will first activate lvm thin pool before calling lvextend
during kdump.

Signed-off-by: Tao Liu <ltao@redhat.com>
15 months agochore(deps): bump luizm/action-sh-checker from 0.5.0 to 0.6.0
dependabot[bot] [Tue, 28 Feb 2023 18:57:06 +0000 (18:57 +0000)] 
chore(deps): bump luizm/action-sh-checker from 0.5.0 to 0.6.0

Bumps [luizm/action-sh-checker](https://github.com/luizm/action-sh-checker) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/luizm/action-sh-checker/releases)
- [Commits](https://github.com/luizm/action-sh-checker/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: luizm/action-sh-checker
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agofix(dmsquash-live): restore compatibility with earlier releases
Laszlo Gombos [Fri, 24 Feb 2023 01:57:19 +0000 (01:57 +0000)] 
fix(dmsquash-live): restore compatibility with earlier releases

Follow-up to 40dd5c90e0efcb9ebaa9abb42a38c7316e9706bd .

15 months agofix(dracut.sh): kmoddir does not handle trailing /
Pavel Valena [Fri, 24 Feb 2023 18:19:59 +0000 (19:19 +0100)] 
fix(dracut.sh): kmoddir does not handle trailing /

Fixes https://github.com/dracutdevs/dracut/issues/2236

+(/) only works in bash interactive mode. Using any non-interactive
bash run simply doesn't remove anything.

The solution is copied from dracut-lib.sh, trim().

15 months agofix(udev-rules): remove old eudev specific rule
Laszlo Gombos [Wed, 22 Feb 2023 04:02:17 +0000 (04:02 +0000)] 
fix(udev-rules): remove old eudev specific rule

Revert 64fb0900cbc47804b4225287e4622063169db360, no longer
needed.

15 months agofix(udev-rules): remove old redhat specific rule
Laszlo Gombos [Wed, 22 Feb 2023 03:56:37 +0000 (03:56 +0000)] 
fix(udev-rules): remove old redhat specific rule

The 40-redhat.rules rule has been removed upstream in 2010.

15 months agofix(udev-rules): remove old edd_id extra rules
Laszlo Gombos [Wed, 22 Feb 2023 03:35:46 +0000 (03:35 +0000)] 
fix(udev-rules): remove old edd_id extra rules

The 61-persistent-storage-edd.rules rule has been removed upstream
in 2012.

15 months agofix(udev-rules): remove old debian specific rules
Laszlo Gombos [Tue, 21 Feb 2023 03:09:19 +0000 (03:09 +0000)] 
fix(udev-rules): remove old debian specific rules

The last Debian release that carried 91-permissions.rules is wheezy.

15 months agofeat(test): nfs_fetch_url test into nfs test
“Masahiro [Tue, 7 Feb 2023 09:30:36 +0000 (18:30 +0900)] 
feat(test): nfs_fetch_url test into nfs test

This is to check the behavior of nfs_fetch_url() in nfs-lib.sh.
nfs_fetch_url() calls nfs_already_mounted() internally.
A file /nfs/client/root/fetchfile is on NFS server, which is fetched
from clients for testing with nfs_fetch_url().

15 months agofix(url-lib.sh): nfs_already_mounted() with trailing slash in nfs path
“Masahiro [Fri, 3 Feb 2023 03:08:26 +0000 (12:08 +0900)] 
fix(url-lib.sh): nfs_already_mounted() with trailing slash in nfs path

nfs_already_mounted() doesn't work when the installation ISO and kickstart file on a same NFS share are specified with inst.repo and inst.ks boot parameter as below.

   inst.repo=nfs:192.168.1.1:/home/data/rhel9.iso inst.ks=nfs:192.168.1.1:/home/data/ks.cfg

   NOTE: /home/data is configured for nfs share on 192.168.1.1

One problem is a file (not a directory) was passed into nfs_already_mounted().
nfs_already_mounted() is the function to judge if the given directory is already mounted.
So, filepath should be passed in nfs_fetch_url().

The other problem is about the trailing slash in the nfs path in /proc/mounts.

The /proc/mounts has an entry after nfs mount of inst.repo.

   192.168.1.1:/data/   /run/install/isodir  nfs  ro,relatime,<snip>

In this case, nfs_already_mounted() returns "/run/install/isodir//home/data/ks.cfg" wrongly. The following is from the log.

[   14.556279] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@156(nfs_fetch_url): nfs_already_mounted 192.168.122.1 /home/data/ks.cfg
[   14.556279] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@137(nfs_already_mounted): local server=192.168.122.1 path=/home/data/ks.cfg s= p=
...
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@140(nfs_already_mounted): '[' 192.168.122.1 = 192.168.122.1 ']'
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@141(nfs_already_mounted): '[' /home/data/ks.cfg = /home/data/ ']'
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@143(nfs_already_mounted): str_starts /home/data/ks.cfg /home/data/
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/dracut-lib.sh@51(str_starts): '[' ks.cfg '!=' /home/data/ks.cfg ']'
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@144(nfs_already_mounted): echo /run/install/isodir//home/data/ks.cfg
...
[   14.658069] localhost.localdomain dracut-initqueue[934]: //lib/url-lib.sh@156(nfs_fetch_url): mntdir=/run/install/isodir//home/data/ks.cfg

This function doesn't expect the trailiing slash of the nfs path in /proc/mounts, so it should be removed before processing it.

15 months agoci: use CodeQL instead of LGTM
Frantisek Sumsal [Wed, 14 Sep 2022 09:33:51 +0000 (11:33 +0200)] 
ci: use CodeQL instead of LGTM

As LGTM is going to be shut down by EOY[0], let's move the code scanning to
CodeQL as recommended. Thanks to GH integration the results from such
scans will be shown both in the respective PR and in the Security ->
Code Scanning tab[1].

[0] https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/
[1] https://github.com/dracutdevs/dracut/security/code-scanning

15 months agofeat(dracut): use log level indicator in console output
Antonio Alvarez Feijoo [Tue, 27 Dec 2022 15:44:58 +0000 (16:44 +0100)] 
feat(dracut): use log level indicator in console output

Also, use the same format in messages printed to console before dracut-logger
is sourced.

Fixes issue #1065

15 months agofeat(kernel-modules): driver support for macbook keyboards
Pavel Valena [Tue, 21 Feb 2023 00:57:50 +0000 (01:57 +0100)] 
feat(kernel-modules): driver support for macbook keyboards

Discussed in: https://bugzilla.redhat.com/show_bug.cgi?id=2166209

15 months agofix(dracut-install): prevent possible infinite recursion with suppliers
Adrien Thierry [Wed, 15 Feb 2023 19:13:56 +0000 (14:13 -0500)] 
fix(dracut-install): prevent possible infinite recursion with suppliers

During search for fw_devlink suppliers, it's possible to encounter a
situation where supplier A depends on supplier B, and supplier B has a
parent node that depends on supplier A. This leads to an infinite
recursion.

To fix this, make sure suppliers are only processed once.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
15 months agobuild: remove rpm spec file and build rules
John Meneghini [Tue, 14 Feb 2023 21:28:57 +0000 (16:28 -0500)] 
build: remove rpm spec file and build rules

As discussed in issue #2204 this patch removes the dracut.spec file from
the repository.  The advantage of this patch is that it creates a
dracut-version.tar.xv file that can be more easily consumed by the
downstream distributions because there's no rpm spec file included in
the distribution.

Tested with a downstream rpm spec fiie:

```
cd dracut
VERSION=`git describe --abbrev=0 --tags --always`
make clean
make dist
cp dracut-${VERSION}.tar.xz ../
cd ..

xz -d -v dracut-${VERSION}.tar.xz
tar rf dracut-${VERSION}.tar dracut.spec
xz -9 dracut-${VERSION}.tar

rm -rf rmpbuild
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
rpmbuild -ta --define "_topdir `pwd`/rpmbuild" -v dracut-${VERSION}.tar.xz
```

Fixes issue #2204

15 months agofix(kernel-modules): add UFS drivers
Adrien Thierry [Tue, 14 Feb 2023 18:41:35 +0000 (13:41 -0500)] 
fix(kernel-modules): add UFS drivers

Add ufs to the list of block drivers as it is used in modern embedded
systems.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
15 months agofix(kernel-modules): use modalias info in get_dev_module()
Adrien Thierry [Mon, 13 Feb 2023 15:43:32 +0000 (10:43 -0500)] 
fix(kernel-modules): use modalias info in get_dev_module()

When calling dracut with '--hostonly-mode=strict', get_dev_module() gets
called on the system's block devices to find the required drivers. The
driver name is retrieved using udevadm. However, the driver name
returned by udevadm is not necessarily the same as the module name.
This is the case for the Qualcomm UFS driver: udevadm returns
'ufshcd-qcom' while the module name is 'ufs-qcom', so dracut-install is
not able to find the module afterwards.

To solve this, make get_dev_module() also return the module alias info
from the modalias files contained in the sysfs directories parsed by
udevadm.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
15 months agofix(crypt): add missing libraries
Jóhann B. Guðmundsson [Mon, 13 Feb 2023 20:22:56 +0000 (20:22 +0000)] 
fix(crypt): add missing libraries

Add missing libraries, closes #2137

15 months agorevert(network-manager): avoid restarting NetworkManager
Lubomir Rintel [Tue, 20 Dec 2022 12:06:43 +0000 (13:06 +0100)] 
revert(network-manager): avoid restarting NetworkManager

This reverts commit 77630365aed201a729c73a9ffda0733a75f3fee4.

Its commit message states:

  On EL8.3 the NetworkManager keep restarting even if it exits successfully
  while waiting for Clevis to unlock. This patch ensures NetworkManager runs
  only once in initrd.

Yes; NetworkManager is run multiple times, so that it's able to
configure interfaces that haven't been seen previously (because bus was
slow to scan or device took time to initialize).

It's not clear what problem was the original commit trying to fix.
I suspect there was no problem, just a misunderstanding.

15 months agofix(dracut.sh): handle sbsign errors for UEFI builds
Antonio Alvarez Feijoo [Mon, 13 Feb 2023 10:13:00 +0000 (11:13 +0100)] 
fix(dracut.sh): handle sbsign errors for UEFI builds

`sbsign` does not issue any error if there is not enough disk space to create
the signed file using its `--output` option. So, verify the signed image after
its creation using `sbverify`.

Fixes issue #2197

15 months agofix(dracut.sh): handle out of space error for UEFI builds
Antonio Alvarez Feijoo [Mon, 13 Feb 2023 10:11:09 +0000 (11:11 +0100)] 
fix(dracut.sh): handle out of space error for UEFI builds

If `cp` fails, do not continue, print an error and exit, like it's already
being done for non-UEFI builds.

15 months agofix(network): IPv6: don't wait for RA for static IPv6 assignments
Martin Wilck [Tue, 7 Feb 2023 21:24:15 +0000 (22:24 +0100)] 
fix(network): IPv6: don't wait for RA for static IPv6 assignments

This patch reverts commit
c603419 ("wait for IPv6 RA if using none/static IPv6 assignment").
It's not generally correct wait for a default route to be established
for an interface, or to wait for "proto ra" routes in general.
For example, if the system is a router itself, it will receive no
RAs. In isolated networks, no gateway may be advertized, either.
This is similar in spirit to 76f6566 ("Revert "wait for IPv6 RA
if using none/static IPv6 assignment"")

Whatever c603419 ("wait for IPv6 RA if using none/static IPv6 assignment")
was supposed to achieve, it should be done differently.

15 months agofix(network-legacy): always include af_packet
Martin Wilck [Tue, 7 Feb 2023 20:59:51 +0000 (21:59 +0100)] 
fix(network-legacy): 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.

15 months agofix(network): don't assume prefix length 64 by default
Martin Wilck [Fri, 3 Feb 2023 20:39:02 +0000 (21:39 +0100)] 
fix(network): don't assume prefix length 64 by default

Assuming a default prefix length of 64 by default if no explicit
prefix length is given is wrong and known to cause connectivity
problems in some networks. A prefix length of 128 should be assumed
in this case.

See https://www.rfc-editor.org/rfc/rfc5942 (specifically section 5)
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684009

15 months agofix(iscsi): prefix syntax for static iBFT IPv6 addresses
Martin Wilck [Fri, 3 Feb 2023 20:26:28 +0000 (21:26 +0100)] 
fix(iscsi): prefix syntax for static iBFT IPv6 addresses

ibft_to_cmdline() formats a static IPv6 address like this
(without peer, gateway, hostname):

  ip="[fd09:9a46:b5c1:1fe:1::10/64]:::::ibft0:none"

This means that the "mask" field (4th) is left blank. When this is
parsed later by parse-ip-opts.sh, it bails out with the error
message "Sorry, automatic calculation of netmask is not yet supported".

parse-ip-opts.sh rather expects the prefix in the 4th field:

  ip="[fd09:9a46:b5c1:1fe:1::10]:::64::ibft0:none"

This syntax will be correctly transformed to the command

  ip addr add fd09:9a46:b5c1:1fe::10/64 dev ibft0

This patch fixes the formatting of the "ip=" line in ibft_to_cmdline().

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

In iBFT 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.

15 months agofeat(dracut-install): add fw_devlink suppliers as module dependencies
Adrien Thierry [Mon, 5 Dec 2022 21:28:17 +0000 (16:28 -0500)] 
feat(dracut-install): add fw_devlink suppliers as module dependencies

Dracut currently finds kernel module dependencies using two methods:
depmod and softdeps. However, these are often insufficient on embedded
systems where a lot of driver dependencies are only described in the
device tree. This is often the case for low-level devices such as
clocks, regulators, pinctrls, etc.

This patch allows dracut to find those device tree dependencies, by
parsing the sysfs supplier nodes populated by fw_devlink.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
15 months agorefactor(dracut-install): add Hashmap cleanup function
Adrien Thierry [Mon, 21 Nov 2022 16:14:23 +0000 (11:14 -0500)] 
refactor(dracut-install): add Hashmap cleanup function

This is prep work for adding support for fw_devlink suppliers
dependencies.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
15 months agorefactor(dracut-install): add function to install one dependent module
Adrien Thierry [Mon, 14 Nov 2022 16:13:57 +0000 (11:13 -0500)] 
refactor(dracut-install): add function to install one dependent module

This is prep work for adding support for fw_devlink suppliers
dependencies.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
15 months agochore(deps): bump luizm/action-sh-checker from 0.2.2 to 0.5.0
dependabot[bot] [Fri, 3 Feb 2023 02:43:59 +0000 (02:43 +0000)] 
chore(deps): bump luizm/action-sh-checker from 0.2.2 to 0.5.0

Bumps [luizm/action-sh-checker](https://github.com/luizm/action-sh-checker) from 0.2.2 to 0.5.0.
- [Release notes](https://github.com/luizm/action-sh-checker/releases)
- [Commits](https://github.com/luizm/action-sh-checker/compare/v0.2.2...v0.5.0)

---
updated-dependencies:
- dependency-name: luizm/action-sh-checker
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agochore(shfmt): update to pass with shfmt v3.5.1
Laszlo Gombos [Sun, 20 Nov 2022 23:58:31 +0000 (23:58 +0000)] 
chore(shfmt): update to pass with shfmt v3.5.1

15 months agofix(fips): move fips-boot script to pre-pivot
Antonio Alvarez Feijoo [Tue, 27 Dec 2022 08:30:43 +0000 (09:30 +0100)] 
fix(fips): move fips-boot script to pre-pivot

This is needed in s390x to be able to use the same `boot=` command line
parameter in grub and zipl. Otherwise, `boot=` would need to be added only to
`grub.cfg` (not `/etc/default/grub` and thereby not to `/boot/zipl/config`).

Signed-off-by: Raymund Will <rw@suse.com>
15 months agofix(fips): only unmount /boot if it was mounted by the fips module
Antonio Alvarez Feijoo [Tue, 27 Dec 2022 08:30:09 +0000 (09:30 +0100)] 
fix(fips): only unmount /boot if it was mounted by the fips module

The `do_fips` method should only unmount /boot if it was mounted in the
`mount_boot` method.

In addition, now the `mount_boot` method checks if /boot is already mounted.

Signed-off-by: Raymund Will <rw@suse.com>
15 months agofeat(fips): add progress messages
Antonio Alvarez Feijoo [Tue, 27 Dec 2022 08:29:44 +0000 (09:29 +0100)] 
feat(fips): add progress messages

This allows to better understand at what point a FIPS integrity test failed.

Signed-off-by: Raymund Will <rw@suse.com>
15 months agofix(fips): do not blindly remove /boot
Antonio Alvarez Feijoo [Wed, 23 Nov 2022 13:22:21 +0000 (14:22 +0100)] 
fix(fips): do not blindly remove /boot

The `mount_boot` method called from fips-noboot.sh in the pre-pivot hook blindly
executes `rm -rf /boot` if there is no `boot=` command line parameter, without
first checking that /boot is not already mounted by other means.

15 months agochore(base): remove support for <udev-176
Laszlo Gombos [Sat, 3 Dec 2022 23:06:54 +0000 (23:06 +0000)] 
chore(base): remove support for <udev-176

This reverts 579238a3acd0317d7124a76dc489f19d9471fb63.

Keep the support for prepare_udev_rules for out-of-tree
dracut modules and issue a deprecation warning.

15 months agofix(plymouth): remove /etc/system-release dependency
Laszlo Gombos [Wed, 1 Feb 2023 02:20:23 +0000 (02:20 +0000)] 
fix(plymouth): remove /etc/system-release dependency

/etc/*release files should not be managed in the plymouth module
and more importantly dracut assumes /etc/os-release not
/etc/system-release

15 months agofeat(resume): also consider resume= in the cmdline as enabling hibernation
наб [Mon, 2 Jan 2023 15:48:14 +0000 (16:48 +0100)] 
feat(resume): also consider resume= in the cmdline as enabling hibernation

Don't consider noresume to disable, that's a single-boot flag

Closes #924

15 months agofix(network-manager): add "After" dependency on dbus.service
Beniamino Galvani [Tue, 31 Jan 2023 15:32:19 +0000 (16:32 +0100)] 
fix(network-manager): add "After" dependency on dbus.service

During shutdown, there is no ordering dependency between the nm-initrd service
and the D-Bus daemon, and so the latter can be stopped before. This causes
issues to NetworkManager, especially when team interfaces are present because
NM will see teamd dropping from the bus and will try to reactivate the
connection.

Add a "After" dependency to make sure the D-Bus daemon is stopped after NM on
shutdown.

15 months agofix(fido2): libfido2.so depends on libz.so
Laszlo Gombos [Sun, 5 Feb 2023 01:35:36 +0000 (01:35 +0000)] 
fix(fido2): libfido2.so depends on libz.so

Co-authored-by: cs50guy2
15 months agofix(dracut-install): continue parsing if ldd prints "cannot execute binary file"
Antonio Alvarez Feijoo [Thu, 9 Feb 2023 14:30:34 +0000 (15:30 +0100)] 
fix(dracut-install): continue parsing if ldd prints "cannot execute binary file"

When the kernel is compiled without IA32_EMULATION and the glibc 32-bit library
is installed on the system, `ldd` prints the following output:

```
> ldd /usr/lib64/libfido2.so.1.12.0
/bin/ldd: line 162: /lib/ld-linux.so.2: cannot execute binary file: Exec format error
linux-vdso.so.1 (0x00007ffd627fa000)
libcbor.so.0.9 => /lib64/libcbor.so.0.9 (0x00007f18d799f000)
libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007f18d7400000)
libudev.so.1 => /lib64/libudev.so.1 (0x00007f18d7971000)
libhidapi-hidraw.so.0 => /lib64/libhidapi-hidraw.so.0 (0x00007f18d7968000)
libz.so.1 => /lib64/libz.so.1 (0x00007f18d794e000)
libc.so.6 => /lib64/libc.so.6 (0x00007f18d7205000)
/lib64/ld-linux-x86-64.so.2 (0x00007f18d79f9000)
> echo $?
0
```

The `ldd` script uses the following code to resolve dependencies:

```
RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"
...
RTLD=
ret=1
for rtld in ${RTLDLIST}; do
  if test -x $rtld; then
    verify_out=`${rtld} --verify "$file"`
    ret=$?
    case $ret in
      [02]) RTLD=${rtld}; break;;
    esac
  fi
done
```

So, if the 32-bit library fails, the 64-bit library may work, so don't stop
parsing the `ldd` output unconditionally when the message "cannot execute binary
file" is printed.

Fixes issue #2190

15 months agofix: make iso-scan trigger udev events
0x5c [Thu, 9 Feb 2023 10:26:30 +0000 (05:26 -0500)] 
fix: make iso-scan trigger udev events

Fixes #2183

15 months agoci: enable test 60
Beniamino Galvani [Fri, 10 Feb 2023 18:04:06 +0000 (19:04 +0100)] 
ci: enable test 60

It's hopefully stable now.

15 months agofix(test): rename test 60
Beniamino Galvani [Fri, 10 Feb 2023 18:02:05 +0000 (19:02 +0100)] 
fix(test): rename test 60

The test *also* checks the generation of ifcfg files, but it's primarily a test
for bonding, bridging and VLANs. Update the name to reflect this.

15 months agofix(test): improve test 60
Beniamino Galvani [Tue, 7 Feb 2023 14:28:57 +0000 (15:28 +0100)] 
fix(test): improve test 60

The test has the following issues:

 - it sets up a bridge on net1 and net2, however those interfaces
   are part of the same qemu hub and this causes switching loops;

 - the bonds are created on two interfaces but only one has a DHCP server, and
   this causes random failures;

 - the checks performed on the client are pretty limited.

Rework the test:

 - avoid the bridging loop;

 - update the topology to use a bond interface on the server side;

 - introduce additional checks on the client: start a ping and check that ports
   are properly attached to bonds and bridge;

 - make it possible to return module-specific information from the client; in
   the future this can be added for example to check that the NetworkManager or
   systemd-networkd configuration is correct.

15 months agofix(test): remove leftover link file from server rootfs
Beniamino Galvani [Tue, 7 Feb 2023 12:49:15 +0000 (13:49 +0100)] 
fix(test): remove leftover link file from server rootfs

01-client.link must be removed, otherwise it conflicts with 01-server.link that
sets a different naming policy.

15 months agofix(test): assign fixed address to bridge
Beniamino Galvani [Thu, 2 Feb 2023 09:42:00 +0000 (10:42 +0100)] 
fix(test): assign fixed address to bridge

Kernel uses the lowest MAC of all attached ports as MAC address of the
bridge. However, after the first port gets attached, DHCP can be started on the
bridge and it will use the MAC (and client-id) of the first port; so, the MAC
used for DHCP depends on the order of attachment of ports, which is not
guaranteed to be stable in general.

To make sure that the DHCP server always sees the request from the MAC of
enp0s1, assign that MAC to the bridge from the kernel command line.

15 months agofix(test): bump DHCP timeout to 30 seconds
Beniamino Galvani [Wed, 1 Feb 2023 10:18:57 +0000 (11:18 +0100)] 
fix(test): bump DHCP timeout to 30 seconds

The current interval (3 seconds) is very low and causes sporadic failures
especially when DHCP is run on a bridge (TEST-50-MULTINIC); in that specific
case, interfaces take time to be attached to the bridge and before enp0s1 is
attached all DISCOVER packets are lost.

Bump the timeout to a more robust value of 30 seconds.

15 months agofix(test): remove check on dhclient support for --timeout
Beniamino Galvani [Wed, 1 Feb 2023 10:07:49 +0000 (11:07 +0100)] 
fix(test): remove check on dhclient support for --timeout

The network-legacy dracut module already ignores the DHCP timeout option when
it's not supported by dhclient. Other network modules don't use dhclient for
DHCP.

15 months agofix(test): adapt multinic test for new NetworkManager versions
Beniamino Galvani [Wed, 1 Feb 2023 09:39:15 +0000 (10:39 +0100)] 
fix(test): adapt multinic test for new NetworkManager versions

Since version 1.42, NetworkManager creates a "external" connection for the
loopback interface. Ignore that connection in the multinic test.

15 months agofix(install): do not undef _FILE_OFFSET_BITS
Khem Raj [Sat, 31 Dec 2022 22:41:52 +0000 (14:41 -0800)] 
fix(install): do not undef _FILE_OFFSET_BITS

_FILE_OFFSET_BITS is a feature test macro to determine largefile
support. Usually its set to 64 on systems supporting LFS. Its also
needed to be set to 64 for supporting 64bit time_t on glibc on 32bit
systems. If its undefined explicitly, then 64bit time_t can not be
enabled.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 months agochore(deps): bump docker/build-push-action from 3 to 4
dependabot[bot] [Tue, 31 Jan 2023 18:01:40 +0000 (18:01 +0000)] 
chore(deps): bump docker/build-push-action from 3 to 4

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

---
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>
15 months agofix(dracut.sh): --sysroot option broken if global variables not set in conf
Antonio Alvarez Feijoo [Thu, 29 Dec 2022 10:38:58 +0000 (11:38 +0100)] 
fix(dracut.sh): --sysroot option broken if global variables not set in conf

When `$dracutsysrootdir` is set and references an existing directory, the
internal global variables are never set, unless their value is assigned via
configuration file.

The simple fix would be turn all:

```
[[ -d $dracutsysrootdir$var ]] || var=value
```
into:
```
[[ -z $var || ! -d $dracutsysrootdir$var ]] && var=value
```

But this patch also includes a refactoring, removing duplicate code using the
same `set_global_var` function to set and export global variables, and improving
readability.

15 months agorefactor(dracut-init.sh): remove redundant "dracut" from "dracut module" prints
Antonio Alvarez Feijoo [Tue, 27 Dec 2022 15:58:24 +0000 (16:58 +0100)] 
refactor(dracut-init.sh): remove redundant "dracut" from "dracut module" prints

In a similar fashion than "Including module" prints.

15 months agofeat(dracut-init.sh): specify if a module cannot be found or cannot be installed
Antonio Alvarez Feijoo [Tue, 27 Dec 2022 14:26:50 +0000 (15:26 +0100)] 
feat(dracut-init.sh): specify if a module cannot be found or cannot be installed

Do not print the same error message for both situations.

15 months agofix(lsinitrd.sh): handle filenames with special characters
Antonio Alvarez Feijoo [Wed, 4 Jan 2023 15:51:12 +0000 (16:51 +0100)] 
fix(lsinitrd.sh): handle filenames with special characters

Printing and unpacking of specific files passed as arguments does not work if
their filenames contain special characters with a hexadecimal character escape
(\x), which is often the case for systemd device units.

16 months agofix(dracut-systemd): remove unused argument
Antonio Alvarez Feijoo [Mon, 9 Jan 2023 10:47:06 +0000 (11:47 +0100)] 
fix(dracut-systemd): remove unused argument

The `generator_wait_for_dev` function of the dracut rootfs systemd generator
only uses the first argument. Moreover, RDRETRY is unset at this point.

16 months agofeat(lvm): always include all drivers that LVM can use
Antonio Alvarez Feijoo [Wed, 14 Dec 2022 10:44:51 +0000 (11:44 +0100)] 
feat(lvm): always include all drivers that LVM can use

This patch adds all the kernel modules that might be needed by LVM, to avoid
having to rebuild the initrd in hostonly mode after a dynamic change that
requires new drivers to boot.

For example, LVM allows to dynamically convert a linear logical volume to a
RAID-1 type (`lvconvert --type raid1 vg/lv`), which, in hostonly mode, will
require the user to manually rebuild the initrd again to include the new RAID
drivers in use, otherwise the system will fail to boot.

16 months agofix(dracut-init.sh): correct typo in comment
Antonio Alvarez Feijoo [Thu, 19 Jan 2023 13:28:09 +0000 (14:28 +0100)] 
fix(dracut-init.sh): correct typo in comment

16 months agofix(dracut.sh): correct --help and --version exit codes
Antonio Alvarez Feijoo [Thu, 19 Jan 2023 11:08:39 +0000 (12:08 +0100)] 
fix(dracut.sh): correct --help and --version exit codes

Both are valid options that cause regular program termination without errors, so
dracut should return 0.

16 months agorefactor(virtiofs): remove exit after die
Antonio Alvarez Feijoo [Thu, 19 Jan 2023 09:42:14 +0000 (10:42 +0100)] 
refactor(virtiofs): remove exit after die

The `die` function already ends with `exit 1`.

16 months agoci: fix Gentoo container used for testing
Laszlo Gombos [Fri, 13 Jan 2023 17:50:35 +0000 (17:50 +0000)] 
ci: fix Gentoo container used for testing

16 months agofix(crypt-gpg): do not use always --card-status
LinkTed [Fri, 23 Dec 2022 19:16:31 +0000 (20:16 +0100)] 
fix(crypt-gpg): do not use always --card-status

If no GPG smart card is used then the card-status breaks the decryption
of the keyfile. Therefore, use the card-status only if a smart card is
used to decrypt the keyfie.

Fixes issue #2004

16 months agodocs(RELEASE.md): update release docs
Jóhann B. Guðmundsson [Sat, 24 Dec 2022 17:38:54 +0000 (17:38 +0000)] 
docs(RELEASE.md): update release docs

- Remove the reference to Harald's git ci alias
- Added a missing push to master
- Added a warning not to add the Rendered View entry from the NEWS.md to
  the tags. ( Github adds that to the release with no way of removing it, see 058 )
- Added validation of the new tag ( Good practice )
- Clarify milestone handover.

16 months agoci: disable test 50
Laszlo Gombos [Mon, 2 Jan 2023 21:11:47 +0000 (21:11 +0000)] 
ci: disable test 50

Test 50 (MULTINIC) seems to be the only test that prevents
the project from having an all passing continuous integration
test suite.

16 months agofix: shellcheck 0.8.0
Antonio Alvarez Feijoo [Mon, 2 Jan 2023 08:58:06 +0000 (09:58 +0100)] 
fix: shellcheck 0.8.0

16 months agofix(dmsquash-live): live:/dev/*
Laszlo Gombos [Sun, 1 Jan 2023 03:39:17 +0000 (03:39 +0000)] 
fix(dmsquash-live): live:/dev/*

fix a bug introduced in 71cfa2e22

make sure root is set correctly for both of the following cases
 - "root=live:/dev/*"
 - "rd.live.image root=/dev/*"

17 months agofix(load_fstype): avoid false positive searchs
Frederick Grose [Sun, 27 Nov 2022 18:52:27 +0000 (13:52 -0500)] 
fix(load_fstype): avoid false positive searchs

Refactor to avoid substring matches
  and to speed processing.
Also avoid xtracing.

17 months agofix: shellcheck 0.8.0
Laszlo Gombos [Mon, 21 Nov 2022 04:01:59 +0000 (04:01 +0000)] 
fix: shellcheck 0.8.0

17 months agorefactor(dracut-install): strerror(errno) -> %m
наб [Wed, 27 Apr 2022 16:57:50 +0000 (18:57 +0200)] 
refactor(dracut-install): strerror(errno) -> %m

17 months agoperf(dracut-install): don't strdup() environment block
наб [Wed, 27 Apr 2022 16:52:36 +0000 (18:52 +0200)] 
perf(dracut-install): don't strdup() environment block

17 months agoperf(dracut-install): don't reallocate {src,dst}path in hmac_install()
наб [Wed, 27 Apr 2022 16:46:58 +0000 (18:46 +0200)] 
perf(dracut-install): don't reallocate {src,dst}path in hmac_install()

17 months agoperf(dracut-install): don't strdup() excessively for dracut_install()
наб [Wed, 27 Apr 2022 13:14:59 +0000 (15:14 +0200)] 
perf(dracut-install): don't strdup() excessively for dracut_install()

17 months agoperf(dracut-install): stat() w/unused buf -> access(F_OK) in dracut-install
наб [Tue, 26 Apr 2022 15:23:38 +0000 (17:23 +0200)] 
perf(dracut-install): stat() w/unused buf -> access(F_OK) in dracut-install

17 months agoperf(dracut-install): multiple single-character strstr()s -> strpbrk()
наб [Tue, 26 Apr 2022 15:13:55 +0000 (17:13 +0200)] 
perf(dracut-install): multiple single-character strstr()s -> strpbrk()

17 months agochore: remove src/install/hashmap.lo
наб [Tue, 26 Apr 2022 14:34:41 +0000 (16:34 +0200)] 
chore: remove src/install/hashmap.lo

17 months agofeat(network-wicked): remove module
Laszlo Gombos [Thu, 15 Dec 2022 22:39:00 +0000 (22:39 +0000)] 
feat(network-wicked): remove module

wicked is being phased out from openSUSE
https://news.opensuse.org/2022/01/28/bash-systemd-libvirt-update-in-tw/

17 months agodocs: update NEWS.md and AUTHORS 059
Jóhann B. Guðmundsson [Sat, 24 Dec 2022 16:49:27 +0000 (16:49 +0000)] 
docs: update NEWS.md and AUTHORS

17 months agofix(NEWS.md): add missing entries
Jóhann B. Guðmundsson [Sat, 24 Dec 2022 15:53:05 +0000 (15:53 +0000)] 
fix(NEWS.md): add missing entries

I somehow managed to screw the update of news when making a release fixing my
mistake.

17 months agofix(systemd-timedated): add missing dbus-org.freedesktop.timedate1.service
Antonio Alvarez Feijoo [Thu, 22 Dec 2022 14:19:49 +0000 (15:19 +0100)] 
fix(systemd-timedated): add missing dbus-org.freedesktop.timedate1.service

Without this service, timedatectl fails to run in the initrd.

```
sh-5.2# timedatectl
Failed to query server: Could not activate remote peer: activation request failed: unknown unit.
sh-5.2# systemctl status dbus | grep timedate
Dec 22 13:57:03 sd-net-test dbus-broker-launch[219]: Activation request for 'org.freedesktop.timedate1' failed: The systemd unit 'dbus-org.freedesktop.timedate1.service' could not be found.
```

17 months agofix(systemd-hostnamed): add missing dbus-org.freedesktop.hostname1.service
Antonio Alvarez Feijoo [Thu, 22 Dec 2022 14:13:29 +0000 (15:13 +0100)] 
fix(systemd-hostnamed): add missing dbus-org.freedesktop.hostname1.service

Without this service, hostnamectl fails to run in the initrd.

```
sh-5.2# hostnamectl
Failed to query system properties: Could not activate remote peer: activation request failed: unknown unit.
sh-5.2# systemctl status dbus | grep hostname
Dec 22 11:07:56 sd-net-test dbus-broker-launch[216]: Activation request for 'org.freedesktop.hostname1' failed: The systemd unit 'dbus-org.freedesktop.hostname1.service' could not be found.
```

17 months agofix(dbus-broker): add missing sockets.target.wants/dbus.socket
Antonio Alvarez Feijoo [Thu, 22 Dec 2022 11:34:30 +0000 (12:34 +0100)] 
fix(dbus-broker): add missing sockets.target.wants/dbus.socket

If dbus.socket is not started automatically in the initrd, all binaries that
require dbus to work fail.

17 months agofix(systemd-hostnamed): correct sysusers configuration
Antonio Alvarez Feijoo [Thu, 22 Dec 2022 09:45:56 +0000 (10:45 +0100)] 
fix(systemd-hostnamed): correct sysusers configuration

Lines of type 'g' don't take a GECOS field.

17 months agotest(FULL SYSTEMD): make test 04 use the test dracut modules 2142/head
Laszlo Gombos [Sat, 26 Nov 2022 18:25:54 +0000 (18:25 +0000)] 
test(FULL SYSTEMD): make test 04 use the test dracut modules

Add test case for systemd.unit and  systemd.mask arguments
instead of extra test setup steps.

17 months agotest(FULL SYSTEMD): remove unnecessary dependencies
Laszlo Gombos [Fri, 25 Nov 2022 14:37:35 +0000 (14:37 +0000)] 
test(FULL SYSTEMD): remove unnecessary dependencies

17 months agofeat(overlayfs): add new overlayfs module to dracut.spec
Laszlo Gombos [Wed, 14 Dec 2022 20:05:48 +0000 (20:05 +0000)] 
feat(overlayfs): add new overlayfs module to dracut.spec

17 months agofix(zipl): remove trailing spaces from zipl boot device name
Antonio Alvarez Feijoo [Mon, 14 Nov 2022 15:45:48 +0000 (16:45 +0100)] 
fix(zipl): remove trailing spaces from zipl boot device name

Trailing spaces are misleading blkid input after fixes for shellcheck were
introduced in https://github.com/dracutdevs/dracut/commit/d75b029a

Test showing the wrong output:

```
localhost:~ # _boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
localhost:~ # echo "[${_boot_zipl}]"
[/dev/disk/by-path/ccw-0.0.0000-part1  ]
localhost:~ # blkid -s TYPE -o udev "${_boot_zipl}"
localhost:~ # blkid -s TYPE -o udev ${_boot_zipl}
ID_FS_TYPE=ext2
```

Also, remove duplicate code by creating a function to get the zipl boot device,
prepend $dracutsysrootdir to /etc/fstab and print cmdline properly: start
with a space and do not print a newline.

17 months agofix(lsinitrd.sh): add a missing path to image
Kenneth D'souza [Tue, 13 Dec 2022 15:26:33 +0000 (20:56 +0530)] 
fix(lsinitrd.sh): add a missing path to image

The initramfs file for Fedora/RedHat CoreOS can be found under
`/lib/modules/${KERNEL_VERSION}/initramfs.img', add this path
to image search logic.

Signed-off-by: Kenneth D'souza <kennethdsouza94@gmail.com>
17 months agofix(dracut): allow to set persistent policy based on /dev/mapper device names
Antonio Alvarez Feijoo [Wed, 7 Sep 2022 13:17:06 +0000 (15:17 +0200)] 
fix(dracut): allow to set persistent policy based on /dev/mapper device names

Currently, dracut only allows to configure the persistent policy to address
disks and partitions using any directory name found in /dev/disk, but there is
no defined way to set the default policy based on /dev/mapper device names. So,
for example, if the persistent policy is set by the distribution in any
configuration file, the user cannot set the default if he wants to.

The current workaround is to set persistent_policy="" in a conf file or pass
--persistent-policy " " (white space) as an argument. This patch aims to
establish a specific value for this case.

17 months agofix(dracut-init): make require_kernel_modules ignore no kernel build
Kairui Song [Thu, 8 Dec 2022 16:25:42 +0000 (00:25 +0800)] 
fix(dracut-init): make require_kernel_modules ignore no kernel build

If --no-kernel is specified, kernel module checking won't work, just
skip it.

Signed-off-by: Kairui Song <kasong@tencent.com>
17 months agofix(iscsi): don't install the module if kernel doesn't support iscsi
Kairui Song [Tue, 6 Dec 2022 16:06:34 +0000 (00:06 +0800)] 
fix(iscsi): don't install the module if kernel doesn't support iscsi

The cmdline hook of iscsi module will force check if iscsi_tcp module
is available, and abort the boot progress is not. But actually iscsi
module shouldn't be allowed to be installed in the first place if the
corresponding kernel doesn't support it.

So print an warning and refuse to install the iscsi dracut module
in such case, instead of dying on reboot.

Signed-off-by: Kairui Song <kasong@tencent.com>
17 months agofeat(squash): use require_kernel_modules for better module checking
Kairui Song [Tue, 6 Dec 2022 16:04:40 +0000 (00:04 +0800)] 
feat(squash): use require_kernel_modules for better module checking

require_kernel_modules prints more friendly erorr message and make the
code cleaner.

Signed-off-by: Kairui Song <kasong@tencent.com>
17 months agofeat(dracut-init.sh): introduce a new helper require_kernel_modules
Kairui Song [Tue, 6 Dec 2022 09:24:47 +0000 (17:24 +0800)] 
feat(dracut-init.sh): introduce a new helper require_kernel_modules

Some dracut modules won't work without certain kernel modules,
this helper will be helpful for checking such kernel configs in
check() and error out early.

Signed-off-by: Kairui Song <kasong@tencent.com>
17 months agofix(dracut-functions.sh): check_kernel_module should follow dracutsysrootdir
Kairui Song [Tue, 6 Dec 2022 09:20:26 +0000 (17:20 +0800)] 
fix(dracut-functions.sh): check_kernel_module should follow dracutsysrootdir

check_kernel_module calls modprobe and tries to dry-run a module load to
check if a module is available. modprobe supports `-d` to specify a
rootdir, so just pass dracutsysrootdir to it to make it work as expected
when building initramfs for another rootfs.

Signed-off-by: Kairui Song <kasong@tencent.com>
17 months agoci: there is no longer a need for special handling test 04
Laszlo Gombos [Wed, 7 Dec 2022 20:08:55 +0000 (20:08 +0000)] 
ci: there is no longer a need for special handling test 04

17 months agoci: reduce the timeout for local tests to 30 min
Laszlo Gombos [Wed, 7 Dec 2022 20:04:27 +0000 (20:04 +0000)] 
ci: reduce the timeout for local tests to 30 min

The main motivation here is to do not allow each test to grow beyond
30 min. If a longer test is needed for some reason, it should be
split into two tests.

Currently each local test is passing at 20 min.

The longest running local test is test 12: encrypted LVM PV
on a degraded RAID-5.

17 months agoci: run all local tests on all containers
Laszlo Gombos [Wed, 7 Dec 2022 19:28:13 +0000 (19:28 +0000)] 
ci: run all local tests on all containers

17 months agorefactor(dmsquash-live): move ntfs-3g code to dmsquash-live-ntfs
Laszlo Gombos [Tue, 25 Oct 2022 17:54:34 +0000 (17:54 +0000)] 
refactor(dmsquash-live): move ntfs-3g code to dmsquash-live-ntfs

Since the installation of ntfs-3g binary is in the
dmsquash-live-ntfs module, calling ntfs-3g from dmsquash-live fails
when dmsquash-live-ntfs module is not installed anyways.

17 months agofix(dracut.sh): split drivers_dir check
Antonio Alvarez Feijoo [Thu, 27 Oct 2022 15:34:41 +0000 (17:34 +0200)] 
fix(dracut.sh): split drivers_dir check

The directory where to look for kernel modules can be set via the -k/--kmoddir
command line option or the drivers_dir configuration option. Its current check
should be split into two different ones to avoid misleading error messages (see
referenced issue):
- First check that its basename matches the kernel version set for the initramfs
(via --kver or automatically set by "uname -r").
- Second check that the parent directory of the last provided directory contains
"/lib/modules/". This check was also fixed to avoid accepting other directories
like "xxxlib/modules".

Fixes issue #1608