usb disk image and device pass-through treated differently

Bug #1020142 reported by Jamin W. Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qemu-kvm (Ubuntu)
Fix Released
Low
Unassigned
Precise
Won't Fix
Low
Unassigned
Quantal
Fix Released
Low
Unassigned
seabios (Ubuntu)
Fix Released
Undecided
Unassigned
Precise
Won't Fix
Low
Unassigned
Quantal
Fix Released
Undecided
Unassigned

Bug Description

It seems that an image dump from a USB device and passing through the actual device are treated differently by KVM. For instance, if I pass through a physical USB thumb drive I can select it from the virtual machine's boot menu. However, if I take an image dump of the very same thumb drive and then add it to the VM as a USB storage device, it does not appear as an option from the virtual machine's boot menu.

I would expect for the two to be functionally identical.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: kvm 1:84+dfsg-0ubuntu16+1.0+noroms+0ubuntu13
ProcVersionSignature: Ubuntu 3.2.0-26.41-generic 3.2.19
Uname: Linux 3.2.0-26-generic x86_64
ApportVersion: 2.0.1-0ubuntu8
Architecture: amd64
Date: Mon Jul 2 08:17:43 2012
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
KvmCmdLine: Error: command ['ps', '-C', 'kvm', '-F'] failed with exit code 1: UID PID PPID C SZ RSS PSR STIME TTY TIME CMD
MachineType: LENOVO 2436CTO
ProcEnviron:
 TERM=xterm
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.2.0-26-generic root=/dev/mapper/ssd-root ro vga=792 splash crashkernel=384M-2G:64M,2G-:128M quiet splash vt.handoff=7
SourcePackage: qemu-kvm
UdevDb: Error: [Errno 2] No such file or directory
UpgradeStatus: Upgraded to precise on 2012-04-27 (65 days ago)
dmi.bios.date: 05/25/2012
dmi.bios.vendor: LENOVO
dmi.bios.version: G5ET29WW (1.07 )
dmi.board.asset.tag: Not Available
dmi.board.name: 2436CTO
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvrG5ET29WW(1.07):bd05/25/2012:svnLENOVO:pn2436CTO:pvrThinkPadW530:rvnLENOVO:rn2436CTO:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 2436CTO
dmi.product.version: ThinkPad W530
dmi.sys.vendor: LENOVO

Revision history for this message
Jamin W. Collins (jcollins) wrote :
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for reporting this bug.

Can you show

1. the url for the usb image you created (or the iso assuming you used usb-creator-gtk)
2. the exact command you used to create the usb stick dump
3. the exact kvm command line which you used in both cases

I'll try to reproduce.

Changed in qemu-kvm (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Jamin W. Collins (jcollins) wrote :

ISO image used to create the USB stick (via usb-creator-gtk): ubuntu-12.04-alternate-amd64.iso

Command used to create the disk image of the USB stick: sudo dd if=/dev/sdc of=usb-sandisk.img

kvm command lines (based on virt-manager):

USB device pass-through (able to select USB boot from menu):
/usr/bin/kvm -M pc-1.0 -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -name usb-test -rtc base=utc -no-shutdown -boot order=c,menu=on -drive file=usb-test-hd.img,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -usb -device usb-host,hostbus=3,hostaddr=2,id=hostdev0

USB disk image (no USB boot option in menu)
/usr/bin/kvm -M pc-1.0 -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -name usb-test -rtc base=utc -no-shutdown -boot order=c,menu=on -drive file=usb-test-hd.img,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -usb -drive file=/home/jcollins/usb-sandisk.img,if=none,id=drive-usb-disk0,format=raw -device usb-storage,drive=drive-usb-disk0,id=usb-disk0

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Confirmed with precise. It works with upstream qemu git head. I have not yet tested quantal. The exact arguments I used with the dd'd usb image file (for the sake of brevity) were:

-m 1024 -boot order=c,menu=on -hda /home/serge/x.img -usb -usbdevice disk:format=raw:/home/serge/usb-sandisk.img -vnc :2 -monitor stdio --enable-kvm

Changed in qemu-kvm (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

works in quantal's qemu-kvm. will look for a commit to cherrypick to fix in precise.

Changed in qemu-kvm (Ubuntu Quantal):
status: Triaged → Fix Released
Changed in qemu-kvm (Ubuntu Precise):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

I wonder if it could be due to commit cf8ce30d03339861a46c31aa44c11279c282f2b0.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

No, that didn't help. The fix is probably around that area though. Will have to look more closely.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Looks like the fix came in somewhere between 65bb3a5c11b00671c1067ee27ea364b6d7e6e2ac and 0cc6a0f19e3de830eaa898ad31c0bc607470b8cb.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

No, I wasn't passing '-L /usr/share/qemu'. 65bb3a5c11b is actually good.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

It appears to be a race condition. When I hand-compile the precise-updates qemu-kvm tree on quantal

 ./configure --target-list=x86_64-softmmu && make -j3

and run

 cd x86_64-softmmu
 ./qemu-system-x86_64 -m 1024 -boot order=c,menu=on -hda /home/serge/x.img -usb -usbdevice disk:format=raw:/home/serge/usb-sandisk.img -vnc :2 -monitor stdio --enable-kvm -L /usr/share/qemu

then it does not show up in the boot menu. But when I strace it:

 cd x86_64-softmmu
 strace -f -o/tmp/qqq ./qemu-system-x86_64 -m 1024 -boot order=c,menu=on -hda /home/serge/x.img -usb -usbdevice disk:format=raw:/home/serge/usb-sandisk.img -vnc :2 -monitor stdio --enable-kvm -L /usr/share/qemu

it does.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Correction - in addition to the timing issue, the newer seabios is also required.

That could be due to seabios commit 2762de0867345d059ab70690f98144921f8e151b: usb: fix boot paths.

Changed in seabios (Ubuntu Quantal):
status: New → Fix Released
Changed in seabios (Ubuntu Precise):
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

cherrypicking the 'usb: fix boot paths' commit does not make it work even with strace, so more would be needed.

Revision history for this message
Steve Langasek (vorlon) wrote :

The Precise Pangolin has reached end of life, so this bug will not be fixed for that release

Changed in qemu-kvm (Ubuntu Precise):
status: Triaged → Won't Fix
Changed in seabios (Ubuntu Precise):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.