From 6dd671f24e56275380ab25eb73b217fbb49fd07e Mon Sep 17 00:00:00 2001 From: Peter Oberparleiter Date: Mon, 28 Apr 2025 08:15:09 +0000 Subject: [PATCH] zdev: Make initramfs root configuration more robust MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit zdev's initramfs hook does not add directives for enabling the root device to the initrd if the root device is only configured in the active configuration. As a result, a reboot using the new initrd fails because the root device cannot be found. This situation can occur for example when the zdev initramfs hook is called from within an installer, where devices are only enabled in the active configuration. Address this situation by considering both the active and persistent configuration of the root device during initramfs configuration. In case the device is configured in both configurations, the persistent configuration takes precedence. Reviewed-by: Vineeth Vijayan Signed-off-by: Peter Oberparleiter Signed-off-by: Jan Höppner --- zdev/initramfs/hooks/s390-tools-zdev | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zdev/initramfs/hooks/s390-tools-zdev b/zdev/initramfs/hooks/s390-tools-zdev index 89f230ab..06351995 100644 --- a/zdev/initramfs/hooks/s390-tools-zdev +++ b/zdev/initramfs/hooks/s390-tools-zdev @@ -45,8 +45,10 @@ cp -p /usr/lib/udev/rules.d/81-dpm.rules "$DESTDIR/usr/lib/udev/rules.d/" _tempfile=$(mktemp --tmpdir initramfs-zdev.XXXXXX) # Obtain early + root device configuration -chzdev --export "$_tempfile" --persistent --by-path / \ - --by-attrib "zdev:early=1" --quiet --type 2>/dev/null +chzdev --export - --active --by-path / --quiet 2>/dev/null | + sed -e 's/active/persistent/g' > "$_tempfile" +chzdev --export - --persistent --by-path / --by-attrib "zdev:early=1" \ + --quiet --type 2>/dev/null >>"$_tempfile" # Apply via --import to prevent other devices from being configured. # Rename the resulting cio-ignore rule to ensure that it does not override