Commit Graph

6241 Commits (35822f39970b369301e0ff54436d5714dd996896)

Author SHA1 Message Date
Kairui Song 35822f3997 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>
2022-02-02 22:51:54 +00:00
Dirk Müller b3d2dcb71e 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.
2022-02-02 22:50:41 +00:00
Adrien Thierry 0e80ff72e0 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>
2022-02-02 22:48:59 +00:00
David Teigland 164e5ebb11 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.
2022-02-02 22:48:13 +00:00
David Teigland 1af4674319 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.
2022-02-02 22:48:13 +00:00
David Teigland 7ffc5e388b 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.
2022-02-02 22:48:13 +00:00
David Teigland c0a54f2993 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.
2022-02-02 22:48:13 +00:00
David Teigland 97543cca48 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.
2022-02-02 22:48:13 +00:00
David Teigland 50e7466843 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.
2022-02-02 22:48:13 +00:00
David Teigland f6f393f550 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.
2022-02-02 22:48:13 +00:00
David Teigland 1549d5e898 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.
2022-02-02 22:48:13 +00:00
Martin Wilck 4318533e14 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.
2022-02-02 22:47:25 +00:00
Martin Wilck 6246da400f fix(multipathd.service): drop dependencies on iscsi and iscsid
These dependencies are redundant and will be dropped in upstream
multipath-tools, too.
2022-02-02 22:47:25 +00:00
Martin Wilck a247d2bc0d 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.
2022-02-02 22:47:25 +00:00
Martin Wilck 371b338a5f 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.
2022-02-02 22:47:25 +00:00
Martin Wilck 3f2c76bb14 fix(40network): consistent use of "$gw" for gateway
Replace wrong use of $gateway with $gw.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2022-02-02 22:40:07 +00:00
Tony Asleson fe8df0240a feat(spec): add systemd-integritysetup module
Signed-off-by: Tony Asleson <tasleson@redhat.com>
2022-01-14 14:17:18 +00:00
Tony Asleson 33cf47a608 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>
2022-01-14 14:17:18 +00:00
joshuacov1 4e85874108 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.
2022-01-09 18:23:11 +00:00
Laszlo Gombos 813577e2ba 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.
2021-12-11 11:05:02 -05:00
Antonio Alvarez Feijoo 7de9ffc057 fix(dracut.sh): do not ignore invalid config file or dir path
Fix issue #1136
2021-12-11 15:58:50 +00:00
Jóhann B. Guðmundsson 3d8e1ad2ae fix(dracut-initramfs-restore.sh): add missing default paths
Adding missing default paths.
Fixes #1628
2021-12-11 10:58:18 -05:00
Antonio Alvarez Feijoo d3b5bc17eb 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.
2021-12-11 14:32:49 +00:00
David Disseldorp 0af11c5ea5 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>
2021-12-10 08:06:40 -05:00
Laszlo Gombos 3326e4c957 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.
2021-12-10 08:01:02 -05:00
Cornelius Hoffmann fec93bb221 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
2021-12-10 12:59:09 +00:00
Cornelius Hoffmann dcbe23c14d fix(systemd-sysusers): override systemd-sysusers.service
Fixes a regression with systemd not running units with ConditionNeedsUpdate set in initrds
2021-12-10 12:58:35 +00:00
Antonio Alvarez Feijoo e3bb1815bb 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>
2021-12-10 12:56:14 +00:00
Glenn Morris d9c3c77437 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.
2021-12-10 12:54:32 +00:00
Hans de Goede 14d97a6a28 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>
2021-12-10 12:40:17 +00:00
Martin Wilck 475497b1bd 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.
2021-11-26 17:01:45 +00:00
Martin Wilck bdac657bf6 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.
2021-11-26 17:01:45 +00:00
Martin Wilck 06d47ded67 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.
2021-11-26 17:01:45 +00:00
Martin Wilck 586d3e7664 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.
2021-11-26 17:01:45 +00:00
Pavel Valena 7938935267 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
2021-11-25 08:58:37 +00:00
Jóhann B. Guðmundsson 5b18b06c7d 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.
2021-11-25 09:23:58 +01:00
José María Fernández c459373448 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).
2021-11-24 12:17:27 +00:00
José María Fernández e8c18c9f7f 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
2021-11-24 12:17:27 +00:00
Antonio Alvarez Feijoo d5fd030cc2 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.
2021-11-24 12:15:42 +00:00
Antonio Alvarez Feijoo dc3b976f33 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.
2021-11-24 11:15:25 +01:00
Alexander Wenzel d364ce8334 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.
2021-11-24 11:15:11 +01:00
David Disseldorp 8104bf0e83 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>
2021-11-24 11:14:54 +01:00
David Disseldorp afe4a6dbb7 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>
2021-11-24 11:14:54 +01:00
David Disseldorp 51d21c6b37 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>
2021-11-24 11:14:54 +01:00
David Disseldorp a9c6704643 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>
2021-11-24 11:14:54 +01:00
David Disseldorp 94fc50262f 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>
2021-11-24 11:14:54 +01:00
David Disseldorp 3a0f423309 ci(TEST-62-SKIPCPIO): add simple skipcpio test
Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
David Disseldorp 86bba3d4d4 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>
2021-11-24 11:14:54 +01:00
David Disseldorp 1c3f79fb0a ci(TEST-60-BONDBRIDGEVLANIFCFG): use toplevel Makefile
Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
Brandon Sloane 5789abcbe0 fix(fips.sh): repsect rd.fips.skipkernel
Support for this flag was broken in 4257798f8a
2021-11-24 11:14:39 +01:00