Bug#841135: Debian/Ubuntu multiboot USB sticks (Was: Re: Bug#841135: Acknowledgement (iso-scan/filename ignored in Debian 8.6.0 => cannot put it on multiboot USB stick))
Hi,
I had a little bit of time, so I continued to investigate the issue.
>From what I understand now, iso-scan is not meant to use any iso
filename supplied to it via grub command line, but it rather prefers to
scan the USB stick for usable images itself, and then present the user
with a menu.
The issue that I described occurs when there is more than one
"Debian-like" ISO image present at a level 1 subdirectory (such as
/install).
In that case, it falls into case 20) of the state-machine:
20) # One or multiple ISO(s) found: ask which one we'll use
# FIXME: not l10n safe
db_subst iso-scan/ask_which_iso ISOS_LIST "$ISOS_FOUND"
db_input ${CRITICAL:-medium} iso-scan/ask_which_iso || true
;;
Note, that (by default), the input is treated with priority medium,
which means that the user is not asked, but the system just assumes the
first available choice as default => which leads to trouble if for
instance both a Debian and a Ubuntu iso are present on the same USB
stick.
If multiple images are present _deeper_ in the hierarchy (such as
/boot/iso), it falls into state 30, which uses priority=high:
30) # One or multiple ISO(s) found: ask which one we'll use
db_clear
db_subst iso-scan/ask_which_iso ISOS_LIST "$ISOS_FOUND"
db_subst iso-scan/ask_which_iso SECOND_PASS "."
if echo "$ISOS_FOUND" | grep -q ', '; then
priority=high
else
priority=medium
fi
BACKUPSTATE=10
db_input ${CRITICAL:-$priority} iso-scan/ask_which_iso || true
;;
==> the user is asked.
So, with the existing code several workarounds would be available to
solve the issue, of which none are completely satisfactory:
1. Store the ISOs in a level deep enough to fall under case 30.
Downside: a costly full-disk scan is incurred on all media, including
the built-in hard disk, which may contain an existing installation with
many, many files...
2. Pass an exact name of ISO (with all decorations) as a boot parameter:
linux (loop)/install/vmlinuz iso-scan/ask_which_iso="[sdb1] $isofile (xenial - 16.04)"
Downside: this includes the media name (sdb1), which may not always be
the same on all computers where this bootable USB stick might be used.
3. Add debconf/priority=medium . This does allow the user to chose the
ISO image in state 20, but at the price of having to manually navigate
the installation procedure (pick each step from main menu, rather than
being guided along by the wizard)
By changing the iso-scan.postinst code, several approaches would be
possible:
1. Copy-paste the priority picking code from step 30 into 20, so that
20 too asks the user to chose if more than one iso is found at that
stage.
2. The find "$dir" $opt -name "*.iso" in scan_devices_for_iso could be
replaced with the following:
db_get iso-scan/iso_pattern
isolist=$(find "$dir" $opt -iname "${RET:-*.iso}" 2>/dev/null)
That way, existing behavior is preserved if iso-scan/iso_pattern is not
set, but if it is set, it scans for a specific filename.
3. A couple of steps could be added initially, looking for a specific
full path on all connected devices, and only drop to the existing code
if either no such full path was specified on kernel command line, or if
that path could be found on no device.
4. The FIXME in analyze_cd about comparing the codename (or suite-name)
would help
Each of these changes would make it much easier to set up USB sticks
bootable into multiple distributions.
Thanks for your attention,
Alain
Reply to: