Bug 801293

Summary: fix boot from host or redirected USB pen drives
Product: Red Hat Enterprise Linux 6 Reporter: Paolo Bonzini <pbonzini>
Component: seabiosAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: chayang, ehabkost, hdegoede, juzhang, michen, pbonzini, shu, sluo, tburke, virt-maint, xigao
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: seabios-0.6.1.2-15.el6 Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 12:55:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paolo Bonzini 2012-03-08 08:18:16 UTC
virtio-scsi support might have broken boot from redirected USB pen drives, because seabios does not support recovery from USB stalls.

Upstream patch that fixes it is commit cb721714570520c02ae48efc26d3c04b8548d973.

Comment 2 Chao Yang 2012-03-22 05:53:52 UTC
Hi Paolo,
 I am experiencing an issue that bootindex not work on scsi-disk if there is QEMU emulated usb-storage in cli. This issue does not exist if replace scsi-disk with virtio-blk-pci disk. Will your patch fix the issue?

 I am using seabios-0.6.1.2-12.el6.x86_64, qemu-kvm-0.12.1.2-2.253.el6.x86_64.
CLI:
-device virtio-scsi-pci,id=scsi-pci \
-drive file=/dev/chayang-ag/usb-device_virtio-scsi,if=none,id=drive-virtio-disk0,format=qcow2,serial=69-a2ad-85f195fee049,cache=none,werror=stop,rerror=stop,aio=native \
-device scsi-disk,bus=scsi-pci.0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=0,lun=0,bus=scsi-pci.0 \
...
-device usb-ehci,id=ehci \
-drive file=/dev/chayang-ag/usb-storage,if=none,id=drive-virio-disk1,format=qcow2,cache=none,werror=stop,rerror=stop,aio=native,serial=`uuidgen'
-device usb-storage,bus=ehci.0,drive=drive-virtio-disk1,id=virtio-disk1,port=1,removable=on

Comment 3 Chao Yang 2012-03-22 05:57:20 UTC
One thing additional:
Removing QEMU emulated usb-storage will make this issue disappeared.

Comment 4 Paolo Bonzini 2012-03-22 10:13:48 UTC
No, my fix is not for usb-storage, it is only for usb-host.

In general if you specify bootindex for one disk you want to specify it for all of them, including usb-storage.  This is also why bug 805413 is a little more than just a nice-to-have.

Comment 7 Chao Yang 2012-03-23 03:13:24 UTC
(In reply to comment #4)
> No, my fix is not for usb-storage, it is only for usb-host.
> 
> In general if you specify bootindex for one disk you want to specify it for all
> of them, including usb-storage.  This is also why bug 805413 is a little more
> than just a nice-to-have.

I specified bootindex for all disk, but still can't boot from scsi-disk whose bootindex was set to 0. Need I open a new bug to track this or bug 805413 will do it?

Comment 8 Paolo Bonzini 2012-03-23 11:37:07 UTC
Please give the exact commandlines and open a new bug.

Comment 9 Chao Yang 2012-03-23 12:55:34 UTC
(In reply to comment #8)
> Please give the exact commandlines and open a new bug.

I opened a new bug:
https://bugzilla.redhat.com/show_bug.cgi?id=806327

Comment 10 Sibiao Luo 2012-04-05 08:46:12 UTC
As the patch said: This is the simplest way to avoid breaking boot on USB sticks that stall when asked for the MODE SENSE page 4. Some old sticks do support the MODE SENSE command at all and just return a "medium may have changed" unit attention condition when SeaBIOS sends it! 
And use our testing USB sticks, i did not reproduce it so far, but i have no idea how to get a old sticks, so just verified this issue.

verified this issue with the following steps:
1.boot a guest with a passthrough physical USB stick assigned to guest with "-boot menu=on".
eg: # /usr/libexec/qemu-kvm -M rhel6.3.0 -cpu Penryn -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -name win7-sp1-64 -uuid `uuidgen` -drive file=/home/win7sp1-virtio-64.raw,format=raw,if=none,id=drive-virtio-disk0,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,scsi=off,bus=pci.0,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,sndbuf=0,id=hostnet0,vhost=on,script=/etc/qemu-ifup,downscript=no -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=05:1a:4a:02:1b:46,bus=pci.0 -device virtio-balloon-pci,id=ballooning -spice disable-ticketing,port=5931 -k en-us -vga qxl -global qxl-vga.vram_size=67108864 -monitor stdio -boot menu=on -nodefaults -device usb-ehci,id=ehci -device usb-host,hostbus=2,hostaddr=3,id=hostdev1,bus=ehci.0,port=1
2.press F12 during POST.
3.select to boot from USB stick. 

Verified this issue with the environment and test result as following: 
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-251.el6.x86_64
qemu-kvm-0.12.1.2-2.267.el6.x86_64
# rpm -q seabios
seabios-0.6.1.2-16.el6.x86_64
guest info:
guest_name: win7sp1-64
virtio-win: virtio-win-prewhql-0.1-24
Actual results:
after the step 2,
SeaBIOS (version seabios-0.6.1.2-16.el6)

gPXE (http://etherboot.org) - 00:04.0 CB00 PCI2.10 PnP BBS PMMDFE0@10 CA00

Press F12 for boot menu.

Select boot device:

1. USB MSC Drive Kingston DT 101 G2 PMAP
2. Virtio disk PCI:0:3
3. gPXE (PCI 00:04.0)
4. Legacy option rom

Above all, this issue has been fixed.

Comment 11 Paolo Bonzini 2012-04-05 16:08:17 UTC
The bug was reproducible with pretty much all sticks.  The reference to old sticks documented why we fixed it this way.

Comment 12 Eduardo Habkost 2012-04-23 18:53:13 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No documentation needed.

Comment 13 Sibiao Luo 2012-04-25 05:46:42 UTC
I have tested this issue,it works correctly for our products, all the test results have the USB boot device in the boot menu and can boot from the usb stick successfully on both the seabios-0.6.1.2-13.el6.x86_64 and seabios-0.6.1.2-19.el6.x86_64 version no matter the USB-passthrough or USB-redirect. 

I have communicated it with Paolo via email, he said that this bug was reported upstream. I think we can verify it according to the results of my tests. 

Test for USB-passthrough:
-------------------------
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-251.el6.x86_64
qemu-kvm-0.12.1.2-2.278.el6.x86_64
# rpm -qa | grep seabios
seabios-0.6.1.2-13.el6.x86_64
guest info:
rhel6.3_20120313_x86_64
1.create a USB device of from an winows 7 ISO via.
2.boot a rhel6.3_x86_64 guest with a passthrough physical USB stick assigned to guest using virtio-scsi.
# /usr/libexec/qemu-kvm -M rhel6.3.0 -cpu Penryn -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -name win7-sp1-64 -uuid `uuidgen` -drive file=/home/rhel6.3_20120313_x86_64-v7.qcow2,format=qcow2,if=none,id=drive-disk,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-disk,drive=drive-disk,scsi-id=0,lun=0,id=scsi_image,bootindex=1 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=05:1a:4a:02:0b:46,bus=pci.0,bootindex=2 -device virtio-balloon-pci,id=ballooning -spice disable-ticketing,port=5931 -k en-us -vga qxl -global qxl-vga.vram_size=67108864 -boot menu=on -readconfig /home/ich9-ehci-uhci.cfg -device usb-host,hostbus=2,hostaddr=3,id=hostdev1,bus=ehci.0,port=1 -device sga -serial stdio
3.press F12 during POST.
4.select to boot from USB stick. 

Actual result:
after the step 4, the guest can boot from the usb stick successfully.

SeaBIOS (version seabios-0.6.1.2-13.el6)

gPXE (http://etherboot.org) - 00:04.0 CB00 PCI2.10 PnP BBS PMM7FE0@10 CB00
                                                                               
Press F12 for boot menu.

Select boot device:

1. gPXE (PCI 00:04.0)
2. USB MSC Drive Kingston DT 101 G2 PMAP
3. virtio-scsi Drive QEMU QEMU HARDDISK 0.12
4. DVD/CD [ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD]
5. Legacy option rom


Test for USB-redirect:
----------------------
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-251.el6.x86_64
qemu-kvm-0.12.1.2-2.278.el6.x86_64
# rpm -qa | grep seabios
seabios-0.6.1.2-13.el6.x86_64
USB-host info:
# rpm -qa | grep usbredir
usbredir-0.4.3-1.el6.x86_64
guest info:
rhel6.3_20120313_x86_64

1.create a USB device of from an winows 7 ISO via.
2.boot a rhel6.3_x86_64 guest with a physical USB stick redirected to guest using virtio-scsi.
# /usr/libexec/qemu-kvm -M rhel6.3.0 -cpu Penryn -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -name win7-sp1-64 -uuid `uuidgen` -drive file=/home/rhel6.3_20120313_x86_64-v7.qcow2,format=qcow2,if=none,id=drive-disk,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-disk,drive=drive-disk,scsi-id=0,lun=0,id=scsi_image,bootindex=1 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=05:1a:4a:02:0b:46,bus=pci.0,bootindex=2 -device virtio-balloon-pci,id=ballooning -spice disable-ticketing,port=5931 -k en-us -vga qxl -global qxl-vga.vram_size=67108864 -boot menu=on -readconfig /home/ich9-ehci-uhci.cfg -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=ehci.0,port=1,debug=3 -device sga -serial stdio
3.press F12 during POST.
4.connect to guest with spicy and make sure check "auto redirect newly plugged in USB devices".
5.select the physical USB stick redirected from usb-host which are already via "Input -> Select USB Devices for redirection" in spicy.
6.press "Ctrl + Alt + Delete".
7.press F12 during POST and select to boot from USB stick.

Actual result:
after the step 7, the guest can boot from the usb stick successfully.
Google, Inc.
Serial Graphics Adapter 07/26/11
SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (mockbuild.redhat.com) Tue Jul 26 15:05:08 UTC 2011
4 0

SeaBIOS (version seabios-0.6.1.2-13.el6)

gPXE (http://etherboot.org) - 00:04.0 CB00 PCI2.10 PnP BBS PMM7FE0@10 CB00
                                                                               
Press F12 for boot menu.

Select boot device:

1. gPXE (PCI 00:04.0)
2. USB MSC Drive Kingston DT 101 G2 PMAP
3. virtio-scsi Drive QEMU QEMU HARDDISK 0.12
4. DVD/CD [ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD]
5. Legacy option rom

Comment 16 errata-xmlrpc 2012-06-20 12:55:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0802.html