fix: resolve LABEL= syntax for RPi data partition
Some checks failed
CI / Go Tests (push) Has been cancelled
CI / Build Go Binaries (amd64, linux, linux-amd64) (push) Has been cancelled
CI / Build Go Binaries (arm64, linux, linux-arm64) (push) Has been cancelled
Release / Test (push) Has been cancelled
CI / Shellcheck (push) Has been cancelled
Release / Build Binaries (amd64, linux, linux-amd64) (push) Has been cancelled
Release / Build Binaries (arm64, linux, linux-arm64) (push) Has been cancelled
Release / Build ISO (amd64) (push) Has been cancelled
Release / Create Release (push) Has been cancelled
Some checks failed
CI / Go Tests (push) Has been cancelled
CI / Build Go Binaries (amd64, linux, linux-amd64) (push) Has been cancelled
CI / Build Go Binaries (arm64, linux, linux-arm64) (push) Has been cancelled
Release / Test (push) Has been cancelled
CI / Shellcheck (push) Has been cancelled
Release / Build Binaries (amd64, linux, linux-amd64) (push) Has been cancelled
Release / Build Binaries (arm64, linux, linux-arm64) (push) Has been cancelled
Release / Build ISO (amd64) (push) Has been cancelled
Release / Create Release (push) Has been cancelled
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
# Resolve LABEL= syntax to actual block device path
|
||||
# The RPi cmdline uses kubesolo.data=LABEL=KSOLODATA which needs resolution
|
||||
WAIT_SECS=30
|
||||
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
|
||||
|
||||
# Wait for device to appear (USB, slow disks, virtio)
|
||||
log "Waiting for data device: $KUBESOLO_DATA_DEV"
|
||||
WAIT_SECS=30
|
||||
for i in $(seq 1 "$WAIT_SECS"); do
|
||||
fi
|
||||
for i in $(seq 1 "$WAIT_SECS"); do
|
||||
[ -b "$KUBESOLO_DATA_DEV" ] && break
|
||||
mdev -s 2>/dev/null || true
|
||||
sleep 1
|
||||
done
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user