diff -Nru initramfs-tools-0.137ubuntu10/debian/changelog initramfs-tools-0.137ubuntu11/debian/changelog --- initramfs-tools-0.137ubuntu10/debian/changelog 2020-05-27 11:52:16.000000000 -0300 +++ initramfs-tools-0.137ubuntu11/debian/changelog 2020-08-03 18:04:00.000000000 -0300 @@ -1,3 +1,28 @@ +initramfs-tools (0.137ubuntu11) groovy; 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. + + -- Guilherme G. Piccoli Mon, 03 Aug 2020 18:04:00 -0300 + initramfs-tools (0.137ubuntu10) groovy; urgency=medium * Trim leading whitespaces in dumpe2fs output so date command diff -Nru initramfs-tools-0.137ubuntu10/scripts/functions initramfs-tools-0.137ubuntu11/scripts/functions --- initramfs-tools-0.137ubuntu10/scripts/functions 2020-05-27 11:52:16.000000000 -0300 +++ initramfs-tools-0.137ubuntu11/scripts/functions 2020-08-03 18:03:49.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.137ubuntu10/scripts/local initramfs-tools-0.137ubuntu11/scripts/local --- initramfs-tools-0.137ubuntu10/scripts/local 2020-05-08 14:10:52.000000000 -0300 +++ initramfs-tools-0.137ubuntu11/scripts/local 2020-08-03 18:03:56.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