USB devices reset on guest boot, causing boot failures if USB device is the boot device
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
qemu (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When trying to boot a guest from a bootable USB device, the device is reset in the middle of the boot process. For example:
sudo qemu-system-x86_64 -m 2048 -vga qxl -usb -device usb-host,
Expected result: the bootable media is detected and the entire boot process works, booting correctly the system.
Observed result: bootloader (on this case, GRUB2) is detected correctly, boot process starts, messages that the USB device was reset appear and the boot fails.
I observed this problem with multiple USB devices from different brands (SanDisk, Sony, Kingston, Toshiba, Maxprint), so it's unlikely it's a problem with the device. This was observed with external HDD and pen-drives.
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: qemu-system-x86 1:4.2-3ubuntu6.8
ProcVersionSign
Uname: Linux 5.4.0-52-generic x86_64
ApportVersion: 2.20.11-
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: XFCE
Date: Wed Nov 11 09:47:17 2020
InstallationDate: Installed on 2017-06-13 (1246 days ago)
InstallationMedia: Xubuntu 17.04 "Zesty Zapus" - Release amd64 (20170412)
KvmCmdLine:
COMMAND STAT EUID RUID PID PPID %CPU COMMAND
qemu-system-x86 Sl+ 0 0 19986 19985 50.7 qemu-system-x86_64 -m 2048 -vga qxl -usb -device usb-host,
kvm-nx-lpage-re S 0 0 19988 2 0.0 [kvm-nx-lpage-re]
kvm-pit/19986 S 0 0 19992 2 0.0 [kvm-pit/19986]
MachineType: LENOVO 80UG
ProcKernelCmdLine: BOOT_IMAGE=
SourcePackage: qemu
UpgradeStatus: Upgraded to focal on 2019-12-22 (324 days ago)
dmi.bios.date: 08/09/2018
dmi.bios.vendor: LENOVO
dmi.bios.version: 0XCN45WW
dmi.board.
dmi.board.name: Toronto 4A2
dmi.board.vendor: LENOVO
dmi.board.version: SDK0J40679 WIN
dmi.chassis.
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.
dmi.modalias: dmi:bvnLENOVO:
dmi.product.family: IDEAPAD
dmi.product.name: 80UG
dmi.product.sku: LENOVO_
dmi.product.
dmi.sys.vendor: LENOVO
I found two options in QEMU that solve this problem: adding 'streams= on,command_ serr_enable= on' to the qemu-xhci (as -device qemu-xhci, streams= on,command_ serr_enable= on) will make the USB devices not reset on boot, so it's possible to use live USBs on a QEMU guest correctly.
I'm not aware of negative impacts these options have on guests as, so far, I noticed nothing wrong with the guests or the USB devices after using them.