virtio cdrom detected as hard disk

Bug #1155403 reported by Phillip Susi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Invalid
Undecided
Unassigned
debian-installer (Ubuntu)
New
Undecided
Unassigned
qemu (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

Trying to install Ubuntu or Debian using virtio to emulate the cdrom fails. This appears to be due to the drive appearing to be a hard disk, rather than a cdrom, despite the media=cdrom argument to qemu.

I'm not sure if this is a bug in qemu, or the kernel virtio driver?

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

Could you please give the exact command line you're using, and your release and qemu package versions?

Changed in qemu-kvm (Ubuntu):
status: New → Incomplete
Revision history for this message
Phillip Susi (psusi) wrote :

The current raring version, which appears to be 1.4.0+dfsg-1expubuntu3. Also I guess this should be under just the "qemu" package now rather than -kvm.

The command line is qemu -drive file=whatever.iso,if=virtio,media=cdrom. With or without the media argument seems to make no difference; either way udev thinks the drive is a disk, not a cdrom.

affects: qemu-kvm (Ubuntu) → qemu (Ubuntu)
Changed in qemu (Ubuntu):
status: Incomplete → New
Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 1155403] Re: virtio cdrom detected as hard disk

Are you sure the cdrom image is valid? It works fine for me, with

kvm -drive file=raring-mini-amd64.iso,if=virtio,media=cdrom -drive file=x.img,if=virtio,cache=none -m 1024

using either the latest raring full server iso, or a minimal netinst image from

release=raring
arch=amd64
f=${release}-mini-${arch}.iso
wget -O $f http://archive.ubuntu.com/ubuntu/dists/${release}/main/installer-${arch}/current/images/netboot/mini.iso

 status: incomplete

Changed in qemu (Ubuntu):
status: New → Incomplete
Revision history for this message
Phillip Susi (psusi) wrote :

Are you sure you booted from the cd, not the hd? I'm using the raring-server-amd64.iso and it doesn't work. It has also been reported in debian:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=+689528

Looking at the output of udevadm info --query --path=/dev/vda it is pretty obvious what the problem is: it looks like a hard disk, not a cdrom, and cdrom-detect is looking for a cdrom.

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

Quoting Phillip Susi (<email address hidden>):
> Are you sure you booted from the cd, not the hd? I'm using the raring-
> server-amd64.iso and it doesn't work. It has also been reported in

Yes. However I just noticed that if I list the hard drive first, then
it boots from the hd. If I list the cdrom first, it boots from the cd.
Unless that doesn't work for you, I'm marking this low priority as there
is a workaround.

Thanks.

 status: confirmed
 importance: low

Changed in qemu (Ubuntu):
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Phillip Susi (psusi) wrote :

Order does not matter, and it isn't whether it boots or not, but whether the installer will mount the cdrom. If you are using the netinst iso, then it doesn't bother looking for the cdrom since it downloads everything from the net.

Changed in qemu (Ubuntu):
importance: Low → Medium
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

I see, misunderstood.

Reproduced with latest git://git.qemu.org/qemu.git as well, so marked as affecting upstream QEMU project.

Revision history for this message
Paolo Bonzini (bonzini) wrote :

There's no such thing as a virtio-blk CD-ROM, only hard-disks. For installation it shouldn't matter, since .iso images usually can work also as hard-disk images (for putting them on a USB stick).

If you want to test installation from a "real" virtio CD-ROM, use virtio-scsi:

-drive file=/path/to/file.iso,if=none,id=cd -device virtio-scsi-pci -device scsi-cd,drive=cd

or

-drive file=/path/to/file.iso,if=none,media=cdrom,id=cd -device virtio-scsi-pci -device scsi-disk,drive=cd

Changed in qemu:
status: New → Invalid
Changed in qemu (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Phillip Susi (psusi) wrote :

It seems the installer does not consider virtio devices when doing its search. It also seems the installer does not have the virtio-scsi module, and it seems a bit wasteful to go through a layer of scsi emulation.

Shouldn't qemu at least warn you that the media=argument does nothing on virtio devices instead of silently ignoring it? Or better yet, shouldn't it automatically use virtio-scsi instead?

Revision history for this message
Laszlo Ersek (lacos-caesar) wrote :

Consider filing a Debian/Ubuntu bug so that their initramfs / installer / live disk comes with virtio-scsi. See eg. https://bugzilla.redhat.com/show_bug.cgi?id=864012

Revision history for this message
Paolo Bonzini (bonzini) wrote :

> It seems the installer does not consider virtio devices when doing its search.

That's another bug in the installer then.

> it seems a bit wasteful to go through a layer of scsi emulation.

Indeed treating the virtio disk similarly to installation from a USB stick is better, but SCSI emulation is actually a very good way to not reinvent the wheel. CD-ROM/DVD-ROM media need a lot of magic (such as subdivision of the medium into tracks, different media formats, etc.) and emulating those in virtio-blk would be even more wasteful.

> Shouldn't qemu at least warn you that the media=argument does nothing
> on virtio devices instead of silently ignoring it?

Yes, that's a legitimate request.

> Or better yet, shouldn't it automatically use virtio-scsi instead?

No, virtio-scsi is relatively new and not all distros have picked it up yet.

Revision history for this message
Phillip Susi (psusi) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 3/18/2013 5:13 AM, Paolo Bonzini wrote:
>> Or better yet, shouldn't it automatically use virtio-scsi
>> instead?
>
> No, virtio-scsi is relatively new and not all distros have picked
> it up yet.

And not all distros ship hybrid cd images that their installers are
happy with on virtio. Given that either one may or may not work, I
think it best to honor the user's request and emulate the cd.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRRyMqAAoJEJrBOlT6nu75oS0H+gKIa82bhNHecAmiBHk2AWxR
KqoJRyPffR2BKjjgVgGqLciIBW7ltNkP8Dbqg8I7E7eHtNMX1z5dNScbmMXCHkrM
Hbvh/op6fvtFn0x6K+OwIkE8/Sm0AhqgIWdv2FnfR9rRRHxlz99R26Gq/qPJqZD9
Pleo6MhgjDBftGbxwJd3hlzSA5Yw5Q90SC1o2rOwi3KLDMm7zRHmMj/Tm/ScflyJ
Ujo+H09tqUsm5VXsLtDsgfnUDxE42CQrczSeS0/c7+4mTPNvulwxoqisztbcY1xI
O9F+JC5fz4yoDVX5rz97rN8HSHsLeCV1v6k5f9cD1TjzgqSRKRjyAIItor8Bw44=
=Mwf8
-----END PGP SIGNATURE-----

Revision history for this message
Paolo Bonzini (bonzini) wrote :

if=virtio means virtio-blk, not virtio-something.

Also, Linux is perfectly fine with ISO images on virtio, the Ubuntu installer is wrong in not scanning virtio disks. Since Ubuntu wouldn't work either way, they should first fix the installer and then we can re-evaluate if QEMU can do something (probably not, except warning for media=cdrom).

Revision history for this message
Phillip Susi (psusi) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 3/18/2013 11:17 AM, Paolo Bonzini wrote:
> if=virtio means virtio-blk, not virtio-something.

Why do you say that? I would say that virtio means use
paravirtualized IO rather than emulating some real hardware. Whether
that ends up being done with virtio-blk, or virtio-scsi is an
implementation detail. The media argument seems a perfectly natural
way to select between the two.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRR0hBAAoJEJrBOlT6nu758/YH/3zkuv+yQuyqVzk98wWGCy6V
gQOvYyir86but7EmbO/VoY4i+0Oyza3II/qKFeqW4KnIjQ7aS1sJSUsXGU1Wxjoa
lxF9zKYM3A7XRIpgnSrIwIL5CvNDZ+zohhiL5sWEp0NVr+fxqSIwFFxpkAb8K5Yi
EZWYmg3bwbCw2Ac5qqIs79j7VvPZfeSpwujlOG/frLwF5tjF73JkvkCOIpqYXaEc
3cDAdsdFofQ/Q7xUy58GStbswUXw9lqkIGJTi7xC8PHqCMq0TKOTw8FDgdmyJ+f9
k8+PkwbhqoZL+5N7ZmVCqj/Zo1Sq0p/QYUx4jBO4Ok6bTNZKnTDbcXo5O2Fg4ss=
=Gv0p
-----END PGP SIGNATURE-----

Revision history for this message
Paolo Bonzini (bonzini) wrote :

> The media argument seems a perfectly natural
> way to select between the two.

Then how do you distinguish between a virtio-scsi and a virtio-blk hard disk? These may even require changes to the guest, since one becomes /dev/vda and the other becomes /dev/sda.

virtio-scsi will grow more and more functionality, while virtio-blk will likely remain a secondary choice for performance or backwards-compatibility.

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.