]> git.ipfire.org Git - thirdparty/dracut.git/log
thirdparty/dracut.git
2 years agodocs: update NEWS.md and AUTHORS 056
Harald Hoyer [Fri, 18 Feb 2022 11:32:53 +0000 (12:32 +0100)] 
docs: update NEWS.md and AUTHORS

Signed-off-by: Harald Hoyer <harald@profian.com>
2 years agofix(cpio): correct dev_t -> rmajor/rminor mapping
David Disseldorp [Thu, 10 Feb 2022 19:08:11 +0000 (20:08 +0100)] 
fix(cpio): correct dev_t -> rmajor/rminor mapping

dev_t -> major/minor number mapping is more complicated than the
incorrect major=(dev_t >> 8) minor=(dev_t & 0xff) mapping that we
currently perform. Fix mapping to match Linux / glibc behaviour.

Fixes: https://github.com/dracutdevs/dracut/issues/1695
Reported-by: Ethan Wu <ethanwu10@gmail.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agoci(cpio): add test_archive_dev_maj_min
David Disseldorp [Thu, 10 Feb 2022 17:05:21 +0000 (18:05 +0100)] 
ci(cpio): add test_archive_dev_maj_min

This tests dracut-cpio's handling of rmajor / rminor values compared to
GNU cpio. The test requires root, due to mknod invocation for block
device node creation.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agoci(cpio): add TempWorkDir.create_tmp_mknod helper
David Disseldorp [Mon, 7 Feb 2022 22:04:29 +0000 (23:04 +0100)] 
ci(cpio): add TempWorkDir.create_tmp_mknod helper

This will be used for future device major/minor testing. Convert the
current fifo test to use it.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofix(dasd_rules): correct udev dasd rules parsing
Thomas Blume [Mon, 7 Feb 2022 08:56:42 +0000 (09:56 +0100)] 
fix(dasd_rules): correct udev dasd rules parsing

2 years agofix(zfcp_rules): correct udev zfcp rules parsing
Thomas Blume [Mon, 7 Feb 2022 08:58:32 +0000 (09:58 +0100)] 
fix(zfcp_rules): correct udev zfcp rules parsing

2 years agofeat(pcsc): introducing the pcsc module
Jóhann B. Guðmundsson [Sat, 1 Jan 2022 03:00:15 +0000 (03:00 +0000)] 
feat(pcsc): introducing the pcsc module

2 years agofix(bluetooth): make hostonly configuration files optional
Antonio Alvarez Feijoo [Mon, 31 Jan 2022 11:09:02 +0000 (12:09 +0100)] 
fix(bluetooth): make hostonly configuration files optional

Do not fail if any of the expected configuration files don't exist.

2 years agofix(bluetooth): dbus configuration path fixes
Jóhann B. Guðmundsson [Sat, 11 Dec 2021 22:28:45 +0000 (22:28 +0000)] 
fix(bluetooth): dbus configuration path fixes

Add a missing /usr/share path ( fixes #1627 )
Use variable instead of hard path

2 years agofix(img-lib): install rmdir
Henrik Gombos [Thu, 25 Nov 2021 23:08:57 +0000 (18:08 -0500)] 
fix(img-lib): install rmdir

rmdir is used in img-lib module.

2 years agofix(fido2): add a missing library
Jóhann B. Guðmundsson [Wed, 29 Dec 2021 00:19:09 +0000 (00:19 +0000)] 
fix(fido2): add a missing library

2 years agofix(tpm2-tss): add a missing library
Jóhann B. Guðmundsson [Wed, 29 Dec 2021 00:16:56 +0000 (00:16 +0000)] 
fix(tpm2-tss): add a missing library

2 years agofix(dracut-functions.sh): ip route parsing
Martin Wilck [Fri, 21 Jan 2022 20:25:54 +0000 (21:25 +0100)] 
fix(dracut-functions.sh): ip route parsing

The code for determining local interface and address works
only for peers that are reachable in a single hop.

This is parsed correctly:
192.168.110.1 dev br0 src 192.168.110.160 uid 0 \    cache

But this isn't:
192.168.1.4 via 192.168.110.1 dev br0 src 192.168.110.160 uid 0 \    cache

Fix it.

Fixes: ceca74cc ("dracut-functions: add ip_params_for_remote_addr() helper")
2 years agofix(fedora.conf.example): rename misspelled variable
Antonio Alvarez Feijoo [Mon, 31 Jan 2022 14:24:51 +0000 (15:24 +0100)] 
fix(fedora.conf.example): rename misspelled variable

There is a typo in the dbussystemconfdir variable.

2 years agofix(dracut): be more robust when using 'set -u'
Renaud Métrich [Thu, 6 Jan 2022 18:50:28 +0000 (19:50 +0100)] 
fix(dracut): be more robust when using 'set -u'

From bash manpage, FUNCNAME exists only inside functions. When in debug
mode, make sure to use an empty default value as FUNCNAME[0] when
outside of functions.

With bash4 this wasn't an issue, but is with bash5 with hardening option
'set -u' used, as shown in the example below:

Incorrect:

$ bash -u -c 'echo -n ${FUNCNAME[0]}'
bash: line 1: FUNCNAME[0]: unbound variable
$

Correct:

$ bash -u -c 'echo -n ${FUNCNAME[0]-}'
$

This hardening enables sourcing dracut-lib.sh from external utilities
executing in the initramfs such as clevis-luks-askpass, which uses
hardening option 'set -u' internally.
(see Clevis PR https://github.com/latchset/clevis/pull/340)

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2 years agofeat(pkcs11): include the module in the spec file
Jóhann B. Guðmundsson [Fri, 31 Dec 2021 10:32:25 +0000 (10:32 +0000)] 
feat(pkcs11): include the module in the spec file

Adding the module to the spec file

2 years agofeat(pkcs11): introducing the pkcs11 module
Jóhann B. Guðmundsson [Wed, 29 Dec 2021 13:03:16 +0000 (13:03 +0000)] 
feat(pkcs11): introducing the pkcs11 module

This module allows unlocking of an encrypted filesystem using pkcs11.

2 years agofeat(crypt): check if pkcs11 module is needed in hostonly mode
Jóhann B. Guðmundsson [Wed, 29 Dec 2021 09:55:02 +0000 (09:55 +0000)] 
feat(crypt): check if pkcs11 module is needed in hostonly mode

In hostonly mode, include the pkcs11 module if any encrypted volumes
are configured to be decrypted using pkcs11.

2 years agofix(fips): missing sourcing of dracut-lib
Antonio Alvarez Feijoo [Tue, 14 Dec 2021 11:18:07 +0000 (12:18 +0100)] 
fix(fips): missing sourcing of dracut-lib

Make sure dracut-lib is sourced inside the fips-noboot script.

2 years agofix(fips): add and remove local variables
Antonio Alvarez Feijoo [Tue, 14 Dec 2021 11:15:41 +0000 (12:15 +0100)] 
fix(fips): add and remove local variables

2 years agofix(fips): wrong error message
Antonio Alvarez Feijoo [Tue, 14 Dec 2021 11:14:41 +0000 (12:14 +0100)] 
fix(fips): wrong error message

When /dev/urandom cannot be created, the error message displays /dev/random instead.

2 years agofix(dracut-init): unbreak a comment
Lubomir Rintel [Wed, 5 Jan 2022 10:10:27 +0000 (11:10 +0100)] 
fix(dracut-init): unbreak a comment

A dreadful copy & paste or kill-ring-save & yank error, most surely.

2 years agofeat(dracut.sh): add --aggresive-strip option
Kairui Song [Fri, 7 Jan 2022 06:03:20 +0000 (14:03 +0800)] 
feat(dracut.sh): add --aggresive-strip option

Dracut currently calls `eu-strip` or `strip` with -g, which only strips
out .debug_* sections. symtab and strtab are kept, but are not required
for runtime, and people will rarely need to do binary level debugging
work in initramfs.

So introduce a --aggresive-strip options, try strip out all sections
that are not required for runtime. This can help reduce the binary size
by a lot.

For example, the size of libc.so is reduced by a lot when stripped
with no option than with -g.

    3014184 libc-2.28.orig.so
    2970920 libc-2.28.strip-g.so
    1460904 libc-2.28.strip.so

Signed-off-by: Kairui Song <kasong@tencent.com>
2 years agofix(network): wrong test of wicked unit
Antonio Alvarez Feijoo [Mon, 10 Jan 2022 10:46:41 +0000 (11:46 +0100)] 
fix(network): wrong test of wicked unit

The test for the wicked service is never met because it
does not have execute permission.

2 years agofix(dracut-initramfs-restore.sh): add missing compression options
Antonio Alvarez Feijoo [Mon, 24 Jan 2022 15:38:45 +0000 (16:38 +0100)] 
fix(dracut-initramfs-restore.sh): add missing compression options

The unpack fails if the initrd is not compressed or compressed with
bzip2 or LZO.

Fix issue #1463

2 years agofix(dracut-shutdown): add cleanup handler on failure
Renaud Métrich [Thu, 13 Jan 2022 16:35:59 +0000 (17:35 +0100)] 
fix(dracut-shutdown): add cleanup handler on failure

It may happen that dracut-shutdown.service fails, for example on timeout
due to very low bandwidth.
In such case, for hardening purposes, a new dracut-shutdown-onfailure.service
unit doing dracut-shutdown.service cleanup needs to execute to make sure
switching root to an incomplete initramfs won't occur later.

See also RHBZ #1924587 (https://bugzilla.redhat.com/show_bug.cgi?id=1924587).

2 years agofix(zfcp_rules): remove collect based udev rule creators
Thomas Blume [Fri, 14 Jan 2022 09:40:17 +0000 (10:40 +0100)] 
fix(zfcp_rules): remove collect based udev rule creators

The collect binary has been removed, so the rules are broken

2 years agofix(dasd_rules): remove collect based udev rule creators
Thomas Blume [Fri, 14 Jan 2022 09:39:30 +0000 (10:39 +0100)] 
fix(dasd_rules): remove collect based udev rule creators

The collect binary has been removed, so the rules are broken

2 years agofix(memstrack): drop bash runtime requirement
Kairui Song [Thu, 6 Jan 2022 05:39:30 +0000 (13:39 +0800)] 
fix(memstrack): drop bash runtime requirement

Use nohup instead of disown, and let systemd track the service properly.
This makes the scripts POSIX compatible and bash is no longer needed.

Signed-off-by: Kairui Song <kasong@tencent.com>
2 years agofix(kernel-modules-extra): handle zstd module extension
Dirk Müller [Thu, 23 Dec 2021 09:23:59 +0000 (10:23 +0100)] 
fix(kernel-modules-extra): handle zstd module extension

The regular expression here is trying to handle various kernel
module compression schemas and was missing the zst extension
which indicates use of zstd.

2 years agofix(kernel-modules): add mailbox drivers for arm
Adrien Thierry [Mon, 20 Dec 2021 14:41:07 +0000 (09:41 -0500)] 
fix(kernel-modules): add mailbox drivers for arm

Mailbox drivers might be needed by some of the devices used in the
initrd. For example, on the Raspberry Pi 4, the MMC 'sdhci-iproc' driver
depends on 'bcm2835-mailbox'.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2 years agofix(lvm): restore setting LVM_MD_PV_ACTIVATED
David Teigland [Fri, 17 Dec 2021 18:14:51 +0000 (12:14 -0600)] 
fix(lvm): restore setting LVM_MD_PV_ACTIVATED

The 69-dm-lvm-metad.rules udev rule has been removed from
the initrd, because it's been dropped by recent upstream
lvm versions, and it never performed any primary function
within the initrd.  But, it did have the job of setting
LVM_MD_PV_ACTIVATED=1 for active md devices used by PVs.
That step needs to be restored, and is now included in
64-lvm.rules.

2 years agofeat(lvm): only run lvchange for LV that is seen on devices
David Teigland [Fri, 10 Dec 2021 18:51:26 +0000 (12:51 -0600)] 
feat(lvm): only run lvchange for LV that is seen on devices

Change the command listing LVs from lvscan to lvs, and list
only the LV names that are being activated.  Before attempting
to activate an LV, check that that LV name appears in the
lvs command output.  This avoids wasting time running an
lvchange command that we know will fail.

2 years agofeat(lvm): use generated filter when none is set
David Teigland [Wed, 8 Dec 2021 21:16:03 +0000 (15:16 -0600)] 
feat(lvm): use generated filter when none is set

Previously, the lvm device filter generated by dracut
would not be used if any lvm.conf file existed in the
initrd.  Change this so that the generated filter will
be used when the included lvm.conf has no filter set.

2 years agofeat(lvm): update lvm command options
David Teigland [Wed, 8 Dec 2021 20:43:58 +0000 (14:43 -0600)] 
feat(lvm): update lvm command options

Drop checking for options that have been available for
at least ten years.  This simplifies code maintenance.

Add the new --nohints option (when available) to disable
the use of hints which is not useful during startup.

2 years agofix(lvm): replace --partial option
David Teigland [Wed, 8 Dec 2021 20:14:27 +0000 (14:14 -0600)] 
fix(lvm): replace --partial option

The --partial option will activate a linear (or other) LV
without segments for missing devices, which is unlikely to
be useful. The intention was to activate raid LVs in a useful
form while missing devices, which is specified with the option
--activationmode degraded.

2 years agorevert(lvm): remove 69-dm-lvm-metad.rules
David Teigland [Wed, 8 Dec 2021 20:11:13 +0000 (14:11 -0600)] 
revert(lvm): remove 69-dm-lvm-metad.rules

This udev rule runs pvscan to autoactivate VGs, which dracut
does not want to do, and previously disabled by editing the
rule file and commenting out lines.

This also stops /dev/disk/by-id/lvm-pv-uuid-* symlinks from
being created in the initrd.

2 years agorevert(lvm): remove lvmetad config changes
David Teigland [Wed, 8 Dec 2021 20:07:42 +0000 (14:07 -0600)] 
revert(lvm): remove lvmetad config changes

Remove support for modifying use_lvmetad and locking_type
settings in lvm.conf for lvm versions 2.2.*.  Recent lvm
versions (2.3.*) do not include lvmetad or locking_type.
This cleanup simplifies code maintenance.

To use the lvm module with older versions (2.2), a user
would need to ensure that lvmetad settings are disabled
in the initrd's lvm.conf rather than relying on the lvm
dracut mode to modify their lvm.conf.

2 years agorevert(lvm): remove snapshot feature
David Teigland [Wed, 8 Dec 2021 20:04:25 +0000 (14:04 -0600)] 
revert(lvm): remove snapshot feature

The feature of managing lvm snapshots has no known
recent usage.  It is unknown if it works.  The lvm
developers do not wish to maintain or support it.

2 years agofix(multipath): check if mpathconf is available
Martin Wilck [Tue, 7 Dec 2021 17:30:16 +0000 (18:30 +0100)] 
fix(multipath): check if mpathconf is available

Not all distributions utilize and ship the mpathconf utilitiy.
Avoid error messages and systemd complaints about
multipathd-configure.service in this case.

2 years agofix(multipathd.service): drop dependencies on iscsi and iscsid
Martin Wilck [Tue, 7 Dec 2021 19:55:24 +0000 (20:55 +0100)] 
fix(multipathd.service): drop dependencies on iscsi and iscsid

These dependencies are redundant and will be dropped in upstream
multipath-tools, too.

2 years agofix(multipathd.service): adapt to upstream multipath-tools unit file
Martin Wilck [Tue, 7 Dec 2021 16:59:25 +0000 (17:59 +0100)] 
fix(multipathd.service): adapt to upstream multipath-tools unit file

In the long run, it's desirable to be able to drop dracut's copy of
multipathd.service and use the upstream one from multipath-tools instead.
This patch makes a step in that direction.

With these changes, the only remaining difference is the support for
rd.multipath=0 and rd_NO_MULTIPATH, which must obviously be ignored in the
upstream unit.

The modifications in this patch are minor and will have no effect in the
initramfs.

2 years agofix(multipathd.service): remove dependency on systemd-udev-settle
Martin Wilck [Tue, 7 Dec 2021 10:43:26 +0000 (11:43 +0100)] 
fix(multipathd.service): remove dependency on systemd-udev-settle

The dependency of multipathd on "udev settle" has recently been removed in
c9689b6 ("multipathd: Remove dependency on systemd-udev-settle.service").

But this dependency has never been necessary in the initramfs environment. It
was only required after switching root, because multipathd would potentially
tear down valid multipath maps after switching from initrd to root FS. This can
happen because dm devices "survive" the root FS switch in the udev data
base (they have the "db_persist" flag set), whereas their component devices
(SCSI etc) do not. But this can only happen after initrd-udevadm-cleanup-db.service
has been run, which happens after initrd processing.

The only dependency that's really needed is that on
systemd-udevd-kernel.socket, because multipathd depends on uevents for
devices being delivered via systemd-udevd.

2 years agofix(40network): consistent use of "$gw" for gateway
Martin Wilck [Wed, 19 Jan 2022 09:37:19 +0000 (10:37 +0100)] 
fix(40network): consistent use of "$gw" for gateway

Replace wrong use of $gateway with $gw.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agofeat(spec): add systemd-integritysetup module
Tony Asleson [Tue, 19 Oct 2021 20:20:10 +0000 (15:20 -0500)] 
feat(spec): add systemd-integritysetup module

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2 years agofeat(systemd-integritysetup): introducing the systemd-integritysetup module
Tony Asleson [Tue, 19 Oct 2021 20:18:26 +0000 (15:18 -0500)] 
feat(systemd-integritysetup): introducing the systemd-integritysetup module

Module to allow root FS to be a dm-integrity volume.  Utilizes
functionality added with: https://github.com/systemd/systemd/pull/20902

Information on dm-integrity:
https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/dm-integrity.html

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2 years agofix(base): do not change the provided UUID
joshuacov1 [Fri, 26 Nov 2021 10:40:51 +0000 (05:40 -0500)] 
fix(base): do not change the provided UUID

During boot dracut parses the provided UUID to lower case and thus starts an
endless loop wating for the devise to appear. The device is actually mapped
correctly by the kernel (which doesn't tweak the UUID) but because we are
waiting for a name with lower charachters the expeted device never appers which
drops us at the emergency shell leaving the system unbootable.
This happens especially on nfts/fat filesystems because technically those don't
have a UUID but searial numbers which are used by the linux tools as UUID.

2 years agofix(dmsquash-live): option to use overlayfs on a block device root
Laszlo Gombos [Fri, 3 Dec 2021 16:48:03 +0000 (11:48 -0500)] 
fix(dmsquash-live): option to use overlayfs on a block device root

An example kernel command line option for this configuration
root=/dev/sda1 ro rd.live.image rd.live.overlay.overlayfs=1

The change checks if $FSIMG is empty and adds a symlink from
/run/rootfsbase to /run/initramfs/live and changes the place
of the creation of the required mount point directories.

2 years agofix(dracut.sh): do not ignore invalid config file or dir path
Antonio Alvarez Feijoo [Thu, 14 Oct 2021 15:10:27 +0000 (17:10 +0200)] 
fix(dracut.sh): do not ignore invalid config file or dir path

Fix issue #1136

2 years agofix(dracut-initramfs-restore.sh): add missing default paths
Jóhann B. Guðmundsson [Sun, 7 Nov 2021 14:19:15 +0000 (14:19 +0000)] 
fix(dracut-initramfs-restore.sh): add missing default paths

Adding missing default paths.
Fixes #1628

2 years agofix(network-wicked): multiple path corrections
Antonio Alvarez Feijoo [Fri, 10 Dec 2021 13:48:39 +0000 (14:48 +0100)] 
fix(network-wicked): multiple path corrections

Since wicked-0.6.67, its dbus configuration files can be installed in /etc or /usr/share.

Also, check if it's using libexec or lib instead of displaying always an error.

2 years agofix(cpio): write zeros instead of seek for padding and alignment
David Disseldorp [Fri, 3 Dec 2021 12:44:34 +0000 (13:44 +0100)] 
fix(cpio): write zeros instead of seek for padding and alignment

This is a workaround for GRUB2's Btrfs implementation, which doesn't
correctly handle gaps between extents.

A fix has already been proposed upstream via
https://lists.gnu.org/archive/html/grub-devel/2021-10/msg00206.html

Given that this bug is severe, it makes sense to include this minimal
workaround.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofix(rootfs-block): make the base module dependency explicit
Laszlo Gombos [Fri, 19 Nov 2021 02:41:23 +0000 (21:41 -0500)] 
fix(rootfs-block): make the base module dependency explicit

When dracut.sh is called with "--modules rootfs-block",
make sure dracut-lib.sh is installed by making the base module an
explicit dependency.

2 years agofix(systemd-sysusers): use split systemd sysuser configs
Cornelius Hoffmann [Tue, 30 Nov 2021 09:32:39 +0000 (10:32 +0100)] 
fix(systemd-sysusers): use split systemd sysuser configs

Fixes the regression introduced by https://github.com/systemd/systemd/pull/20056
As discussed in #1656 and #1657

2 years agofix(systemd-sysusers): override systemd-sysusers.service
Cornelius Hoffmann [Mon, 29 Nov 2021 20:47:06 +0000 (21:47 +0100)] 
fix(systemd-sysusers): override systemd-sysusers.service

Fixes a regression with systemd not running units with ConditionNeedsUpdate set in initrds

2 years agofix(url-lib): improve ca-bundle detection
Antonio Alvarez Feijoo [Thu, 2 Dec 2021 14:44:43 +0000 (15:44 +0100)] 
fix(url-lib): improve ca-bundle detection

The current detection routine for openssl-based libcurl assumes that
libcurl has its own hardcoded path to the ca-bundle. Fix the
cases where curl is compiled with:

  --with-ca-fallback --without-ca-path --without-ca-bundle

In this case, we must also grep in OpenSSLs libcrypto.

Other changes:
  - Filter reported but non-existant paths.
  - Strip nul bytes returned by grep.
  - Consider that ca-bundles might use '.pem' instead of '.crt'.

Original-patch-by: Daniel Molkentin <daniel.molkentin@suse.com>
2 years agofix(network-manager): skip non-directories in /sys/class/net
Glenn Morris [Wed, 8 Dec 2021 22:08:35 +0000 (14:08 -0800)] 
fix(network-manager): skip non-directories in /sys/class/net

There can be files in this directory, eg "bonding_masters" if a
network bond is in use.

2 years agofix(drm): add privacy screen modules to the initrd
Hans de Goede [Thu, 9 Dec 2021 15:35:11 +0000 (16:35 +0100)] 
fix(drm): add privacy screen modules to the initrd

Starting with kernel 5.17 the kernel supports the builtin privacy screens
built into the LCD panel of some new laptop models.

This means that the drm drivers will now return -EPROBE_DEFER from their
probe() method on models with a builtin privacy screen when the privacy
screen provider driver has not been loaded yet.

Make dracut add the privacy screen providing drivers to the initrd
(when necessary for hostmode=yes), so that drm drivers on affected
drivers can probe() successfully.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2 years agofix(dracut.sh): check kernel zstd support early
Martin Wilck [Fri, 19 Nov 2021 13:45:10 +0000 (14:45 +0100)] 
fix(dracut.sh): check kernel zstd support early

Rather than checking late and falling back to "cat" if the kernel
doesn't support zstd decompression, do this early, and use the
fallback code path.

2 years agofix(dracut.sh): check availability of configured compression
Martin Wilck [Fri, 19 Nov 2021 11:47:32 +0000 (12:47 +0100)] 
fix(dracut.sh): check availability of configured compression

If the configured compression command is unavailable, reset $compress,
and fall back to auto-detection. This allows building an initramfs
even if the configured compression command is not installed. This can
happen e.g. if the distribution uses a preconfigured default, but the
user deinstalled the respective tool.

2 years agofix(dracut.sh): inform user about auto-selected compression method
Martin Wilck [Fri, 19 Nov 2021 11:46:04 +0000 (12:46 +0100)] 
fix(dracut.sh): inform user about auto-selected compression method

If the compression method is unset, or had to be reset because of
missing dependencies, inform the user what's being used. Also,
replace the printf in the "cat" case with a dwarn.

2 years agofix(dracut.sh): drop pointless check for module compression method
Martin Wilck [Fri, 19 Nov 2021 11:39:30 +0000 (12:39 +0100)] 
fix(dracut.sh): drop pointless check for module compression method

There's no need to decompress the kernel modules in dracut, and
"$kcompress" is never referenced. dracut can build the initramfs
just fine if there's no tool for decompressing modules.

2 years agofix(network): add errors and warnings when network interface does not exist
Pavel Valena [Mon, 22 Nov 2021 15:40:39 +0000 (16:40 +0100)] 
fix(network): add errors and warnings when network interface does not exist

End with error, or show a warning when nonexistent device is specified for network setup like
`ip=10.12.8.12::10.12.255.254:255.255.0.0:xk12:eth0:off`.

I've added the error only for `write-ifcfg.sh`, as I think no such setup should be written.

Resolves: #1712424

2 years agoci: remove Fedora 33 container
Jóhann B. Guðmundsson [Thu, 25 Nov 2021 05:26:06 +0000 (05:26 +0000)] 
ci: remove Fedora 33 container

Fedora 33 is scheduled to reach end-of-life (EOL) on 2021-11-30.
No new dracut releases should be ending up in that Fedora release at this point.

2 years agofix(resume): resume using /usr/lib64/suspend
José María Fernández [Fri, 17 Sep 2021 21:57:08 +0000 (23:57 +0200)] 
fix(resume): resume using /usr/lib64/suspend

Now resume binary is detected in case it is at
/usr/lib64/suspend (like it happens in Gentoo).

2 years agofix(base): add default device choice
José María Fernández [Fri, 17 Sep 2021 21:53:46 +0000 (23:53 +0200)] 
fix(base): add default device choice

when the device is no one of the previous patterns,
substitute the empty default by the input,
to return the same input

2 years agofeat(crypt): check if fido2 module is needed in hostonly mode
Antonio Alvarez Feijoo [Wed, 24 Nov 2021 07:32:17 +0000 (08:32 +0100)] 
feat(crypt): check if fido2 module is needed in hostonly mode

In hostonly mode, include the fido2 module if any encrypted volumes
are configured to be decrypted using a FIDO2 security token.

2 years agofix(dracut-functions.sh): get block device driver if in a virtual subsystem
Antonio Alvarez Feijoo [Wed, 10 Nov 2021 09:19:14 +0000 (10:19 +0100)] 
fix(dracut-functions.sh): get block device driver if in a virtual subsystem

dracut does not install the kernel module of the block device that contains
the root filesystem if the following preconditions are met:
- Running in host-only mode.
- Symlinks of all block devices needed to boot the system pointing to virtual
subsystems.

The get_dev_module function uses "udevadm info -a" to get the corresponding
kernel modules of a /sys/class/*/* or /dev/* device. This function is called
in modules.d/90kernel-modules/module-setup.sh to detect if dracut must install
block device drivers in host-only mode. The symlinks in /sys/dev/block/
usually point to "real" devices in /sys/devices/pci*. But, we have come across
some NVMe systems where the kernel creates the symlinks in /sys/dev/block/
pointing to "virtual" devices instead. In this case, udevadm never finds any
"driver" attributes following up the chain of parent devices.

2 years agofix(mdraid): allow UUID comparison for more than one UUID
Alexander Wenzel [Tue, 2 Nov 2021 08:25:56 +0000 (09:25 +0100)] 
fix(mdraid): allow UUID comparison for more than one UUID

If the system provides more than one UUID, the _MD_UUID var
contains a line break after each UUID. Therefore the strstr
function could not find any UUID, caused by the additional
spaces provided to the function.

Furthermore this could lead to a boot interruption, because
the start of a degraded raid1 won't be executed. So, manual
interaction is necessary.

2 years agoci(TEST-63-DRACUT-CPIO): kernel extraction tests for dracut-cpio
David Disseldorp [Fri, 3 Sep 2021 16:16:04 +0000 (18:16 +0200)] 
ci(TEST-63-DRACUT-CPIO): kernel extraction tests for dracut-cpio

dracut-cpio already carries a bunch of unit tests covering compression
and GNU cpio extraction. The purpose of these tests is to exercise the
dracut.sh --enhanced-cpio code-paths as well as kernel cpio archive
extraction.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofeat(dracut.sh): add "--enhanced-cpio" option for calling dracut-cpio
David Disseldorp [Wed, 17 Feb 2021 00:05:37 +0000 (01:05 +0100)] 
feat(dracut.sh): add "--enhanced-cpio" option for calling dracut-cpio

The new dracut-cpio binary is capable of performing copy-on-write
optimized initramfs archive creation, but due to the rust dependency
isn't built / installed by default.
This change adds a new "--enhanced-cpio" parameter for dracut which
sees dracut-cpio called for archive creation instead of GNU cpio.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofeat(Makefile): cargo wrapper for dracut-cpio build
David Disseldorp [Tue, 1 Jun 2021 23:35:59 +0000 (01:35 +0200)] 
feat(Makefile): cargo wrapper for dracut-cpio build

If configured with --enable-dracut-cpio, call cargo to build the
dracut-cpio release binary.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofeat(cpio): add newc archive creation utility
David Disseldorp [Wed, 19 May 2021 11:46:25 +0000 (13:46 +0200)] 
feat(cpio): add newc archive creation utility

dracut-cpio is a minimal cpio archive creation utility written in Rust.
It provides support for a minimal set of features needed to create
performant and space-efficient initramfs archives:
- "newc" archive format only
- reproducible; inode numbers, uid/gid and mtime can be explicitly set
- data segment copy-on-write reflinks
  + using Rust io::copy()'s native copy_file_range() support[1]
  + optional archive data segment alignment for optimal reflink use[2]
- hardlink support
- comprehensive tests asserting GNU cpio binary output compatibility

1. Rust io::copy() copy_file_range()
   https://github.com/rust-lang/rust/pull/75272

2. Data segment alignment
   We're bending the newc spec a bit to inject zeros after the file path
   to provide data segment alignment. These zeros are accounted for in
   the namesize, but some applications may only expect a single
   zero-terminator (and 4 byte alignment). GNU cpio and Linux initramfs
   handle this fine as long as PATH_MAX isn't exceeded.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofeat(cpio): add rust argument parsing library from crosvm
David Disseldorp [Fri, 28 May 2021 23:10:11 +0000 (01:10 +0200)] 
feat(cpio): add rust argument parsing library from crosvm

Crosvm's rust argument library is very small and simple, while still
providing helpful functionality. It will be consumed by dracut-cpio in a
subsequent commit.

The unmodified, BSD licensed argument.rs source is lifted as-is from
https://chromium.googlesource.com/chromiumos/platform/crosvm
(release-R92-13982.B b6ae6517aeef9ae1e3a39c55b52f9ac6de8edb31).
The one-line crosvm.rs wrapper is needed to ensure that crosvm::argument
imports continue to work.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agoci(TEST-62-SKIPCPIO): add simple skipcpio test
David Disseldorp [Mon, 1 Mar 2021 00:51:42 +0000 (01:51 +0100)] 
ci(TEST-62-SKIPCPIO): add simple skipcpio test

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agoci(test): export basedir and testdir as absolute paths
David Disseldorp [Wed, 3 Mar 2021 18:09:07 +0000 (19:09 +0100)] 
ci(test): export basedir and testdir as absolute paths

Individual test scripts may change working directory, so relative paths
should be avoided.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agoci(TEST-60-BONDBRIDGEVLANIFCFG): use toplevel Makefile
David Disseldorp [Mon, 15 Mar 2021 12:49:18 +0000 (13:49 +0100)] 
ci(TEST-60-BONDBRIDGEVLANIFCFG): use toplevel Makefile

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofix(fips.sh): repsect rd.fips.skipkernel
Brandon Sloane [Sun, 3 Oct 2021 23:25:46 +0000 (19:25 -0400)] 
fix(fips.sh): repsect rd.fips.skipkernel

Support for this flag was broken in 4257798f8ad8570e6918ca9b819ffa254d4316ff

2 years agofix(resume): check for presence of /sys/power/resume
Dan Horák [Wed, 10 Nov 2021 11:14:15 +0000 (12:14 +0100)] 
fix(resume): check for presence of /sys/power/resume

On platforms where the kernel is built without suspend/resume support we
see "cat: /sys/power/resume: No such file or directory" message when
creating an initrd image. Check for the presence of /sys/power/resume
first before reading it.

Signed-off-by: Dan Horák <dan@danny.cz>
2 years agofix(man): default value of rd.retry was increased to 180 seconds
Alexander Wenzel [Fri, 12 Nov 2021 05:58:05 +0000 (06:58 +0100)] 
fix(man): default value of rd.retry was increased to 180 seconds

The man page still states the old value of 30 seconds,
which does not reflect the current situation of 180 seconds.

2 years agofeat(fido2): introducing the fido2 module
Antonio Alvarez Feijoo [Wed, 24 Nov 2021 07:24:07 +0000 (08:24 +0100)] 
feat(fido2): introducing the fido2 module

This module allows to unlock an encrypted filesystem using a FIDO2
security token.

2 years agofeat(crypt): check if tpm2-tss module is needed in hostonly mode
Antonio Alvarez Feijoo [Tue, 23 Nov 2021 13:53:18 +0000 (14:53 +0100)] 
feat(crypt): check if tpm2-tss module is needed in hostonly mode

In hostonly mode, include the tpm2-tss module if any encrypted volumes
are configured to be decrypted using the TPM2 device.

2 years agofix(dmsquash-live): do not install systemd files when systemd is not enabled
Laszlo Gombos [Fri, 19 Nov 2021 17:45:20 +0000 (12:45 -0500)] 
fix(dmsquash-live): do not install systemd files when systemd is not enabled

Systemd is an optional module for the dmsquash-live module. This scenario
is properly handled for other modules (for example livenet module) but not
for dmsquash-live module.

2 years agofix(s390_rules): drop collect installation
Thomas Blume [Fri, 23 Oct 2020 15:43:00 +0000 (17:43 +0200)] 
fix(s390_rules): drop collect installation

/usr/lib/udev/collect has been removed from udev-v246, so remove it
from the initrd too

2 years agofix(dmsquash-live-ntfs): fuse3 no longer requires ulockmgr_server
Laszlo Gombos [Fri, 19 Nov 2021 20:32:27 +0000 (15:32 -0500)] 
fix(dmsquash-live-ntfs): fuse3 no longer requires ulockmgr_server

fuse3 no longer includes ulockmgr_server.
https://github.com/libfuse/libfuse/blob/master/ChangeLog.rst#libfuse-300-2016-12-08

2 years agofix(shutdown): be robust against forced shutdown
Renaud Métrich [Tue, 16 Nov 2021 10:15:52 +0000 (11:15 +0100)] 
fix(shutdown): be robust against forced shutdown

When a forced shutdown is issued through sending a burst of Ctrl-Alt-Del
keys, systemd sends SIGTERM to all processes. This ends up killing
dracut-initramfs-restore as well, preventing the script from detecting
that the unpack of the initramfs is incomplete, which later causes a
crash to happen when "shutdown" tries to execute from the unpacked
initramfs.

This fix makes sure dracut-initramfs-restore remains alive to detect
the unpack failed (because cpio was killed by systemd too).

Refs:
 * https://bugzilla.redhat.com/show_bug.cgi?id=2023665

2 years agotest: don't use `-cpu max` in GH Actions
Frantisek Sumsal [Fri, 12 Nov 2021 20:43:12 +0000 (21:43 +0100)] 
test: don't use `-cpu max` in GH Actions

There appears to be an issue with newer QEMU versions (spotted with Arch
Linux and C9S containers) which causes the respective GH Action to hang
when booting a QEMU VM in combination with the `-cpu max` parameter.

During (a particularly painful) debugging session I once managed to get
some output from such "frozen" machine (using `earlycon` and
`earlyprintk` kernel cmdline options), and in that particular case the
VM died with a trap caused by an invalid opcode.

I couldn't reproduce this locally, only in GH Actions environment with
Arch Linux and C9S containers. Also, so far I haven't found out which
specific CPUID flag causes this, but using the `IvyBridge-v2` feature
set seems to mitigate the issue.

2 years agofix(install): segfault on popen error
Andrey Sokolov [Thu, 21 Oct 2021 06:01:07 +0000 (09:01 +0300)] 
fix(install): segfault on popen error

2 years agofix(90kernel-modules): add isp1760 USB controller
Peter Robinson [Sat, 16 Oct 2021 09:41:24 +0000 (10:41 +0100)] 
fix(90kernel-modules): add isp1760 USB controller

Like the dwc/chipidea controllers the isp1760 can act in either
host or gadget mode so it ends up in it's own directory. Add this
driver into the initrd as it's part of some arm platforms and
is needed to be able to boot off USB storage.

Fixes issue #1619

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2 years agofix(network-manager): disable tty output if the console is not usable
Beniamino Galvani [Mon, 27 Sep 2021 11:25:55 +0000 (13:25 +0200)] 
fix(network-manager): disable tty output if the console is not usable

The network-manager module also writes logs to the console, so that it's easier
to debug network-related boot issues. If systemd can't open the console, the
service fails and network doesn't get configured.

Add a check to disable tty output when the console is not present or not
usable.

https://github.com/coreos/fedora-coreos-tracker/issues/943

2 years agofix(network-manager): show output on console only with rd.debug enabled
Beniamino Galvani [Mon, 27 Sep 2021 11:08:34 +0000 (13:08 +0200)] 
fix(network-manager): show output on console only with rd.debug enabled

The module should show the output on console only when initrd debugging is
enabled.

2 years agochore: change my email address
Harald Hoyer [Tue, 12 Oct 2021 13:43:04 +0000 (15:43 +0200)] 
chore: change my email address

Signed-off-by: Harald Hoyer <harald@profian.com>
2 years agofeat(systemd): enable support for systemd compiled with ASAN
Renaud Métrich [Tue, 14 Sep 2021 12:50:14 +0000 (14:50 +0200)] 
feat(systemd): enable support for systemd compiled with ASAN

When systemd is compiled with ASAN library to troubleshoot memory issues
within systemd code, the libasan library expects to have /proc be
available as soon as systemd starts, which isn't the case currently,
causing an assertion to fail, systemd to crash and kernel to panic:

==1==AddressSanitizer CHECK failed: ../../../../libsanitizer/sanitizer_common/sanitizer_procmaps_common.cc:75 "((data_.proc_self_maps.len)) > ((0))" (0x0, 0x0)
    <empty stack>

X.XXXXXXX Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[...]

2 years agorefactor(install): use check_hashmap helper consistently
David Disseldorp [Wed, 22 Sep 2021 20:40:17 +0000 (22:40 +0200)] 
refactor(install): use check_hashmap helper consistently

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofix(90kernel-modules): add Type-C USB drivers for generic initrd
Peter Robinson [Wed, 6 Oct 2021 10:05:49 +0000 (11:05 +0100)] 
fix(90kernel-modules): add Type-C USB drivers for generic initrd

We need to pull in Type-C USB drivers as they can provide a number of
differnet bits of functionality in early boot including input, display
(altmode DP) and storage so we need to have them available to ensure
functionality attached to those buses/interfaces are available in early
boot.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2 years agofix(dmsquash-live): iso-scan requires rmdir
Laszlo Gombos [Mon, 4 Oct 2021 00:53:48 +0000 (20:53 -0400)] 
fix(dmsquash-live): iso-scan requires rmdir

2 years agofix(dmsquash-live): correct regression introduced with shellcheck changes
Harald Hoyer [Fri, 6 Aug 2021 13:13:32 +0000 (15:13 +0200)] 
fix(dmsquash-live): correct regression introduced with shellcheck changes

`"$opt"` with empty `opt` will give errors for `losetup`.

https://github.com/dracutdevs/dracut/issues/1576

Rename the variable and set the arguments dynamically, if the variable
is set.

2 years agochore(.gitignore): update src and man paths
David Disseldorp [Fri, 27 Aug 2021 15:27:53 +0000 (17:27 +0200)] 
chore(.gitignore): update src and man paths

.gitignore wasn't updated when things were shuffled under src and man
subdirectories.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2 years agofix(multipath): drop ExecStop= setting from service unit
Luca BRUNO [Thu, 23 Sep 2021 09:05:44 +0000 (09:05 +0000)] 
fix(multipath): drop ExecStop= setting from service unit

This removes the 'ExecStop=' field from `multipathd.service`.
Sometimes CI runs do encounter a failure related to this
service in initrd, which seems to be stemming from a socket
I/O race between the client and the server on shutdown.
It looks like the client (`multipathd shutdown`) can lose the race,
hit an I/O error, and cause the whole unit to fail (even if the server
managed to shutdown properly already).

Notably, the upstream unit does not have such stop command
as the daemon can already perform a graceful exit through
its signal handler.

As such, this commit partially re-aligns the two units,
trying to sidestep any of the existing races.

Refs:
 * https://github.com/coreos/fedora-coreos-tracker/issues/803
 * https://github.com/opensvc/multipath-tools/blob/0.8.7/multipathd/multipathd.service

2 years agofix(install): extend hwcaps library handling to libraries under glibc-hwcaps/
David Tardon [Mon, 30 Aug 2021 08:02:22 +0000 (10:02 +0200)] 
fix(install): extend hwcaps library handling to libraries under glibc-hwcaps/