]> git.ipfire.org Git - thirdparty/dracut.git/log
thirdparty/dracut.git
3 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>
3 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>
3 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>
3 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

3 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>
3 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.

3 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.

3 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.

3 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.

3 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

3 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

3 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

3 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.

3 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

3 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>
3 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

3 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.

3 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>
3 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
[...]

3 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>
3 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>
3 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

3 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.

3 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>
3 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

3 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/

3 years agofeat(dracut.sh): check if target kernel has zstd support compiled in
Antonio Alvarez Feijoo [Fri, 10 Sep 2021 11:45:46 +0000 (13:45 +0200)] 
feat(dracut.sh): check if target kernel has zstd support compiled in

If compression option is zstd, check if target kernel supports it.
Otherwise, do not compress the initramfs image.

3 years agoci(suse.conf.example): change default compression option for SUSE
Antonio Alvarez Feijoo [Fri, 10 Sep 2021 10:47:40 +0000 (12:47 +0200)] 
ci(suse.conf.example): change default compression option for SUSE

Due to an internal company decision, SUSE aims to change the default compression
method of the initramfs image to zstd.

3 years agofix(dracut.sh): change misspelled variable name
Antonio Alvarez Feijoo [Thu, 9 Sep 2021 09:34:18 +0000 (11:34 +0200)] 
fix(dracut.sh): change misspelled variable name

3 years agofix(dracut.sh): remove wrong $ in loop sequence
Antonio Alvarez Feijoo [Wed, 8 Sep 2021 12:02:01 +0000 (14:02 +0200)] 
fix(dracut.sh): remove wrong $ in loop sequence

3 years agofix(skipcpio): calculate and use CPIO_MAGIC_LEN
Shreenidhi Shedi [Wed, 25 Aug 2021 09:38:40 +0000 (15:08 +0530)] 
fix(skipcpio): calculate and use CPIO_MAGIC_LEN

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
3 years agofix(skipcpio): improve error checking
Shreenidhi Shedi [Sun, 8 Aug 2021 07:03:40 +0000 (12:33 +0530)] 
fix(skipcpio): improve error checking

Some other minor tweaks

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
3 years agofix(base): tr needs to be installed
Andre Russ [Tue, 24 Aug 2021 21:38:41 +0000 (21:38 +0000)] 
fix(base): tr needs to be installed

3 years agofix(crypt-gpg): tr needs to be installed
Andre Russ [Tue, 24 Aug 2021 21:38:14 +0000 (21:38 +0000)] 
fix(crypt-gpg): tr needs to be installed

3 years agofix(nvmf): validate_ip_conn
Charles Rose [Mon, 23 Aug 2021 14:14:16 +0000 (09:14 -0500)] 
fix(nvmf): validate_ip_conn

Fix how ifname for a given local_address is found.
Fix logic to detect presence of ifname and route.

Signed-off-by: Charles Rose <charles.rose@dell.com>
4 years agofix(usrmount): do not empty _dev variable
Alexander Tsoy [Mon, 16 Aug 2021 15:54:34 +0000 (18:54 +0300)] 
fix(usrmount): do not empty _dev variable

Currently $_dev is always overridden with the value returned by
label_uuid_to_dev(). This results in an empty value if $_dev is a
device path. Fix this by calling label_uuid_to_dev() conditionally.

Bug: https://bugs.gentoo.org/807971
Fixes: d3532978de04c78f53664dad7b37705a49a7ee54
4 years agofix(iscsi): add support for the new iscsiadm "no-wait" (-W) command
Thomas Blume [Thu, 1 Jul 2021 08:36:09 +0000 (10:36 +0200)] 
fix(iscsi): add support for the new iscsiadm "no-wait" (-W) command

remove connection timeout for iscsi firmware targets serving system root

4 years agofix(kernel-modules): detect block device's hardware driver
Pingfan Liu [Wed, 28 Jul 2021 10:13:43 +0000 (18:13 +0800)] 
fix(kernel-modules): detect block device's hardware driver

On hostonly mode, the platform driver is not copied blindless. There
should be a way to detect the real hardware driver, which probes a block
device.

/sys/dev/block/major:minor is a symbol link, which points to the real
device, recording the hardware stack. And those info can help to
identify the associated drivers for the hardware stack.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
v2 -> v3:
  address shellcheck in dracut-functions.sh
v1 -> v2:
  remove local variable _extra_mod
  shorten subject

4 years agofix(kernel-modules): add blk_mq_alloc_disk and blk_cleanup_disk to blockfuncs
Lukas Nykryn [Thu, 12 Aug 2021 09:46:35 +0000 (11:46 +0200)] 
fix(kernel-modules): add blk_mq_alloc_disk and blk_cleanup_disk to blockfuncs

Since kernel 5-14 those are used by many drivers for example:
xen-blkfront, loop, nbd, pd

4 years agofix(network-manager): write DHCP filename option to dhcpopts file
Beniamino Galvani [Mon, 9 Aug 2021 07:01:32 +0000 (09:01 +0200)] 
fix(network-manager): write DHCP filename option to dhcpopts file

Anaconda parses the 'filename' variable [1] set in /tmp/net.$netif.dhcpopts to
determine the name of the kickstart file to use.

[1] https://github.com/rhinstaller/anaconda/blob/anaconda-35.21-1/dracut/fetch-kickstart-net.sh#L31-L34

4 years agofix(install): use size_t to avoid -Wsign-compare warning
Shreenidhi Shedi [Mon, 9 Aug 2021 04:58:06 +0000 (10:28 +0530)] 
fix(install): use size_t to avoid -Wsign-compare warning

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
4 years agofix(install): improve gettid definition
Shreenidhi Shedi [Mon, 9 Aug 2021 04:55:35 +0000 (10:25 +0530)] 
fix(install): improve gettid definition

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
4 years agofix(install): validate return values log.c
Shreenidhi Shedi [Sun, 8 Aug 2021 18:56:23 +0000 (00:26 +0530)] 
fix(install): validate return values log.c

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
4 years agofix(install): rectify unused function args in log.c
Shreenidhi Shedi [Sun, 8 Aug 2021 18:51:10 +0000 (00:21 +0530)] 
fix(install): rectify unused function args in log.c

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
4 years agofix(install): use wrapper for asprintf
Shreenidhi Shedi [Sun, 8 Aug 2021 18:23:13 +0000 (23:53 +0530)] 
fix(install): use wrapper for asprintf

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
4 years agofix(squash): apply FIPS and libpthread workaround
Kairui Song [Mon, 9 Aug 2021 10:23:43 +0000 (18:23 +0800)] 
fix(squash): apply FIPS and libpthread workaround

There are some workarounds in dracut.sh for FIPS/libpthread covering
some hidden lib dependency issues. These workarounds didn't take effect
for the squash loader since the squash loader is installed
independently. So apply these workarounds again.

Also skip the lib detection code, since these extra installed libs
are small, and squash loader contents are dropped after switch root,
won't be an issue to be always installed. And this makes the code
cleaner.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agofix(cms): reload NetworkManager connections
Beniamino Galvani [Wed, 4 Aug 2021 07:37:31 +0000 (09:37 +0200)] 
fix(cms): reload NetworkManager connections

When NetworkManager is running as systemd service, it's not enough to write
connection files; the module should also tell NetworkManager to reload the
connections from disk so that any new connection can be auto-activated.

https://bugzilla.redhat.com/show_bug.cgi?id=1975929

4 years agofix(network-manager): check for nm-initrd-generator in both /usr/{libexec,lib}
Beniamino Galvani [Mon, 9 Aug 2021 07:28:46 +0000 (09:28 +0200)] 
fix(network-manager): check for nm-initrd-generator in both /usr/{libexec,lib}

Sice commit 22d6863ef1b2 ("fix(network-manager): cope with distributions not
using `libexec`") nm-initrd-generator can be installed in either /usr/libexec
or /usr/lib. Change other modules to check for the binary in both locations.

4 years agofix(install): use unsigned int instead of unsigned
Shreenidhi Shedi [Mon, 19 Jul 2021 16:00:06 +0000 (21:30 +0530)] 
fix(install): use unsigned int instead of unsigned

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
4 years agofix(install): reduce cppcheck warnings
Shreenidhi Shedi [Mon, 19 Jul 2021 15:57:41 +0000 (21:27 +0530)] 
fix(install): reduce cppcheck warnings

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
4 years agofix(network-manager): ensure safe content of /tmp/dhclient."$ifname".dhcpopts
Thomas Haller [Tue, 27 Jul 2021 14:04:58 +0000 (16:04 +0200)] 
fix(network-manager): ensure safe content of /tmp/dhclient."$ifname".dhcpopts

NetworkManager leaves state files behind in "/run/NetworkManager/devices".
These files are in keyfile format (glib's GKeyFile API [1]).

From the statefile, the dracut module writes a .dhcpopts file. And other users
want to parse that file, for example anaconda ([2]). To be fair,
anaconda seems to parse a different file, so I am a bit confused who
uses this file how. In any case, it seems somebody might be tempted to
execute this as a script.

We need to write the .dhcpopts file in a format that is defined and easy
to handle from a shell script. As already previously, this format is
a bash script that sets certain variables. That means, to load the file,
the user could execute it as bash script. But this is dangerous, as the
file contains potentially untrusted data from the network.
Optimally, users still don't trust the .dhcpopts file to be safe for
executing! It would be better if users too try to parse the file
instead of executing it. That is not trivial however because in face
of special characters, as we use bash's `printf '%q'` to escape the values
and parsing bash escaping is not trivial.

Anyway, make sure we properly quote and handle the content so that also
executing is safe. In the best case, there are no special characters
that require escaping, and naive parsing can be done with `sed`.
Otherwise, executing is now also supposed to be safe.

In this case we parse DHCP options from the state file. They are themselves
backslash escaped UTF-8 strings (C escape sequences), which then are stored
via keyfile API. The properly parse them, we would first need to load the file
with GKeyFile (which undoes one level of backslash escaping) and then
use g_str_compress() (to undo the second level). We mimic that with
shell.

[1] https://github.com/rhinstaller/anaconda/blob/b3411d6780aa0d76ee1e81a38710ec05a2d1978b/dracut/fetch-kickstart-net.sh#L30
[2] https://developer.gnome.org/glib/stable/glib-Key-value-file-parser.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
4 years agodocs: add a note about other network modules in 'man dracut.cmdline'
Beniamino Galvani [Thu, 8 Jul 2021 09:16:46 +0000 (11:16 +0200)] 
docs: add a note about other network modules in 'man dracut.cmdline'

4 years agofix(integrity): add support for loading multiple EVM x509 certs
Stefan Berger [Fri, 18 Jun 2021 17:26:29 +0000 (13:26 -0400)] 
fix(integrity): add support for loading multiple EVM x509 certs

Add support for loading EVM x509 certs from a directory that the user can
specify with the EVMKEYSDIR variable in the evm config file. By default
the additional certs are loaded from /etc/keys/evm.

Support for multiple EVM keys allows the usage in a system of files with
signed metadata from multiple parties.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
4 years agofix(base): do not quote $initargs for switch_root
Mike Gilbert [Fri, 23 Jul 2021 18:35:07 +0000 (14:35 -0400)] 
fix(base): do not quote $initargs for switch_root

We want word splitting to occur so that the arguments are passed
separately, and we don't end up passing an empty string if no arguments
are specified.

Bug: https://bugs.gentoo.org/803548
Fixes: 2fabaaa62dcfd31e593ca45e1374e55adae29d6b
4 years agofix(squash): remove tailing '/' when installing ld.so.conf.d
Kairui Song [Fri, 30 Jul 2021 13:54:11 +0000 (21:54 +0800)] 
fix(squash): remove tailing '/' when installing ld.so.conf.d

This tailing '/' will result in following error:

dracut-install: ERROR: installing '/etc/ld.so.conf.d/'
dracut: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.kEFQLs/initramfs -d /etc/ld.so.conf.d/

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agofix(network-manager): include nm-daemon-helper binary
Beniamino Galvani [Tue, 3 Aug 2021 14:10:14 +0000 (16:10 +0200)] 
fix(network-manager): include nm-daemon-helper binary

Since version 1.32, NetworkManager launches a tiny external helper to determine
the hostname via reverse DNS resolution through glibc's nss-dns. Include the
binary.

4 years agofix(base): repair installing dracut-util
Zoltán Böszörményi [Wed, 14 Jul 2021 12:29:55 +0000 (14:29 +0200)] 
fix(base): repair installing dracut-util

inst_binary uses ${dracutsysrootdir} internally to find the source
file.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
4 years agofix(kernel-modules): add more modules on RISC-V
Andreas Schwab [Sat, 12 Jun 2021 14:09:00 +0000 (16:09 +0200)] 
fix(kernel-modules): add more modules on RISC-V

Include the same extra modules for ARM also on RISC-V and add drivers/mmc/host
and drivers/spi to the list.

4 years agofix(dracut-systemd): do not use Requires for vconsole-setup.service
Zbigniew Jędrzejewski-Szmek [Tue, 20 Jul 2021 10:18:27 +0000 (12:18 +0200)] 
fix(dracut-systemd): do not use Requires for vconsole-setup.service

systemd-vconsole-setup.service may fail if the user specifies a missing keymap,
see [1,2,3], or font. This is unfortunate, but the system should not refuse
boot. It is better to continue, possible without the desired font or keymap.
All other systemd services that depend on systemd-vconsole-setup.service do so
without a hard Requires=.

(In particular, systemd-vconsole-setup internally will try to do as much setup
as possible, and will load the font even if it cannot load the keymap and vice
versa.)

[1] https://fedoraproject.org/wiki/Common_F34_bugs#kbd-legacy-media
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1955162
[3] https://bugzilla.redhat.com/show_bug.cgi?id=1955793

4 years agofix(squash): keep ld cache under initdir
Pingfan Liu [Fri, 9 Jul 2021 03:55:16 +0000 (11:55 +0800)] 
fix(squash): keep ld cache under initdir

When running kdump on PowerPC, the following bug is hit:
[    0.391629] Freeing unused kernel memory: 5568K
[    0.391634] This architecture does not have kernel memory protection.
/bin/sh: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[    0.392214] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
[    0.392214]
[    0.392223] CPU: 6 PID: 1 Comm: init Not tainted 4.18.0-319.el8.ppc64le #1
[    0.392228] Call Trace:
[    0.392234] [c00000000c703c10] [c000000008ecb94c] dump_stack+0xb0/0xf4 (unreliable)
[    0.392243] [c00000000c703c50] [c000000008167324] panic+0x148/0x3c4
[    0.392249] [c00000000c703cf0] [c000000008170474] do_exit+0xcd4/0xd40
[    0.392255] [c00000000c703dc0] [c0000000081705b0] do_group_exit+0x60/0x110
[    0.392261] [c00000000c703e00] [c000000008170684] sys_exit_group+0x24/0x30
[    0.392268] [c00000000c703e20] [c00000000800b408] system_call+0x5c/0x70

This is due to the non-conventional library path:
ldd /bin/bash
        linux-vdso64.so.1 (0x00007fffbdc90000)
        libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fffbda80000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fffbda50000)
        libc.so.6 => /lib64/glibc-hwcaps/power9/libc-2.28.so (0x00007fffbd830000)
                            ^^^
        /lib64/ld64.so.2 (0x00007fffbdcb0000)

ldd finds the path by libc.so.6 -> /usr/lib64/libc.so.6 ->
/usr/lib64/glibc-hwcaps/power9/libc-2.28.so and cache the result. So
when dracut_install, it only saw
'/usr/lib64/glibc-hwcaps/power9/libc-2.28.so' and blind to
'/usr/lib64/libc.so.6'

In the final kdumpimg, the symlink /usr/lib64/libc.so.6 is not created,
hence ld.so can not find the /usr/lib64/glibc-hwcaps/power9/libc-2.28.so

On the other hand, during the process of building kdumpimg, all of dynamic library info
have been cached in ld.so.cache. Hence this bug can be simplely resolved
by keeping ld cache under $initdir/etc.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
v3 -> v4:
  use inst() instead of copy
v2 -> v3:
  fix format by shfmt -s -w modules.d/99squash/module-setup.sh
v1 -> v2:
  cp -r /etc/ld.so* instead of move, since after switch-root, initdir
can not be seen any longer

4 years agofix(dracut-install): tweaks to get_real_file()
Zoltán Böszörményi [Sun, 18 Jul 2021 08:28:37 +0000 (10:28 +0200)] 
fix(dracut-install): tweaks to get_real_file()

Fix potential memory leaks in two locations and use
_exit(EXIT_FAILURE) if asprintf(&abspath, ...) fails.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
4 years agofix(qeth_rules): check the existence of /sys/devices/qeth/*/online beforehand
Coiby Xu [Wed, 14 Jul 2021 07:26:10 +0000 (15:26 +0800)] 
fix(qeth_rules): check the existence of /sys/devices/qeth/*/online beforehand

On s390x KVM machines, the follow errors occurred,
    $ kdumpctl rebuild
    kdump: Rebuilding /boot/initramfs-4.18.0-321.el8.s390xkdump.img
    /usr/lib/dracut/modules.d/95qeth_rules/module-setup.sh: line 13: /sys/devices/qeth/*/online: No such file or directory
    /usr/lib/dracut/modules.d/95qeth_rules/module-setup.sh: line 13: /sys/devices/qeth/*/online: No such file or directory

because s390x KVM uses virtual devices and /sys/devices/qeth/*/online
doesn't exist. Eliminate this error by checking the existence
beforehand.

4 years agofix(network-manager): don't pull in systemd-udev-settle
Dusty Mabe [Tue, 29 Jun 2021 19:11:00 +0000 (15:11 -0400)] 
fix(network-manager): don't pull in systemd-udev-settle

We get a nice warning about it being deprecated:

```
systemd-udev-settle.service is deprecated. Please fix nm-initrd.service not to pull it in.
```

The service is deprecated because its purpose was to wait for the
discovery of all hardware, but it didn't guarantee that (see the
systemd-udev-settle man page).

NM now runs as an independent service and can deal with devices showing
up at any point, but it does need udev to be started. For now just
Want/After systemd-udev-trigger.

4 years agofix: SC2046: Quote this to prevent word splitting
Masahiro Matsuya [Tue, 29 Jun 2021 09:09:57 +0000 (18:09 +0900)] 
fix: SC2046: Quote this to prevent word splitting

4 years agofix: SC2086: Double quote to prevent globbing and word splitting
Masahiro Matsuya [Mon, 14 Jun 2021 00:04:03 +0000 (09:04 +0900)] 
fix: SC2086: Double quote to prevent globbing and word splitting

4 years agofix(url-lib): make pre-pivot hook separetely per nfs mount
Masahiro Matsuya [Fri, 11 Jun 2021 01:40:04 +0000 (10:40 +0900)] 
fix(url-lib): make pre-pivot hook separetely per nfs mount

4 years agofix(mksh): requires printf
Tomasz Paweł Gajc [Fri, 11 Jun 2021 10:11:17 +0000 (12:11 +0200)] 
fix(mksh): requires printf

4 years agofix(crypt-gpg): execute --card-status on each try
LinkTed [Mon, 21 Jun 2021 17:15:01 +0000 (19:15 +0200)] 
fix(crypt-gpg): execute --card-status on each try

If the gpg card is not inserted before the --card-status command is
executed then the public key is not linked with the card. Therefore,
the LUKS partition cannot be decrypted. To solve this, the
--card--status command is executed on each try.

4 years agofix(dracut.sh): handle symlinks appropriately while using '-i' option
Kairui Song [Fri, 11 Jun 2021 18:25:09 +0000 (02:25 +0800)] 
fix(dracut.sh): handle symlinks appropriately while using '-i' option

[[ -d $symlink ]] will return true if the symlink points to a directory.
So the symlink will not be copied, instead a directory is created with
the symlink name and the content is copied.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agofix(dracut.sh): handle '-i' option to include files beginning with '.'
Hari Bathini [Fri, 11 Jun 2021 09:50:28 +0000 (15:20 +0530)] 
fix(dracut.sh): handle '-i' option to include files beginning with '.'

While including a directory using '--include' option, the file and
subdirectory names that begin with '.' are not included. Also, dracut
throws a warning message when a subdirectory is empty or only has
files or subdirectories that begin with '.'.

For example, while trying to include /tmpdata directory with the
below tree:

  # tree -a /tmpdata
  /tmpdata
  ├── .anothertestdir
  ├── testdir
  │   └── .testsubdir
  └── .testfile

dracut throws the below warning message:

  # dracut --include /tmpdata /root
  cp: cannot stat '/tmpdata/testdir/*': No such file or directory
  #

and this is how the included /tmpdata directory tree looks:

  # tree -a root
  root
  └── testdir

No file or directory beginning with '.' is included & also, copying
/tmpdata/testdir reported "No such file or directory" warning. Using
'.' instead of '*' in the below command will fix the warning whether
the directory being copied is empty or only has files or directories
that begin with dot:

  $DRACUT_CP -t "$object_destdir" "$dracutsysrootdir$objectname"/*

Also, enable 'dotglob' temporarily to include files and directories
beginning with a `.' in the results of pathname expansion of source
directory being included.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
4 years agofix(network-manager): support teaming under NM+systemd
Dusty Mabe [Thu, 24 Jun 2021 18:41:08 +0000 (14:41 -0400)] 
fix(network-manager): support teaming under NM+systemd

Previously when NM was run without dbus then teaming would come
up appropriately [1], but now that dbus exists we also need to
include some supporting infrastructure to allow for it to work
again.

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/d689380cfc5734a29b1302d68027190e1a606265

4 years agofix(squash): create relative symlinks
Kairui Song [Thu, 10 Jun 2021 08:45:03 +0000 (16:45 +0800)] 
fix(squash): create relative symlinks

Don't use absolute path, or it may resolve to wrong files after unpack
the initramfs to a sub path on a running system.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agofix(fips): handle s390x OSTree systems
Jonathan Lebon [Thu, 17 Jun 2021 14:47:33 +0000 (10:47 -0400)] 
fix(fips): handle s390x OSTree systems

On s390x, the `BOOT_IMAGE` karg injected by the bootloader is not a path
to the kernel image, but rather an integer describing the index of the
menu entry selected. Because of the way the s390x bootloader works,
there is no information retained about e.g. the path of the kernel that
was loaded.

This causes issues for the FIPS code which assumes that `BOOT_IMAGE` is
a path to the kernel image to derive the HMAC path. In non-OSTree
systems, this ends up working anyway, because the kernel is located at
the root of the boot partition.  In OSTree systems, this is not the
case. However, OSTree systems use BLS configs, and they are named in
reverse order of precedence (i.e. menu ordering). So from the
`BOOT_IMAGE` integer, we can figure out which BLS entry was selected.

Add some code to do just this on s390x. This isn't completely foolproof,
because it presumes that (1) BLS configs were used to populate the
bootloader (and that they were exactly in the same state they currently
are when `zipl` was run), and (2) there are no other menu entries
originating from outside the BLS configs. However, if these assumptions
are wrong we would simply fail the boot, which is currently what is
happening anyway.

See also:
https://github.com/openshift/os/pull/546
https://github.com/ibm-s390-linux/s390-tools/issues/78

Tested-by: Muhammad Adeel <muhammad.adeel@ibm.com>
4 years agofix(multipath): get config. dir from configuration
David Tardon [Tue, 1 Jun 2021 13:06:01 +0000 (15:06 +0200)] 
fix(multipath): get config. dir from configuration

4 years agofix(install): add a missing ret value assignment
Frantisek Sumsal [Fri, 18 Jun 2021 12:35:04 +0000 (14:35 +0200)] 
fix(install): add a missing ret value assignment

Spotted when reconfiguring LGTM for RHEL 9 dracut repo.

4 years agofix(network-manager): pull in network.target in nm-initrd.service
Dusty Mabe [Fri, 25 Jun 2021 19:27:37 +0000 (15:27 -0400)] 
fix(network-manager): pull in network.target in nm-initrd.service

Otherwise units with `After=network.target` won't have any effect.

4 years agofeat(squash): install umount util
Kairui Song [Tue, 22 Jun 2021 13:49:20 +0000 (21:49 +0800)] 
feat(squash): install umount util

Also install umount binary, make it possible to cleanup squash overlay
mounts. This is useful for other tools reusing the dracut initramfs built
with squash module enabled.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agofix(tpm2-tss): typo in depends()
Matthias Berndt [Tue, 1 Jun 2021 17:32:48 +0000 (19:32 +0200)] 
fix(tpm2-tss): typo in depends()

There is no systemd-udev module, only systemd-udevd

4 years agofix(crypt): remove quotes from cryptsetupopts
lapseofreason [Tue, 8 Jun 2021 14:01:58 +0000 (16:01 +0200)] 
fix(crypt): remove quotes from cryptsetupopts

Fixes #1528.

4 years agodocs: update NEWS.md and AUTHORS 055
Harald Hoyer [Thu, 27 May 2021 12:12:40 +0000 (14:12 +0200)] 
docs: update NEWS.md and AUTHORS

4 years agofix(fs-lib): install fsck utilities
Tomasz Paweł Gajc [Sat, 22 May 2021 10:01:19 +0000 (12:01 +0200)] 
fix(fs-lib): install fsck utilities

4 years agofix(integrity): require ALLOW_METADATA_WRITES to come from EVM config file
Stefan Berger [Wed, 12 May 2021 13:26:11 +0000 (09:26 -0400)] 
fix(integrity): require ALLOW_METADATA_WRITES to come from EVM config file

Upcoming versions of EVM will not require the ALLOW_METADATA_WRITES anymore,
therefore we remove it from the script and require it to be set in the EVM
config file variable EVM_ACTIVATION_BITS for those versions that need it.

Patch 9 in this patch set deprecates the EVM_ALLOW_METADATA_WRITES flag:
https://lore.kernel.org/linux-integrity/20210514152753.982958-1-roberto.sassu@huawei.com/

Suggested-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
4 years agofix(install): configure logging earlier
Marcos Mello [Mon, 24 May 2021 19:16:03 +0000 (16:16 -0300)] 
fix(install): configure logging earlier

There are log_error() and log_debug() calls in parse_argv().

4 years agofix(warpclock): minor cleanups
Jóhann B. Guðmundsson [Tue, 18 May 2021 10:34:46 +0000 (10:34 +0000)] 
fix(warpclock): minor cleanups

- Removing shell mode lines
- Remove uncessary file requirements
- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section

4 years agofix(dash): minor cleanups
Jóhann B. Guðmundsson [Tue, 18 May 2021 13:19:28 +0000 (13:19 +0000)] 
fix(dash): minor cleanups

- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section

4 years agofix(mksh): minor cleanups
Jóhann B. Guðmundsson [Tue, 18 May 2021 14:14:11 +0000 (14:14 +0000)] 
fix(mksh): minor cleanups

- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section

4 years agofeat(install): add default value for --firmwaredirs
Marcos Mello [Mon, 24 May 2021 00:04:20 +0000 (21:04 -0300)] 
feat(install): add default value for --firmwaredirs

If not specified, use /lib/firmware.

4 years agofix(dracut-functions): get_maj_min without get_maj_min_cache_file set
Harald Hoyer [Fri, 21 May 2021 10:19:32 +0000 (12:19 +0200)] 
fix(dracut-functions): get_maj_min without get_maj_min_cache_file set

If `get_maj_min_cache_file` is unset `get_maj_min()` would error out.

Fix it to work without a cache file set.

4 years agofix(dracut): pipe hardlink output to `dinfo`
Harald Hoyer [Fri, 21 May 2021 09:30:47 +0000 (11:30 +0200)] 
fix(dracut): pipe hardlink output to `dinfo`

Otherwise the output is cluttered with:
```
Mode:           real
Files:          1364
Linked:         5 files
Compared:       0 xattrs
Compared:       384 files
Saved:          12.84 KiB
Duration:       0.052674 seconds
```

4 years agofix(install): sane default --kerneldir
Marcos Mello [Thu, 20 May 2021 18:41:26 +0000 (15:41 -0300)] 
fix(install): sane default --kerneldir

If --kerneldir is not specified, use /lib/modules/$(uname -r).

Fixes #1505

4 years agofix(bash): minor cleanups
Jóhann B. Guðmundsson [Tue, 18 May 2021 12:39:34 +0000 (12:39 +0000)] 
fix(bash): minor cleanups

- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section

4 years agofix(squash): don't mount the mount points if already mounted
Kairui Song [Tue, 6 Apr 2021 18:11:41 +0000 (02:11 +0800)] 
fix(squash): don't mount the mount points if already mounted

It is possible that user setup some early mount in the rootfs even
earlier, so just be more robust and cover that case too.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agoci: add shfmt to Fedora containers
Harald Hoyer [Mon, 17 May 2021 11:07:09 +0000 (13:07 +0200)] 
ci: add shfmt to Fedora containers

4 years agofix(base): add missing `str_replace` to `dracut-dev-lib.sh`
Harald Hoyer [Tue, 18 May 2021 08:13:56 +0000 (10:13 +0200)] 
fix(base): add missing `str_replace` to `dracut-dev-lib.sh`

```
dracut-dev-lib.sh: line 92: str_replace: command not found
dracut-dev-lib.sh: line 98: /var/tmp/dracut.sabKZg/initramfs/initqueue/finished/devexists-.sh: No such file or directory
dracut-dev-lib.sh: line 83: /var/tmp/dracut.sabKZg/initramfs/emergency/80-.sh: No such file or directory
```

4 years agofeat(dracut.sh): detect running in a container
Harald Hoyer [Mon, 17 May 2021 12:22:10 +0000 (14:22 +0200)] 
feat(dracut.sh): detect running in a container

Don't try to `mknod` by setting DRACUT_NO_MKNOD.
Don't try to `cp` extended attributrs by setting DRACUT_NO_XATTR.

4 years agofix(base): split out `dracut-dev-lib.sh`
Harald Hoyer [Mon, 17 May 2021 09:00:22 +0000 (11:00 +0200)] 
fix(base): split out `dracut-dev-lib.sh`

To share the `wait_for_dev` function and use it without side effects on
install time, split out the needed functions in an extra library.

4 years agofix(dracut-util): print error message with trailing newline
Lars Wendler [Fri, 14 May 2021 14:00:27 +0000 (16:00 +0200)] 
fix(dracut-util): print error message with trailing newline

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
4 years agofix(packit): downstream has renamed the master branch to main
Jóhann B. Guðmundsson [Fri, 14 May 2021 13:46:23 +0000 (13:46 +0000)] 
fix(packit): downstream has renamed the master branch to main

4 years agodocs: update NEWS.md and AUTHORS 054
Harald Hoyer [Fri, 14 May 2021 12:10:36 +0000 (14:10 +0200)] 
docs: update NEWS.md and AUTHORS

4 years agoci: run the integration tests on more distributions
Harald Hoyer [Wed, 12 May 2021 11:40:53 +0000 (13:40 +0200)] 
ci: run the integration tests on more distributions

Add OpenSuse and Arch Linux to limited tests.

Only run the full tests against the latest stable Fedora version
to reduce the workload.

Also remove the `hung_task_panic=1` on the kernel command line, as qemu
tends to be really slow in non-kvm mode.