Commit Graph

6199 Commits (afe4a6dbb7df62982baab8212bba5d90010dfbac)

Author SHA1 Message Date
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
Dan Horák 0b97790626 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>
2021-11-24 09:56:27 +00:00
Alexander Wenzel 4855242ce5 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.
2021-11-24 09:55:51 +00:00
Antonio Alvarez Feijoo 049973b708 feat(fido2): introducing the fido2 module
This module allows to unlock an encrypted filesystem using a FIDO2
security token.
2021-11-24 09:54:44 +00:00
Antonio Alvarez Feijoo 5d990a004b 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.
2021-11-24 06:49:39 +00:00
Laszlo Gombos bf8738d31c 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.
2021-11-23 05:53:33 +00:00
Thomas Blume f905c3a72c fix(s390_rules): drop collect installation
/usr/lib/udev/collect has been removed from udev-v246, so remove it
from the initrd too
2021-11-22 18:09:55 +00:00
Laszlo Gombos 75ad269931 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
2021-11-22 09:40:05 +00:00
Renaud Métrich b9ba3c8bb8 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
2021-11-16 18:29:32 +00:00
Frantisek Sumsal 3f56d481e8 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.
2021-11-15 11:37:22 +00:00
Andrey Sokolov 5c2f72f152 fix(install): segfault on popen error 2021-11-09 07:01:25 +00:00
Peter Robinson 1539845868 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>
2021-10-28 08:52:03 +02:00
Beniamino Galvani f6e6be245d 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
2021-10-21 13:38:41 +00:00
Beniamino Galvani e07b7ad0e7 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.
2021-10-21 13:38:41 +00:00
Harald Hoyer 51c06d9fea chore: change my email address
Signed-off-by: Harald Hoyer <harald@profian.com>
2021-10-13 09:07:39 +02:00
Renaud Métrich d502d2a816 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
[...]
2021-10-12 18:52:06 +02:00
David Disseldorp 96f3177c33 refactor(install): use check_hashmap helper consistently
Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-10-12 13:39:17 +00:00
Peter Robinson a1287c627f 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>
2021-10-12 13:29:27 +00:00
Laszlo Gombos e19e38904c fix(dmsquash-live): iso-scan requires rmdir 2021-10-12 13:29:03 +00:00
Harald Hoyer 0c631efb10 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.
2021-10-06 18:08:01 +02:00
David Disseldorp 5c5b73c681 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>
2021-10-02 06:57:28 +00:00
Luca BRUNO 9491e59928 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
2021-09-23 09:45:27 +00:00
David Tardon 10ed204f87 fix(install): extend hwcaps library handling to libraries under glibc-hwcaps/ 2021-09-13 12:26:14 +00:00
Antonio Alvarez Feijoo 591118c56d 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.
2021-09-11 06:44:40 +00:00
Antonio Alvarez Feijoo 768dd59ef0 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.
2021-09-11 06:44:40 +00:00
Antonio Alvarez Feijoo acfd97a943 fix(dracut.sh): change misspelled variable name 2021-09-09 10:14:27 +00:00
Antonio Alvarez Feijoo f1245b5bc1 fix(dracut.sh): remove wrong $ in loop sequence 2021-09-09 06:43:02 +00:00
Shreenidhi Shedi 3fb8723ce0 fix(skipcpio): calculate and use CPIO_MAGIC_LEN
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-27 17:25:35 +00:00
Shreenidhi Shedi f6d16b6bbd fix(skipcpio): improve error checking
Some other minor tweaks

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-27 17:25:35 +00:00
Andre Russ dfbfd33b24 fix(base): tr needs to be installed 2021-08-25 23:58:12 +00:00
Andre Russ a93fbc4ae0 fix(crypt-gpg): tr needs to be installed 2021-08-25 23:58:12 +00:00
Charles Rose 655c65e6ce 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>
2021-08-23 20:20:11 +00:00
Alexander Tsoy 4afdcba212 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: d3532978de
2021-08-17 07:48:15 +00:00
Thomas Blume 7374943ae3 fix(iscsi): add support for the new iscsiadm "no-wait" (-W) command
remove connection timeout for iscsi firmware targets serving system root
2021-08-17 07:47:20 +00:00
Pingfan Liu c86f4d2860 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
2021-08-13 11:36:25 +00:00
Lukas Nykryn b292ce7295 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
2021-08-13 11:27:15 +00:00
Beniamino Galvani 38320fce56 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
2021-08-10 15:16:48 +00:00
Shreenidhi Shedi 55468a2d40 fix(install): use size_t to avoid -Wsign-compare warning
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Shreenidhi Shedi ef0f848a67 fix(install): improve gettid definition
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Shreenidhi Shedi 19537f8943 fix(install): validate return values log.c
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Shreenidhi Shedi b5cf7ec784 fix(install): rectify unused function args in log.c
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Shreenidhi Shedi e2a61595d2 fix(install): use wrapper for asprintf
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Kairui Song 5ab18dee99 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>
2021-08-09 17:08:52 +00:00