Bug 609049

Summary: qemu does not implement the scsi "READ DISC INFORMATION" command for cdroms
Product: [Fedora] Fedora Reporter: Harald Hoyer <harald>
Component: qemuAssignee: Justin M. Forbes <jforbes>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: urgent    
Version: 14CC: alekcejk, amit.shah, awilliam, berrange, crobinso, dwmw2, ehabkost, fdc, gcosta, itamar, Jasper.Hartline, jaswinder, jforbes, kevin, knoel, markmc, ondrejj, petersen, pfrields, rhe, scottt.tw, virt-maint, vmlinuz386
Target Milestone: ---Flags: petersen: fedora_requires_release_note?
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: AcceptedBlocker
Fixed In Version: udev-161-1.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-10 20:20:35 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 611991    
Attachments:
Description Flags
desktop-i386-20100805.20.iso boots fine none

Description Harald Hoyer 2010-06-29 06:01:42 EDT
# /lib/udev/cdrom_id --debug /dev/sr0
/lib/udev/cdrom_id --debug /dev/sr0
main: probing: '/dev/sr0'
cd_inquiry: INQUIRY: [QEMU    ][QEMU DVD-ROM    ][0.12]
cd_profiles: GET CONFIGURATION: size of features buffer 0x0010
cd_profiles: GET CONFIGURATION: feature 'profiles', with 2 entries
feature_profiles: profile 0x10 dvd_rom
feature_profiles: profile 0x08 cd_rom
cd_profiles: current profile 0x08
cd_profiles: profile 0x08 media_cd_rom
info_scsi_cmd_err: READ DISC INFORMATION failed with SK=5h/ASC=20h/ACQ=00h
ID_CDROM=1
ID_CDROM_CD=1
ID_CDROM_DVD=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_CD=1


qemu reports: ASC=20h/ACQ=00h

The scsi command is 0x51.
see page page 91:
http://www.13thmonkey.org/documentation/SCSI/x3_304_1997.pdf
Comment 1 Gerardo Exequiel Pozzi 2010-06-29 20:12:17 EDT
Additional note: This only fail with IDE cd-rom, SCSI cd-rom works OK

With "-drive file=xyz.iso,if=scsi,media=cdrom" works fine, but with "-drive file=xyz.iso,if=ide,media=cdrom" (or directly -cdrom) fails.
Comment 2 Harald Hoyer 2010-06-30 06:07:06 EDT
*** Bug 608918 has been marked as a duplicate of this bug. ***
Comment 3 Kevin Fenzi 2010-07-15 00:55:55 EDT
Any news here? This still occurs here with an image from today. 

Sadly, I don't see any easy way to get libvirt to use a scsi instead of IDE cdrom, so it's anoying to work around.
Comment 4 nucleo 2010-07-15 08:29:03 EDT
Live images also doesn't boot in vmware and from USB created with livecd-iso-to-disk on real hardware.
Comment 5 nucleo 2010-07-15 08:29:38 EDT
(In reply to comment #4)
> Live images also doesn't boot in vmware and from USB created with
> livecd-iso-to-disk on real hardware.    

https://bugzilla.redhat.com/show_bug.cgi?id=613213
Comment 6 Harald Hoyer 2010-07-27 03:44:48 EDT
*** Bug 618517 has been marked as a duplicate of this bug. ***
Comment 7 Bug Zapper 2010-07-30 08:17:47 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 8 Kevin Fenzi 2010-08-02 19:40:29 EDT
Any news at all here? 

Not being able to boot live media here makes testing a pain. ;( 

Hopefully we have the other issues fixed now (livecd-tools fix to find syslinux files in the right place so you don't get a black screen on boot and squashfs corruption that would result in no root found). 

So, any news on this? Do we even know what version(s) of qemu are affected?
Comment 9 Amit Shah 2010-08-03 00:40:05 EDT
A quick workaround would be to have libvirt/virt-manager add code to attach CD drives on the scsi bus.

I'm doubtful this is related to the read disc info command, as even the scsi implementation doesn't emulate that cmd. It could be something totally different in qemu code that hasn't been exposed so far.

Can anyone point me to changes in the livecd creator tools that I might go through to identify what could've caused this?

Also, can someone try creating a livecd from older (F13) livecd creator tools to verify this is really some change in the livecd creator tools causing this regression?

Thanks
Comment 10 Jasper O'neal Hartline 2010-08-03 02:07:47 EDT
I believe the cdrom_id code is what you want to check into.
The reporter reports that cdrom_id doesn't read things correctly, or come up with the correct data, cdrom_id is in udev in /lib/udev/cdrom_id
Comment 11 Harald Hoyer 2010-08-03 04:03:58 EDT
(In reply to comment #8)
> Any news at all here? 
> 
> Not being able to boot live media here makes testing a pain. ;( 
> 
> Hopefully we have the other issues fixed now (livecd-tools fix to find syslinux
> files in the right place so you don't get a black screen on boot and squashfs
> corruption that would result in no root found). 
> 
> So, any news on this? Do we even know what version(s) of qemu are affected?    

but you can boot and test with: -drive file=xyz.iso,if=scsi,media=cdrom
Comment 12 Jasper O'neal Hartline 2010-08-03 04:40:00 EDT
In reply to Comment 11
Apparently you can't use Qemu like that, here is a screenshot:
http://autopsy.liveprojects.info/external/extra/qemu-broke.png

qemu -drive testing.iso,if=scsi,media=cdrom does not work as advertised.
Comment 13 Jasper O'neal Hartline 2010-08-03 04:42:42 EDT
Same thing with 
qemu -drive file=testing.iso,if=scsi,media=cdrom
http://autopsy.liveprojects.info/external/extra/qemu-broke1.png
Comment 14 Jasper O'neal Hartline 2010-08-03 04:48:27 EDT
Using this with Qemu DOES work here:
qemu -drive file=testing.iso,if=ide,media=cdrom


http://autopsy.liveprojects.info/external/extra/qemu-works.png

You have to use if=ide not if=scsi apparently.
Still Qemu is broken in regards to the SCSI command.
Comment 15 Jens Petersen 2010-08-03 05:27:41 EDT
Is that any different from "-boot d -cdrom test.iso"?

Anyway still doesn't help to boot Fedora 14 Live, AFAICT.
Comment 16 Jasper O'neal Hartline 2010-08-03 05:45:17 EDT
Right, it seems the F14 Live spins won't boot in qemu, of any version because it doesn't implement these calls, which come from cdrom_id and which is in udev
WHICH is needed to get information about the drive.

Even using if=ide on the F14 live images fails after cdrom_id is called in the initramfs's udev sections.

These F14 live spins are what alot of people use in Qemu also do to thier testing, so this needs to be filed upstream if it is in fact a Qemu issue.
http://wiki.qemu.org/Main_Page
Comment 17 Jasper O'neal Hartline 2010-08-03 05:52:28 EDT
Without any further ado, I have decided to go ahead and file this upstream:
https://bugs.launchpad.net/qemu/+bug/612901
Comment 18 Kevin Fenzi 2010-08-03 11:31:14 EDT
(In reply to comment #9)
> A quick workaround would be to have libvirt/virt-manager add code to attach CD
> drives on the scsi bus.

Yeah. 

> I'm doubtful this is related to the read disc info command, as even the scsi
> implementation doesn't emulate that cmd. It could be something totally
> different in qemu code that hasn't been exposed so far.
> 
> Can anyone point me to changes in the livecd creator tools that I might go
> through to identify what could've caused this?

http://git.fedorahosted.org/git/?p=livecd;a=summary
 
> Also, can someone try creating a livecd from older (F13) livecd creator tools
> to verify this is really some change in the livecd creator tools causing this
> regression?

I can try and do this today...
Comment 19 Jens Petersen 2010-08-05 02:21:03 EDT
(In reply to comment #9)
> Also, can someone try creating a livecd from older (F13) livecd creator tools
> to verify this is really some change in the livecd creator tools causing this
> regression?

I am pretty sure this is the case: F13 spins boot fine but not F14.
So the changes are in the F14 tree not livecd-tools.
Comment 20 Jens Petersen 2010-08-05 02:24:23 EDT
Adding F14Beta blocker.

https://fedoraproject.org/wiki/Fedora_14_Beta_Release_Criteria

12. The release must boot successfully as a virtual guest in a situation where the virtual host is running the same release (using Fedora's current preferred virtualization technology)
13. The release must boot successfully as a virtual guest in a situation where the virtual host is running the previous stable Fedora release (using Fedora's current preferred virtualization technology)
Comment 21 Amit Shah 2010-08-05 06:09:47 EDT
I just tried the F14-TC2 x86_64 cd and that boots fine upto Anaconda.

That rules out guest kernel issues.

What we have remaining then is the livecd-creator tools or some new instructions being used which the kvm emulator gets confused about.

Acc. to comment 19, this could be a syslinux issue (or, again, host kvm emulator issue).
Comment 22 Jasper O'neal Hartline 2010-08-05 10:13:35 EDT
In reply to Comment 21
I believe the problem we're seeing this with is the Live RAWHIDE spins.
From herE: http://alt.fedoraproject.org/pub/alt/nightly-composes/
Comment 23 Jasper O'neal Hartline 2010-08-05 10:28:15 EDT
In reply to comment 21
From what I can tell teh initrd.img doesn't use dracut initramfs and although /lib/udev/cdrom_id is in the initrd it isn't used apparently.

This maybe why the Live images don't work in Qemu but the install media does.
You might look at /sbin/init and /sbin/loader source code to see how it handles things differently than using dracut initramfs and how it uses cdrom_id to find out information about the CDROM drive and discs.
Comment 24 Amit Shah 2010-08-05 13:46:33 EDT
This could actually be due to Bug 617115.
Comment 25 Kevin Fenzi 2010-08-05 13:55:29 EDT
Nope. The latest nightlys have a livecd-tools that has the fix for that bug, it's not that. 

syslinux comes up, the kernel starts booting, then it dies with cannot find rootfs. ;( 

Perhaps we could run thru another round of dracut testing to isolate it more?
Comment 26 Jasper O'neal Hartline 2010-08-05 15:23:39 EDT
I think there are only two solutions here, well 3 if you count the unacceptable one:

1) Don't use Qemu
2) Implement the SCSI command haraldh has described is not implemented in Qemu
3) Break open an initramfs, try to work around uding cdrom_id to find information about the drive discs, or make it use some other implemented command.

When was the last time udev was updated that caused this to happen all of a sudden?
Comment 27 Jasper O'neal Hartline 2010-08-05 15:28:22 EDT
From my F13 updated box, I see this:
What about for F14 udev?

* Tue Apr 27 2010 Harald Hoyer <harald@redhat.com> 151-9
- more cdrom_id bugfixes to prevent autoclosing

* Tue Apr 13 2010 Harald Hoyer <harald@redhat.com> 151-8
- more cdrom_id bugfixes for buggy cdroms and CD burning
  (bug #577659)
https://bugzilla.redhat.com/show_bug.cgi?id=577659

I have yet to see the relevance though of this Qemu bug, and livecds having to do with livecd-tools. Just a really good feeling it has not much to do with livecd-tools whatsoever.
Comment 28 Jasper O'neal Hartline 2010-08-05 19:18:00 EDT
Harold, I'm just curious if there would be reason to work around this issue, until Qemu implements this command by not failing when READ_DISC_INFORMATION doesn'tr return with anything valid.

Currently it breaks in any emulation software which doesn't implements this, and this is of course Qemu so we know it wouldn't fail on real hardware.

Is there any way to be less aggressive about returning this specific command information back to udev? What is it used for?

I think READ_DISC_INFORMATION is supposed to return with a 16 byte value, what does it normally return when there is a disc in the drive, which structures?


Is there any work around to this?
Comment 29 Harald Hoyer 2010-08-06 03:38:59 EDT
(In reply to comment #27)
> From my F13 updated box, I see this:
> What about for F14 udev?
> 
> * Tue Apr 27 2010 Harald Hoyer <harald@redhat.com> 151-9
> - more cdrom_id bugfixes to prevent autoclosing
> 
> * Tue Apr 13 2010 Harald Hoyer <harald@redhat.com> 151-8
> - more cdrom_id bugfixes for buggy cdroms and CD burning
>   (bug #577659)
> https://bugzilla.redhat.com/show_bug.cgi?id=577659
> 
> I have yet to see the relevance though of this Qemu bug, and livecds having to
> do with livecd-tools. Just a really good feeling it has not much to do with
> livecd-tools whatsoever.    

These fixes are already in F14.. I just backported some fixes to the F13 udev-151 version.
Comment 30 Harald Hoyer 2010-08-06 11:07:48 EDT
This works fine for me:

# qemu-kvm -drive file=Fedora-13-i686-Live.iso,if=scsi,media=cdrom,boot=on
Comment 31 Paul W. Frields 2010-08-06 11:29:37 EDT
Is that what virt-manager uses by default in this situation?  Or am I asking the wrong question here?
Comment 32 Harald Hoyer 2010-08-06 11:41:38 EDT
Created attachment 437185 [details]
desktop-i386-20100805.20.iso boots fine

$ sudo qemu-kvm -m 512M -drive file=~/Download/desktop-i386-20100805.20.iso,if=scsi,media=cdrom,boot=on
Comment 33 Harald Hoyer 2010-08-06 11:44:23 EDT
$ rpm -qf $(which qemu-kvm)
qemu-system-x86-0.13.0-0.2.20100727gitb81fe95.fc14.x86_64
Comment 34 Harald Hoyer 2010-08-06 12:19:48 EDT
Hmm, I wonder why that worked...

# /lib/udev/cdrom_id -d /dev/sr0
main: probing: '/dev/sr0'
cd_media_compat: CDROM_DRIVE_STATUS != CDS_DISC_OK
cd_inquiry: INQUIRY: [QEMU    ][QEMU DVD-ROM    ][0.12]
cd_profiles: GET CONFIGURATION: size of features buffer 0x0010
cd_profiles: GET CONFIGURATION: feature 'profiles', with 2 entries
feature_profiles: profile 0x10 dvd_rom
feature_profiles: profile 0x08 cd_rom
cd_profiles: no current profile, assuming no media
ID_CDROM=1
ID_CDROM_CD=1
ID_CDROM_DVD=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
Comment 35 Adam Williamson 2010-08-06 12:40:05 EDT
*** Bug 621102 has been marked as a duplicate of this bug. ***
Comment 36 Adam Williamson 2010-08-06 12:42:22 EDT
note 621102 dupe: this also has the effect of causing DVD installs to not find the DVD and turn into network installs instead. This is accepted as a beta blocker: "The release must boot successfully as a virtual guest in a situation where the virtual host is running the same release (using Fedora's current preferred virtualization technology)".
Comment 37 Fedora Update System 2010-08-06 12:49:56 EDT
udev-160-9.fc14 has been submitted as an update for Fedora 14.
http://admin.fedoraproject.org/updates/udev-160-9.fc14
Comment 38 Harald Hoyer 2010-08-06 12:50:59 EDT
with udev-160-9.fc14, things should work as expected with "-cdrom". Added a quirk.
Comment 39 Harald Hoyer 2010-08-06 13:05:19 EDT
(In reply to comment #38)
> with udev-160-9.fc14, things should work as expected with "-cdrom". Added a
> quirk.    

This will not work with multiple sessions and multiple tracks, though.

A correct implementation would really be cool.
Comment 40 Adam Williamson 2010-08-06 13:20:18 EDT
am about to do a local live compose to test this.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 41 Adam Williamson 2010-08-06 15:18:16 EDT
this looks good: the test live compose booted. previous live composes didn't.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 42 Fran├žois Cami 2010-08-08 09:50:59 EDT
OK, in the meantime I've reproduced on F13 hosts using the latest compose (with 
udev-160-8.fc14).

The workaround for booting such livecds in F13 host, using virt-install, is:
virt-install --name <name> -r <ram> --vcpus=<> --os-type=linux
--os-variant=fedora13 --import --disk path=/path/to/f14.iso,bus=scsi,format=iso
--disk path=/path/to/drive.img,sparse=true,size=10,bus=virtio,cache=writeback
-b br1 --vnc --accelerate 

-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 43 Fedora Update System 2010-08-09 21:31:56 EDT
udev-160-9.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update udev'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/udev-160-9.fc14
Comment 44 Fedora Update System 2010-08-10 20:20:24 EDT
udev-160-9.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 45 He Rui 2010-08-11 05:24:53 EDT
Verified media package repo selected automatically during F14-Alpha-rc3-i386-DVD.iso virt-install.
Comment 46 Jasper O'neal Hartline 2010-08-11 09:46:03 EDT
Comment 45 means to say that this bug was also causing DVD media repo, to not be able to find the CDROM and ends up doing a network install instead.

Apparently that is what he means, that the QEMU bug has been worked around.
Comment 47 Fedora Update System 2010-08-17 05:44:02 EDT
udev-161-1.fc14 has been submitted as an update for Fedora 14.
http://admin.fedoraproject.org/updates/udev-161-1.fc14
Comment 48 Fedora Update System 2010-08-23 21:32:04 EDT
udev-161-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.