From a7a6ad80983f25b03e044b446bcd6e3d5cae1dc1 Mon Sep 17 00:00:00 2001 From: Michal Date: Sun, 29 Mar 2026 12:38:41 +0100 Subject: [PATCH] fix: skip removable/USB disks in %pre, wait for NVMe init JetKVM virtual media appears as /dev/sda before NVMe initializes. Now: wait up to 10s for disks, skip removable disks and anything under 20GB. Fixes "ignoredisk: sda does not exist" on SER9MAX. Co-Authored-By: Claude Opus 4.6 (1M context) --- bastion/src/bastion/src/templates/install.ks.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bastion/src/bastion/src/templates/install.ks.ts b/bastion/src/bastion/src/templates/install.ks.ts index af2d94a..a989309 100644 --- a/bastion/src/bastion/src/templates/install.ks.ts +++ b/bastion/src/bastion/src/templates/install.ks.ts @@ -88,8 +88,20 @@ chmod 440 /etc/sudoers.d/${adminUser}`; const diskLine = disk ? `DISK="${disk}"` : `DISK="" -for d in /dev/nvme0n1 /dev/sda /dev/vda; do - [ -b "$d" ] && { DISK="$(basename $d)"; break; } +# Wait up to 10s for NVMe/SCSI disks to appear (they init async in initrd) +for _wait in $(seq 1 10); do + for d in /dev/nvme0n1 /dev/sda /dev/vda; do + [ -b "$d" ] || continue + # Skip removable disks (USB, CD-ROM, JetKVM virtual media) + _bname=$(basename "$d") + [ -f "/sys/block/$_bname/removable" ] && [ "$(cat /sys/block/$_bname/removable)" = "1" ] && continue + # Skip disks smaller than 20GB (likely USB sticks) + _size=$(cat /sys/block/$_bname/size 2>/dev/null || echo 0) + [ "$_size" -lt 41943040 ] && continue + DISK="$_bname" + break 2 + done + sleep 1 done [ -z "$DISK" ] && { echo "ERROR: no disk found"; exit 1; }`;