fix(dracut-fuctions.sh): correct wrong regex pattern for LVM dm devices
The regex pattern to detect LVM device-mapper devices used in `check_vol_slaves`
and `check_vol_slaves_all` is incorrect, as it matches any occurrence of the LVM
string within dm/uuid, not just at the beggining.
A similar check is correctly implemented in `lvm_internal_dev`, so this patch
creates a new `get_lvm_dm_dev` function using it to avoid duplicate code.
fix(install.d): simplify and use what kernel-install gives us
drops legacy fallback path, exit always if we are not chosen as initrd_
generator. Exit if we are already installing an UKI. Exit if an initrd
image is already specified by kernel-install.
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
ci: gummiboot-stub no longer supports UEFI image with latest kernel
Remove ovmf from Alpine container to explicitly skip UEFI test.
Replace gummiboot with systemd-boot-efistub in the Void container.
Be consistent and remove sudo from all test containers.
This module loops over many bus devices, and calls `dracut_instmods` for each
one. E.g., on a Lenovo Thinkpad laptop:
```
> for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?,vmbus/devices}/*/modalias; do [[ -e $i ]] && [[ -n $(< "$i") ]] && echo $i; done | wc -l
79
```
Every call to `dracut_instmods` spawns a `dracut-install` process, which in the
previous example means calling `dracut-install` 79 times using the same
arguments.
If any call to `dracut-install` fails, dracut continues its execution (even the
errors are not shown, because it's called with `--silent`). Therefore, let's
take the contents of all the `modalias` files into an array and call
`dracut-install` only once, adding also the `-o` argument, so if any of the
modules cannot be installed, `dracut-install` does not stop.
Steffen Maier [Thu, 26 Jan 2023 13:50:40 +0000 (14:50 +0100)]
feat(lsinitrd.sh): enable unpacking files from squash-root.img
This is helpful for debugging some kdump mkdumprd that prefer dracut-squash.
To not break when unsquashfs upstream would change the default path prefix,
explicitly specify the prefix as argument so users always find files from
squash-root.img by using the same hardcoded prefix, both in the file listing
and when extracting files.
Regarding extract_files (without --unpack):
Unsquashfs cannot seem to extract to stdout, so take a detour via a temp
file.
Regarding --unpack:
Even though cpio for comparison would not overwrite files on extracing,
pass the force flag to unsquashfs on extracing individual files.
Otherwise, unsquashfs complains about its relative top-level directory
"squashfs-root" which already exists after the first file was extracted.
With the force flag, the user can specify multiple files to extract from
squash-root.img, or can invoke lsinitrd multiple times in the same
directory to extract multiple files from squash-root.img.
feat(tpm2-tss): add tpm2.target and systemd-tpm2-generator
https://github.com/systemd/systemd/commit/4e1f0037 added a new `tpm2.target`,
which is now used by `systemd-pcrphase-initrd.service`, and
`systemd-tpm2-generator`, which adds a `Wants=` dependency from `sysinit.target`
to `tpm2.target` when it detects that the firmware discovered a TPM2 device but
the kernel didn't.
fix(dracut-init.sh): handle decompress with `--sysroot`
Remove `$dracutsysrootdir` from the file path passed to the decompress command,
otherwise the path is wrong and the file is not decompressed in the temporary
directory where the initramfs is being built.
E.g.:
```
dracut[I]: *** Including module: i18n ***
gzip: /var/tmp/dracut.6Iqygd/initramfs/.snapshots/12/snapshot/usr/share/kbd/keymaps/i386/include/euro1.map.gz: No such file or directory
gzip: /var/tmp/dracut.6Iqygd/initramfs/.snapshots/12/snapshot/usr/share/kbd/keymaps/i386/qwerty/us.map.gz: No such file or directory
gzip: /var/tmp/dracut.6Iqygd/initramfs/.snapshots/12/snapshot/usr/share/kbd/keymaps/xkb/us.map.gz: No such file or directory
```
fix(i18n): handle keymap includes with `--sysroot`
The results of `find "${dracutsysrootdir}${kbddir}"/keymaps/ -type f -name "${INCL}*" -print0`
are directly passed to `findkeymap` containing the `$dracutsysrootdir` path,
which causes that `[[ -f $dracutsysrootdir$1 ]]` evaluates to false because the
same path is prepended again, and the following `find` fails because `MAPNAME`
has an absolute path.
E.g., with `dracutsysrootdir=/.snapshots/9/snapshot`, for `MAPNAME=us` the
`INCLUDES` of `MAP=/.snapshots/9/snapshot/usr/share/kbd/keymaps/i386/qwerty/us.map.gz`
will pass `/.snapshots/9/snapshot/usr/share/kbd/keymaps/i386/include/qwerty-layout.inc` to
`findkeymap`.
```
dracut[I]: *** Including module: i18n ***
find: warning: ‘-name’ matches against basenames only, but the given pattern contains a directory separator (‘/’), thus the expression will evaluate to false all the time. Did you mean ‘-wholename’?
```
fix(dracut-lib): only remove initqueue/finished scripts, not the hook dir
The `remove_hostonly_files` function should only remove (as its name suggests)
hostonly configuration and files. The initqueue/finished scripts considered as
hostonly that must be removed are added via `wait_for_dev`. But, the `hookdirs`
are always created at build time, and should not be removed.
This patch also allows to remove the `mkdir` workaround in the `network-manager`
module (copied-pasted into the `connman` module after), and avoids having to add
it tree-wide in many missing places.
fix(systemd-sysext): handle confexts and correct extensions search path
- Support to confexts added in https://github.com/systemd/systemd/pull/26013
(instead of working on /usr and /opt, confext will extend only /etc).
- /usr/lib/extensions/ not supported since https://github.com/systemd/systemd/commit/de862276
- In addition to these two fixes, add only raw binary disk images contained in
regular files, because dracut does not have a helper function to add directories
recursively.
Tomas Bzatek [Thu, 21 Sep 2023 12:31:07 +0000 (14:31 +0200)]
fix(nvmf): move /etc/nvme/host{nqn,id} requirement to hostonly
When creating initramfs for universal boot image such as an installer,
we can't include any machine-specific IDs. Let's move the check
for /etc/nvme/hostnqn and /etc/nvme/hostid files presence to
the hostonly section to avoid unsatisfied requirements.
Adam Williamson [Mon, 30 Oct 2023 04:19:36 +0000 (21:19 -0700)]
fix: wait 12 hours before halt on media check fail
If a modesetting driver has been loaded by the time the media
check happens, halting the system (as we currently do immediately
if the check fails) blanks the screen, which is confusing for
the user. This adds a warning message and a 12-hour wait before
the system is eventually halted, so the user can see the media
check failure and (presumably) reboot and fix the medium.
It also tweaks the text of the failure message not to call it a
"CD check", since it's not 1998 any more.
Lukas Nykryn [Wed, 10 May 2023 10:54:25 +0000 (12:54 +0200)]
fix(dracut-lib): use poweroff instead of halt
Using halt will keep the HW still powered on. This can be confusing for
users. The screen is blank, but for example the fan is still
running and they have no idea what is going on. So let's call poweroff.
Jan Macku [Tue, 3 Oct 2023 08:30:06 +0000 (10:30 +0200)]
ci(lint): remove broken parameter of sh-checker
The `sh_checker_comment: true` requires special permissions (`pull-requests: write`).
This permission level could be achieved only on PR from the `dracut` repository. When PR is opened from the fork, it automatically drops to `read` only.
error message:
```
Commenting on the pull request
{
"message": "Resource not accessible by integration",
"documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment"
}
```
Henrik Gombos [Sat, 5 Aug 2023 13:07:10 +0000 (09:07 -0400)]
ci: add support for releasing with signed tags
Now that tools/release.sh supports all steps described in RELEASE.md,
update RELEASE.md and point it to release.sh as the canonical
manual way to make a release.
fix(dmsquash-live): use the overlay size with thin provisioning
Using the overlay size in the device mapper table allows the filesystem
in the base image to be extended if the overlay is larger than the
base image (e.g. `resize2fs /dev/mapper/live-rw`).