I have encountered an interesting scenario. I have some Debian Live CD images (I have tried debian-8.11.0-amd64-netinst.iso, debian-9.6.0-amd64-netinst.iso and some custom images I built using live-build) and dd the image onto an USB drive. I boot the computer with the USB drive and install Debian onto hard drive. When the installation finishes, the computer reboots. At this time, after I login, I find I am not able to use the USB drive, which is still plugged in. I can see it being /dev/sdb, but /dev does not show any partitions of the USB drive. I tried
fdisk -l /dev/sdb but gets
fdisk: cannot open /dev/sdb: No medium found. In
dmesg the only two lines I see related are
sd 2:0:0:0: Attached scsi generic sg1 type0 sd 2:0:0:0: [sdb] Attached SCSI removable disk
Here's the interesting part. If I unplug the drive and plug back in, it gets detected and works fine. If I reboot the box (either
poweroff and then power on), it doesn't work. However, if after the box is powered off, I unplug the drive and plug in back it, upon the next boot it works. I wondered if there's some mechanism in Debian Installer that prevents the USB drive from working to avoid reboot-install loop. I looked into some of the files and in /bin/live-medium-eject I find it's not doing anything to usb devices and has the following comment:
# ignoring usb mass storage devices # (they need coldreboot to recover)
What could be the cause of this behavior?
EDIT1: I also tried Ubuntu 18.04 and CentOS 7.6. Ubuntu produces the same behavior as Debian, but CentOS can recognize the USB drive upon the first boot.