[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#953836: iso-scan: Debian installer can't select correct ISO file on multi-iso installation usb-sticks



Package: iso-scan
Version: 1.79
Severity: important



-- System Information:
Debian Release: 10.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-8-amd64 (SMP w/1 CPU core)
Kernel taint flags: TAINT_WARN, TAINT_CRAP
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8),
LANGUAGE= (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled



Hello,

Debian's TUI installer or in general it's script iso-scan.postinst does
not select the correct ISO file to use, when i try to install Debian
from a multi-iso USB-stick with several different ISO files on the
USB-stick.
This bug affects iso-scan upstream and was also tested on Debian 9 and
10 stable with the same effect.

The error is in the file of the initrd.gz hd-image:
./var/lib/dpkg/info/iso-scan.postinst

In line 21 the script is doing a check of an iso file that is given to
the function if that iso file is a Debian one:
/*
  is_debian_iso () {
        test -e /cdrom/.disk/info
  }
*/

And starting in line 79 it is doing some more checks:
/*
      if is_debian_iso; then
                if isodesc=$(analyze_cd); then
                        log "Debian ISO $iso_to_try usable"
                        ISOS_FOUND="${ISOS_FOUND:+$ISOS_FOUND, }$isodesc"
                else
                        log "Debian ISO not usable, skipping"
                fi
        else
                log "$iso_to_try not a Debian ISO"
        fi
*/


There are three problems with this approach.
1. The is_debian_iso () function also accepts Kubuntu ISO files.
For example, the entry of /cdrom/.disk/info of a Kubuntu ISO file does
look like this:
/*
Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
*/

2. If an iso file is accepted by the is_debian_iso () function, the
Debian installer is trying to use ONLY this one, it will not continue to
test other ISO files that might be on the disk.
In my case it accepts the Kubuntu iso file first, but then it fails in
the next "if block" of line 80 (see above).
Thus the whole installation fails, because it's not possible to check
for other iso files on the USB stick.

3. If it finds a real Debian ISO file, it could be the wrong one.
It might select a Debian iso file for AMD64 architecture on an 32 Bit
machine (i386). The installation might work, but the installed system
won't work. Or it also could be an old Version of Debian, for example
Debian 9 (Stretch) instead of Debian 10 (Buster), thus it will install
the wrong one.


Solution:
As a solution i suggest to ask the user if the selected and proposed ISO
file is the correct one and if not, let the user choose the ISO file
manually afterwards. Overwriting what was automatically selected by
iso-scan.postinst script.

There is some code in the script starting at line 381 that should do
that, but it seems to be, that this code is never run:
/*
            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
                ;;
*/


Workaround:
If i rename all ISO files that do look similar to a Debian one (for
example all Ubuntu ISO files) and all Debian iso files with the wrong
architecture or version that i don't want to install, before rebooting
the usb-stick, the installation works.

But it doesn't work to mount the correct iso file to /cdrom in another
terminal manually during setup, because the script iso-scan.postinst is
unmounting all ISO files in line 292 when the user continues with the
installation dialog.
/*
  # Try to unmount anything that was previously mounted
  umount -d /cdrom 2>/dev/null || true
*/


It's an old Bug:
According to the changelog of the newest iso-scan package and a
comparison of the source code in the git repository, this bug is still
not fixed in version 1.79. The code of that script in version 1.75 of
Debian stable and 1.79 upstream doesn't differ:
https://metadata.ftp-master.debian.org/changelogs//main/i/iso-scan/iso-scan_1.79_changelog
https://salsa.debian.org/installer-team/iso-scan/-/compare/1.75...master

Before writing this bug report i also read all the other bug reports
about the iso-scan package.
And what i found out is that this bug is also related to the following
bugs, which means, fixing this bug, can close the following 7 other bug
reports:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841135
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=701772
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707479
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=541276
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510666
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886468
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762316

There is a fix mentioned in bug #841135 which should fix this bug
according by the claims of the author. You should read it. I didn't test
it, but it looks good so far. Sadly that patch is not in diff output format.


More detailed information about my Multi-ISO USB-Stick to recreate and
test this bug:
I have created a multi-iso Installation USB stick a couple of years ago.
I have used this USB stick for several different kind of linux
distributions and operating systems.
I can't exactly remember how i created it, but what i can say is
that it has grub 2 boot loader installed on its boot sector.
And all i have to do to add new ISO images or replace old ones is
copying the iso files to the disk's folder images/ and editing the
boot/grub/grub.cfg file and entries and then run the command

sudo grub-install --root-directory=/media/LOCATION_OF_MY_USBDISK/ /dev/sXX

The multi-iso Installation USB stick let then select me the distribution
or operating system in grub boot menu that i want to install or boot
into. Live CDs do work too.

For Debian 10 AMD64 and i386 (32 Bit) machines the entry in
boot/grub/grub.cfg looks like this:

menuentry "debian-10.3.0-amd64-netinst.iso EXTRA initrd" {
 loopback loop /images/debian-10.3.0-amd64-netinst.iso
 linux (loop)/install.amd/vmlinuz boot=install.amd
iso-scan/filename=/images/debian-10.3.0-amd64-netinst.iso locale=de_DE
console-setup/layoutcode=de noeject noprompt noplymouth nopersistent --
 initrd /images/debian_10_initrd_amd64/initrd.gz
}

menuentry "debian-10.3.0-i386-xfce-CD-1.iso EXTRA initrd" {
 loopback loop /images/debian-10.3.0-i386-xfce-CD-1.iso
 linux (loop)/install.386/vmlinuz boot=install.386
iso-scan/filename=/images/debian-10.3.0-i386-xfce-CD-1.iso locale=de_DE
console-setup/layoutcode=de noeject noprompt noplymouth nopersistent --
 initrd /images/debian_10_initrd_386/initrd.gz
}

For Debian systems i can't use the iso file directly like with other
distributions, i have to download an hd-image initrd.gz file from
https://mirrors.edge.kernel.org/debian/dists/buster/main/installer-amd64/current/images/hd-media/
or
https://mirrors.edge.kernel.org/debian/dists/buster/main/installer-i386/current/images/hd-media/

and edit the entry above accordingly, then the Debian Linux kernel and
Debian installer loads.

For kubuntu the grub menu entry looks like this:
menuentry "Kubuntu 18.04.1 Desktop 64 Bit" {
 loopback loop /images/kubuntu-18.04.1-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper
iso-scan/filename=/images/kubuntu-18.04.1-desktop-amd64.iso locale=de_DE
console-setup/layoutcode=de noeject noprompt noplymouth nopersistent --
 initrd (loop)/casper/initrd
}

For kubuntu i do not need to install a separate initrd.gz image. It just
does use the one from the ISO.

So if you want test this bug on your own, you can create such a
multi-iso USB stick too. Use the above mentioned grub entries above,
install grub 2 and copy the mentioned iso files in the folder ./images/
on it.
kubuntu-18.04.1-desktop-amd64.iso
debian-10.3.0-amd64-netinst.iso
debian-10.3.0-i386-xfce-CD-1.iso

Also don't forget to copy over the initrd.gz hd-images for the Debian
entries. I put them in two separate folders under ./images/ to
distinguish the amd64 one from the i386 one.

I suggest to copy the kubuntu iso on the USB stick at first before the
debian ones, because the iso-scan.postinst might select the oldest file
entry first when checking all ISO files.


Best Regards,

Oliver C.


Reply to: