postmarketos-initramfs: better wait_[br]oot_partition (MR 5048)

Rework the messages and avoid re-spawning the splash on every check.
Additionally, add a call to check_keys, this lets users drop to a debug
shell or export logs to triage this failure (particularly useful for
hard-to-reproduce issues).

Finally, add a (liberal) 30 second timeout and dump logs at the end. If
we're just waiting for a device to show up and it doesn't after 30
seconds then it's probably never going to...

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-04-18 21:51:58 +01:00 committed by Clayton Craft
parent 7030e08e7b
commit abca4acbe0
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
2 changed files with 31 additions and 10 deletions

View file

@ -103,6 +103,9 @@ elif ! grep -q "pmos.debug-shell" /proc/cmdline; then
exec >/dev/null 2>&1
fi
# Make it clear that we're at the end of the initramfs
show_splash "Starting..."
# Re-enable kmsg ratelimiting (might have been disabled for logging)
echo ratelimit > /proc/sys/kernel/printk_devkmsg

View file

@ -397,23 +397,41 @@ extract_initramfs_extra() {
}
wait_boot_partition() {
while [ -z "$(find_boot_partition)" ]; do
show_splash "ERROR: boot partition not found, retrying...\\nhttps://postmarketos.org/troubleshooting"
echo "Could not find the boot partition."
echo "If your install is on a removable disk, maybe you need to insert it?"
echo "Trying again..."
find_boot_partition
if [ -n "$PMOS_BOOT" ]; then
return
fi
show_splash "Waiting for boot partition..."
for _ in $(seq 1 30); do
if [ -n "$(find_boot_partition)" ]; then
return
fi
sleep 1
check_keys ""
done
show_splash "ERROR: Boot partition not found!\\nhttps://postmarketos.org/troubleshooting"
fail_halt_boot
}
wait_root_partition() {
while [ -z "$(find_root_partition)" ]; do
show_splash "ERROR: root partition not found, retrying...\\nhttps://postmarketos.org/troubleshooting"
echo "Could not find the rootfs."
echo "If your install is on a removable disk, maybe you need to insert it?"
echo "Trying again..."
find_root_partition
if [ -n "$PMOS_ROOT" ]; then
return
fi
show_splash "Waiting for root partition..."
for _ in $(seq 1 30); do
if [ -n "$(find_root_partition)" ]; then
return
fi
sleep 1
check_keys ""
done
show_splash "ERROR: Root partition not found!\\nhttps://postmarketos.org/troubleshooting"
fail_halt_boot
}
delete_old_install_partition() {