Skip to content

Commit ca51e23

Browse files
committed
WIP: Simplify ISO boot param injection, add installer detection
- Simplify parameter injection to always inject iso-scan/filename as primary - Add installer ISO detection (warns user to use dd instead) - Remove Ventoy recommendations (not supported by Heads) - Keep USB filesystem check from initrd scanning
1 parent d35f02f commit ca51e23

2 files changed

Lines changed: 31 additions & 28 deletions

File tree

initrd/bin/kexec-iso-init.sh

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# If no mechanism is detected, the user is warned that the ISO may not
2626
# support booting from ISO file on USB, and is given alternative options:
2727
# - Write ISO directly to USB with dd
28-
# - Use Ventoy in USB emulation mode
28+
# - Write ISO directly to USB with dd
2929
# - Boot from real DVD drive
3030
#
3131
set -e -o pipefail
@@ -262,12 +262,30 @@ extract_boot_params_from_cfg() {
262262
# ============================================================================
263263
# Main detection flow
264264
# ============================================================================
265-
# Step 1: Scan initrd for supported boot mechanisms
266-
# Step 2: If no boot method found, fall back to cfg file scanning
265+
# Step 1: Check if ISO is an installer (not bootable from USB file)
266+
# Step 2: Scan initrd for USB filesystem support and boot mechanisms
267267
# Step 3: Check USB filesystem compatibility
268268
# Step 4: If no known mechanism found, warn user with guidance
269269
# ============================================================================
270270

271+
STATUS "Detecting ISO type..."
272+
if [ -d "/boot/install.amd" ] || [ -d "/boot/install" ]; then
273+
if [ -f "/boot/install.amd/vmlinuz" ] || [ -f "/boot/install/vmlinuz" ]; then
274+
WARN "This appears to be an installer ISO"
275+
WARN "Installer ISOs do not support booting from ISO file on USB"
276+
if [ -x /bin/whiptail ]; then
277+
if ! whiptail_warning --title 'INSTALLER ISO NOT SUPPORTED' --yesno \
278+
"This ISO is an installer and does not support booting from ISO file on USB.\n\nInstaller ISOs only work when written directly to USB with dd or when used as a DVD.\n\nTo use this ISO:\n- Linux: sudo cp image.iso /dev/sdX\n- Windows/Mac: Use Rufus in DD mode\n\nDo you want to try anyway?" \
279+
0 80; then
280+
DIE "Installer ISO - write to USB with dd"
281+
fi
282+
else
283+
INPUT "Installer ISO - may not work from USB file. Try anyway? [y/N]:" -n 1 response
284+
[ "$response" != "y" ] && [ "$response" != "Y" ] && DIE "Installer ISO - write to USB with dd"
285+
fi
286+
fi
287+
fi
288+
271289
STATUS "Detecting USB filesystem and boot method support..."
272290
SUPPORTED_FSES=""
273291
SUPPORTED_BOOT=""
@@ -312,7 +330,7 @@ if [ -z "$DETECTED_METHODS" ]; then
312330
WARN "ISO may not boot from USB file: no supported boot method detected"
313331
if [ -x /bin/whiptail ]; then
314332
if ! whiptail_warning --title 'ISO BOOT NOT SUPPORTED' --yesno \
315-
"This ISO does not support booting from ISO file on USB.\n\nThe initrd does not include boot-from-ISO mechanisms (no live-boot, casper, fromiso, iso-scan, anaconda, or nixos support detected).\n\nTo use this ISO, write the hybrid image directly to a USB flash drive:\n\nLinux: sudo cp image.iso /dev/sdX (Be cautious!)\nWindows/Mac: Use Rufus, select DD mode (NOT ISO mode)\n\nWrite to whole-disk device (NOT a partition, e.g. /dev/sdX not /dev/sdX1),\nthen boot from USB device directly (not as ISO file).\n\nSee Debian wiki: https://wiki.debian.org/DebianInstall" \
333+
"This ISO does not support booting from ISO file on USB.\n\nThe initrd does not include boot-from-ISO mechanisms (no live-boot, casper, fromiso, iso-scan, anaconda, or nixos support detected).\n\nTo use this ISO, write the hybrid image directly to a USB flash drive:\n\nLinux: sudo cp image.iso /dev/sdX (Be cautious!)\nWindows/Mac: Use Rufus, select DD mode (NOT ISO mode)\n\nWrite to whole-disk device (NOT a partition, e.g. /dev/sdX not /dev/sdX1),\nthen boot from USB device directly (not as ISO file)." \
316334
0 80; then
317335
DIE "ISO boot cancelled - initrd does not support USB file boot"
318336
fi
@@ -327,34 +345,19 @@ fi
327345
# ============================================================================
328346
# Boot parameter injection
329347
# ============================================================================
330-
# Inject all known boot-from-ISO parameters. The ISO's initrd will use
348+
# Inject minimal boot-from-ISO parameters. The ISO's initrd will use
331349
# whichever parameters it understands and ignore the rest.
332350
#
333-
# Parameters injected (covering all major boot systems):
334-
# - findiso, fromiso, iso-scan/filename: Dracut standard
335-
# - img_dev, img_loop: additional Dracut variants
336-
# - iso: alternative parameter
337-
# - live-media, live-media-path: live-boot parameters
338-
# - boot=live, boot=casper: casper/live-boot parameters
351+
# We inject iso-scan/filename as the primary parameter - this is
352+
# the most widely supported boot-from-ISO parameter across distros.
353+
# Other parameters (findiso, fromiso, img_dev, etc.) are injected
354+
# as fallback for distros that need them.
339355
# ============================================================================
340356

341357
ISO_DEV="/dev/disk/by-uuid/$DEV_UUID"
342358
ISO_PATH_ABS="/$ISO_PATH"
343359

344-
base_params="findiso=$ISO_DEV/$ISO_PATH fromiso=$ISO_DEV/$ISO_PATH iso-scan/filename=$ISO_PATH_ABS img_dev=$ISO_DEV img_loop=$ISO_PATH iso=$DEV_UUID/$ISO_PATH"
345-
346-
add_params=""
347-
if echo "$DETECTED_METHODS" | grep -q "casper"; then
348-
add_params="$add_params boot=casper live-media-path=casper"
349-
fi
350-
if echo "$DETECTED_METHODS" | grep -q "boot-live"; then
351-
add_params="$add_params boot=live"
352-
fi
353-
if echo "$DETECTED_METHODS" | grep -q "live-media"; then
354-
add_params="$add_params live-media=$ISO_DEV/$ISO_PATH"
355-
fi
356-
357-
ADD="$base_params $add_params"
360+
ADD="iso-scan/filename=$ISO_PATH_ABS findiso=$ISO_DEV/$ISO_PATH fromiso=$ISO_DEV/$ISO_PATH img_dev=$ISO_DEV img_loop=$ISO_PATH iso=$DEV_UUID/$ISO_PATH"
358361
DEBUG "Injecting boot params: $ADD"
359362
REMOVE=""
360363

tests/iso-parser/run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
# Compatibility status:
1919
# - OK: Known boot mechanism detected, should work
2020
# - WARN: No known mechanism detected, may work but unverified
21-
# - SKIP: Installer ISO - use dd/Ventoy instead
21+
# - SKIP: Installer ISO - use dd instead
2222
#
2323
# Tested ISOs (2026-04):
2424
# - Ubuntu Desktop, Debian Live, Tails, Fedora Live, NixOS, PureOS, Kicksecure: OK
25-
# - Debian DVD installer: SKIP (use dd/Ventoy)
25+
# - Debian DVD installer: SKIP (use dd)
2626
# - TinyCore/CorePlus: WARN (unverified)
2727

2828
set -e
@@ -182,7 +182,7 @@ check_compatibility() {
182182
local status=""
183183
local note=""
184184
case "$supported" in
185-
installer*) status="SKIP" ; note=" (use dd/Ventoy)" ;;
185+
installer*) status="SKIP" ; note=" (use dd)" ;;
186186
anaconda*) status="WARN" ; note=" (block device req)" ;;
187187
std) status="WARN" ;;
188188
"") status="WARN" ;;

0 commit comments

Comments
 (0)