diff -Nru initramfs-tools-0.136ubuntu6.2/debian/changelog initramfs-tools-0.136ubuntu6.3/debian/changelog --- initramfs-tools-0.136ubuntu6.2/debian/changelog 2020-05-27 11:52:16.000000000 -0300 +++ initramfs-tools-0.136ubuntu6.3/debian/changelog 2020-08-31 13:43:29.000000000 -0300 @@ -1,3 +1,31 @@ +initramfs-tools (0.136ubuntu6.3) focal; urgency=medium + + * scripts/functions: Prevent printf error carry over if the wrong + console is set. (LP: #1879987) + The function _log_msg() is "void" typed, returning whatever its + last command returns. This function is the basic building block + for all error/warning messages in initramfs-tools. If a bad console + is provided to kernel on command-line, printf returns error, and so + this error is carried over in _log_msg(). Happens that checkfs() + function has a loop that runs forever in this scenario (*if* fsck + is not present in initramfs and "quiet" is not passed in the + command-line). If that happens, boot is stuck and cannot progress. + The simple fix hereby merged is to return zero on _log_msg(). + + * scripts/local: Re-execute cryptroot local-block script. (LP: #1879980) + Currently, if an encrypted rootfs is configured on top of a MD RAID1 + array and such array gets degraded (like a member is removed/failed), + initramfs-tools cannot mount the rootfs and the boot fails. We fix + that issue here by allowing cryptroot script to re-run on local-block + stage, given that mdadm is able to activate a degraded array in that + point. There is a cryptsetup counter-part for this fix, but alone the + initramfs-tools portion is innocuous. + + * d/tests: Add explicit call to partprobe on net test, specially in + prep-image and run-image. (LP: #1893675) + + -- Guilherme G. Piccoli Mon, 31 Aug 2020 13:43:29 -0300 + initramfs-tools (0.136ubuntu6.2) focal; urgency=medium * Trim leading whitespaces in dumpe2fs output so date command diff -Nru initramfs-tools-0.136ubuntu6.2/debian/tests/prep-image initramfs-tools-0.136ubuntu6.3/debian/tests/prep-image --- initramfs-tools-0.136ubuntu6.2/debian/tests/prep-image 2020-02-14 11:29:00.000000000 -0300 +++ initramfs-tools-0.136ubuntu6.3/debian/tests/prep-image 2020-08-31 13:43:29.000000000 -0300 @@ -25,6 +25,7 @@ truncate -s 1G "$IMAGE" parted --script --align optimal "$IMAGE" -- mklabel gpt mkpart primary ext4 1MiB -2048s dev="$(losetup -Pf --show "$IMAGE")" +partprobe mke2fs -q "${dev}p1" blkid --output=value "${dev}p1" | head -n1 > "${IMAGE}-uuid" mkdir -p mnt diff -Nru initramfs-tools-0.136ubuntu6.2/debian/tests/run-image initramfs-tools-0.136ubuntu6.3/debian/tests/run-image --- initramfs-tools-0.136ubuntu6.2/debian/tests/run-image 2020-02-14 11:29:00.000000000 -0300 +++ initramfs-tools-0.136ubuntu6.3/debian/tests/run-image 2020-08-31 13:43:29.000000000 -0300 @@ -43,6 +43,7 @@ -netdev user,id=net0 -device virtio-net-pci,netdev=net0,bus=pci.0,addr="$NICSLOT" dev=$(losetup -Pf --show "$IMAGE") +partprobe mount "${dev}p1" mnt rm -rf "$OUTPUT" cp -aT mnt/result "$OUTPUT" diff -Nru initramfs-tools-0.136ubuntu6.2/scripts/functions initramfs-tools-0.136ubuntu6.3/scripts/functions --- initramfs-tools-0.136ubuntu6.2/scripts/functions 2020-05-27 11:52:16.000000000 -0300 +++ initramfs-tools-0.136ubuntu6.3/scripts/functions 2020-08-03 17:43:01.000000000 -0300 @@ -5,6 +5,7 @@ if [ "${quiet?}" = "y" ]; then return; fi # shellcheck disable=SC2059 printf "$@" + return 0 # Prevents error carry over in case of unavailable console } log_success_msg() diff -Nru initramfs-tools-0.136ubuntu6.2/scripts/local initramfs-tools-0.136ubuntu6.3/scripts/local --- initramfs-tools-0.136ubuntu6.2/scripts/local 2020-02-17 22:19:14.000000000 -0300 +++ initramfs-tools-0.136ubuntu6.3/scripts/local 2020-08-03 17:43:18.000000000 -0300 @@ -124,6 +124,7 @@ # If mdadm's local-block script counts the # number of times it is run, make sure to # run it the expected number of times. + mdadm_exec=0 while true; do if [ -f /run/count.mdadm.initrd ]; then count="$(cat /run/count.mdadm.initrd)" @@ -137,9 +138,32 @@ if [ ${count} -ge ${time_elapsed} ]; then break; fi + + # Track that mdadm was executed to force + # cryptroot execution after the loop, see + # LP #1879980. + mdadm_exec=1 /scripts/local-block/mdadm "${dev_id}" + + # Cryptroot must run here, see LP #1879980. + # The counter is inc/dec on cryptroot script! + if [ -f /run/cryptroot.initrd.cnt ]; then + crypt_cnt=$(cat /run/cryptroot.initrd.cnt) + if [ "${crypt_cnt}" -gt 0 ]; then + /scripts/local-block/cryptroot "${dev_id}" + fi + fi done + # Extra cryptroot run after mdadm loop in order to + # start encrypted volumes on top of RAID arrays. + if [ -f /run/cryptroot.initrd.cnt ]; then + crypt_cnt=$(cat /run/cryptroot.initrd.cnt) + if [ "${crypt_cnt}" -gt 0 ] || [ ${mdadm_exec} -ne 0 ]; then + /scripts/local-block/cryptroot "${dev_id}" + fi + fi + if real_dev=$(resolve_device "${dev_id}") && get_fstype "${real_dev}" >/dev/null; then wait_for_udev 10