From 62035f3223794654924cbfe1ee22becc52d2813d Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Wed, 3 Sep 2025 08:06:26 -0500 Subject: [PATCH] init-storage: Add retry loop for findfs Occasionally, especially on a Raspberry Pi, the storage subsystem has not fully enumerated all of the disks before the `init-storage` script starts. This prevents the system from being able to boot, since the script attempts to identify the root filesystem very early. Now, we try a few times to identify the filesystem before giving up, to give the kernel a chance to discover everything. --- boot/initramfs/init-storage.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/boot/initramfs/init-storage.sh b/boot/initramfs/init-storage.sh index f2bb4ee..a6c3505 100755 --- a/boot/initramfs/init-storage.sh +++ b/boot/initramfs/init-storage.sh @@ -28,6 +28,16 @@ copy_vol() { umount "${tmpdir}" } +find_part() { + _i=0 + while [ $_i -lt 5 ]; do + findfs "$1" 2>/dev/null && return + _i=$((_i + 1)) + sleep 1 + done + findfs "$1" +} + format_dev() { dev="$1" partno=$(partition_number "${dev}") @@ -140,8 +150,8 @@ setup_etc() { /sysroot/etc } -rootdev=$(findfs "$1") -datapart=$(findfs "${2:-PARTLABEL=aimeeos-data}") +rootdev=$(find_part "$1") +datapart=$(find_part "${2:-PARTLABEL=aimeeos-data}") if [ -b "${datapart}" ]; then printf 'Found data partition: %s\n' "${datapart}" >&2 else