From 6ff77c4482a780be23669e5a39314b0a5383c022 Mon Sep 17 00:00:00 2001 From: Adolfo Delorenzo Date: Thu, 12 Feb 2026 19:05:10 -0600 Subject: [PATCH] fix: resolve LABEL= syntax for RPi data partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The cmdline uses kubesolo.data=LABEL=KSOLODATA, but the wait loop in 20-persistent-mount.sh checked [ -b "LABEL=KSOLODATA" ] which is always false — it's a label reference, not a block device path. Fix by detecting LABEL= prefix and resolving it to a block device path via blkid -L in the wait loop. Also loads mmc_block module as fallback for platforms where it's not built-in. Adds debug output listing available block devices on failure. Co-Authored-By: Claude Opus 4.6 --- init/lib/20-persistent-mount.sh | 60 ++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/init/lib/20-persistent-mount.sh b/init/lib/20-persistent-mount.sh index a025631..122af6c 100755 --- a/init/lib/20-persistent-mount.sh +++ b/init/lib/20-persistent-mount.sh @@ -11,28 +11,58 @@ fi # Load block device drivers before waiting (modules loaded later in stage 30, # but we need virtio_blk available NOW for /dev/vda detection) modprobe virtio_blk 2>/dev/null || true +modprobe mmc_block 2>/dev/null || true # Trigger mdev to create device nodes after loading driver mdev -s 2>/dev/null || true -# Fallback: create device node from sysfs if devtmpfs/mdev didn't -DEV_NAME="${KUBESOLO_DATA_DEV##*/}" -if [ ! -b "$KUBESOLO_DATA_DEV" ] && [ -f "/sys/class/block/$DEV_NAME/dev" ]; then - MAJMIN=$(cat "/sys/class/block/$DEV_NAME/dev") - mknod "$KUBESOLO_DATA_DEV" b "${MAJMIN%%:*}" "${MAJMIN##*:}" 2>/dev/null || true - log "Created $KUBESOLO_DATA_DEV via mknod ($MAJMIN)" -fi - -# Wait for device to appear (USB, slow disks, virtio) -log "Waiting for data device: $KUBESOLO_DATA_DEV" +# Resolve LABEL= syntax to actual block device path +# The RPi cmdline uses kubesolo.data=LABEL=KSOLODATA which needs resolution WAIT_SECS=30 -for i in $(seq 1 "$WAIT_SECS"); do - [ -b "$KUBESOLO_DATA_DEV" ] && break - mdev -s 2>/dev/null || true - sleep 1 -done +log "Waiting for data device: $KUBESOLO_DATA_DEV" + +case "$KUBESOLO_DATA_DEV" in + LABEL=*) + # Extract label name and resolve via blkid/findfs + DATA_LABEL="${KUBESOLO_DATA_DEV#LABEL=}" + RESOLVED="" + for i in $(seq 1 "$WAIT_SECS"); do + mdev -s 2>/dev/null || true + RESOLVED=$(blkid -L "$DATA_LABEL" 2>/dev/null) || true + if [ -z "$RESOLVED" ]; then + RESOLVED=$(findfs "LABEL=$DATA_LABEL" 2>/dev/null) || true + fi + if [ -n "$RESOLVED" ] && [ -b "$RESOLVED" ]; then + log "Resolved LABEL=$DATA_LABEL -> $RESOLVED" + KUBESOLO_DATA_DEV="$RESOLVED" + break + fi + sleep 1 + done + ;; + *) + # Direct block device path — wait for it to appear + # Fallback: create device node from sysfs if devtmpfs/mdev didn't + DEV_NAME="${KUBESOLO_DATA_DEV##*/}" + if [ ! -b "$KUBESOLO_DATA_DEV" ] && [ -f "/sys/class/block/$DEV_NAME/dev" ]; then + MAJMIN=$(cat "/sys/class/block/$DEV_NAME/dev") + mknod "$KUBESOLO_DATA_DEV" b "${MAJMIN%%:*}" "${MAJMIN##*:}" 2>/dev/null || true + log "Created $KUBESOLO_DATA_DEV via mknod ($MAJMIN)" + fi + for i in $(seq 1 "$WAIT_SECS"); do + [ -b "$KUBESOLO_DATA_DEV" ] && break + mdev -s 2>/dev/null || true + sleep 1 + done + ;; +esac if [ ! -b "$KUBESOLO_DATA_DEV" ]; then log_err "Data device $KUBESOLO_DATA_DEV not found after ${WAIT_SECS}s" + # Show available block devices for debugging + log_err "Available block devices:" + ls -la /dev/mmc* /dev/sd* /dev/vd* 2>/dev/null | while read -r line; do + log_err " $line" + done return 1 fi