#667701 cdrom-detect: Need a simple retry or delay to mount USB flash drives

#667701#5
Date:
2012-04-05 23:00:36 UTC
From:
To:
*** Please type your report below this line ***
We install Debian from USB flash drive. After loading of the Linux
kernel we immediately get an error saying no CD-ROM could be found. When
we abort the CD-ROM detection, go back to the Debian Installer menu and
try again it works without any problem.

The syslog shows that cdrom-detect finishes before the USB flash drive
is initialized by the kernel:

Apr  5 21:46:23 cdrom-detect: Searching for Debian installation media...
Apr  5 21:46:23 cdrom-detect: Devices: '/dev/sr0'
Apr  5 21:46:23 cdrom-detect: CD-ROM mount failed: device=/dev/sr0
fstype=iso9660
Apr  5 21:46:26 kernel: [    8.161655] usb-storage: device scan complete
Apr  5 21:46:26 kernel: [    8.163255] scsi 4:0:0:0: Direct-Access
Kingston DataTraveler G3  PMAP PQ: 0 ANSI: 0 CCS
Apr  5 21:46:26 kernel: [    8.163571] sd 4:0:0:0: Attached scsi generic
sg3 type 0
Apr  5 21:46:26 kernel: [    8.164354] sd 4:0:0:0: [sdc] 7612032
512-byte logical blocks: (3.89 GB/3.62 GiB)
Apr  5 21:46:26 kernel: [    8.164856] sd 4:0:0:0: [sdc] Write Protect
is off
Apr  5 21:46:26 kernel: [    8.164861] sd 4:0:0:0: [sdc] Mode Sense: 23
00 00 00
Apr  5 21:46:26 kernel: [    8.164864] sd 4:0:0:0: [sdc] Assuming drive
cache: write through
Apr  5 21:46:26 kernel: [    8.167472] sd 4:0:0:0: [sdc] Assuming drive
cache: write through
Apr  5 21:46:26 kernel: [    8.167477]  sdc: sdc1
Apr  5 21:46:26 kernel: [    8.169955] sd 4:0:0:0: [sdc] Assuming drive
cache: write through
Apr  5 21:46:26 kernel: [    8.169957] sd 4:0:0:0: [sdc] Attached SCSI
removable disk

#667701#10
Date:
2019-10-30 06:08:05 UTC
From:
To:
This problem still persists in Debian buster.
I am using unattended installation using pressed file.
Whenever the mount failed the auto-installation stops and pops up a dialog box.
To retry without human intervention, I made some code changes to the cdrom-detect.postinst script.
The below is the script file https://salsa.debian.org/installer-team/cdrom-detect/blob/master/debian/cdrom-detect.postinst <https://salsa.debian.org/installer-team/cdrom-detect/blob/master/debian/cdrom-detect.postinst> from the actual repo.
In my case we are trying to mount the iso from CD /dev/sr0.
After trying to mount the CD and if it failed (line #114), the script is looking for usb-partition and if there are no usb-partitions then the retry was never called.
The retry condition is looking for a non-empty devices list (line #141), but the usb-partition overrides the devices list value to empty string
(Line #121), because we do not have any usb-partition.
Hence I changed the script by commenting the usb-partitions device list. Now the retry worked successfully.

This bug can be easily fixed by changing the variable name ‘devices' to something else from line number 121 to 130 in above script.