Skip to contentSkip to conversation

ahci drive: how to make it non-bootable?

Qemu-devel Michael Tokarev 4 participants 9 messages May 7, 2012 – May 10, 2012

lore
Share & tools
lore
#0 lore raw

I'm trying to experiment with ahci, but can't even get my win guest to install drivers for it. My usualy procedure is, for an existing guest, to add a dummy drive of required type, boot the guest, let it to recognize the new device and to install drivers needed for it, shut it down and change boot drive to the one of required type. This worked fine so far, eg, for virtio or scsi.

But now I can't use the same technique for ahci.

qemu .. -drive file=winguest.raw,if=virtio \
-device ahci,id=a \
-drive file=dummy.raw,id=d,if=none \
-device ide-disk,bus=a.0,drive=d,bootindex=X

Now, no matter what I use for the bootindex parameter, the guest _always_ boots off a dummy ahci drive. Even using bootindex=-1 or some huge value, the guest still boots from ahci.

The only workaround I found so far is to boot using -boot menu=on, and manually choose the second entry (which is the virtio image), but obviously this is not good at all.

How to let the guest to boot from the virtio drive?

Thanks,

/mjt

#1 lore raw
Quoted 22 lines · Michael Tokarev

I'm trying to experiment with ahci, but can't even get my win guest to install drivers for it. My usualy procedure is, for an existing guest, to add a dummy drive of required type, boot the guest, let it to recognize the new device and to install drivers needed for it, shut it down and change boot drive to the one of required type. This worked fine so far, eg, for virtio or scsi.

But now I can't use the same technique for ahci.

qemu .. -drive file=winguest.raw,if=virtio \
-device ahci,id=a \
-drive file=dummy.raw,id=d,if=none \
-device ide-disk,bus=a.0,drive=d,bootindex=X

Now, no matter what I use for the bootindex parameter, the guest _always_ boots off a dummy ahci drive. Even using bootindex=-1 or some huge value, the guest still boots from ahci.

Quoted 7 lines

The only workaround I found so far is to boot using -boot menu=on, and manually choose the second entry (which is the virtio image), but obviously this is not good at all.

How to let the guest to boot from the virtio drive?

bootindex=1 for virtio
bootindex=2 for ahci

ordering in the boot menu then should be virtio first, ahci second, then everything else (cdrom, nic, ..).

cheers,
Gerd

Quoted 5 lines

Thanks,

/mjt

#2 lore raw
Quoted 28 lines · Gerd Hoffmann
Quoted 27 lines · Michael Tokarev

I'm trying to experiment with ahci, but can't even get my win guest to install drivers for it. My usualy procedure is, for an existing guest, to add a dummy drive of required type, boot the guest, let it to recognize the new device and to install drivers needed for it, shut it down and change boot drive to the one of required type. This worked fine so far, eg, for virtio or scsi.

But now I can't use the same technique for ahci.

qemu .. -drive file=winguest.raw,if=virtio \
-device ahci,id=a \
-drive file=dummy.raw,id=d,if=none \
-device ide-disk,bus=a.0,drive=d,bootindex=X

Now, no matter what I use for the bootindex parameter, the guest _always_ boots off a dummy ahci drive. Even using bootindex=-1 or some huge value, the guest still boots from ahci.

The only workaround I found so far is to boot using -boot menu=on, and manually choose the second entry (which is the virtio image), but obviously this is not good at all.

Quoted 4 lines
Quoted 2 lines

How to let the guest to boot from the virtio drive?

bootindex=1 for virtio

-drive file=winguest.raw,if=virtio,bootindex=1 --

this does not work:

qemu: -drive file=winguest.raw,if=virtio,bootindex=1: Invalid parameter 'bootindex'

I understand that I probably can replace this single -drive with 3 parameters -- -device virtio-blk-pci, -drive if=none, and -device ide-drive.

But this is already too much for ahci, so now I'm forced to use the same very long syntax for virtio and ide too? Is there a saner way?

Also, still, the question in the $subj: how to make the ahci drive non-bootable?

Quoted 7 lines

bootindex=2 for ahci

ordering in the boot menu then should be virtio first, ahci second, then everything else (cdrom, nic, ..).

cheers,
Gerd

Thanks,

/mjt

#3 lore raw

Hi,

Quoted 5 lines
Quoted 1 line

bootindex=1 for virtio

-drive file=winguest.raw,if=virtio,bootindex=1 --

this does not work:

Oops. I through it does, but seems this is only the case for the old & deprecated boot=on (and maybe even that only in qemu-kvm).

Review

Quoted 5 lines

qemu: -drive file=winguest.raw,if=virtio,bootindex=1: Invalid parameter 'bootindex'

I understand that I probably can replace this single

(quoted diff) +0 -2
-drive with 3 parameters -- -device virtio-blk-pci,
-drive if=none, and -device ide-drive.

It's two only:
-drive if=none,id=<name>,...
-device virtio-blk-pci,drive=<name>

Quoted 2 lines

Also, still, the question in the $subj: how to make the ahci drive non-bootable?

I think you can't.

seabios uses a few numbers just above 100 for the internal default ordering (hd first, then cdrom, then nic, then others) in case no bootindex is specified. So you can try bootindex=200, that should get ahci to the bottom of the boot menu, maybe that is good enougth.

cheers,
Gerd

#4 lore raw
Quoted 10 lines · Gerd Hoffmann

Hi,

Quoted 5 lines
Quoted 1 line

bootindex=1 for virtio

-drive file=winguest.raw,if=virtio,bootindex=1 --

this does not work:

Oops. I through it does, but seems this is only the case for the old & deprecated boot=on (and maybe even that only in qemu-kvm).

boot=on has been removed in qemu-kvm too. I had to resurrect it for Debian, so in debian it is supported still. And _that_ actually works, so I actually saved myself by providing the dropped feature. I can do the obvious (adding boot=on to the virtio drive) and it boots from it, despite the presence of ahci. Yay, thank you Gerd! :)

Quoted 9 lines

Review

Quoted 5 lines

qemu: -drive file=winguest.raw,if=virtio,bootindex=1: Invalid parameter 'bootindex'

I understand that I probably can replace this single

(quoted diff) +0 -2
-drive with 3 parameters -- -device virtio-blk-pci,
-drive if=none, and -device ide-drive.

It's two only:
-drive if=none,id=<name>,...
-device virtio-blk-pci,drive=<name>

Ok, at least it is not entirely insane :)

Quoted 9 lines
Quoted 2 lines

Also, still, the question in the $subj: how to make the ahci drive non-bootable?

I think you can't.

seabios uses a few numbers just above 100 for the internal default ordering (hd first, then cdrom, then nic, then others) in case no bootindex is specified. So you can try bootindex=200, that should get ahci to the bottom of the boot menu, maybe that is good enougth.

I tried 1000 - it still places ahci before virtio. Unless I use boot=on for virtio case.

I guess I'll remove the deprecation warning for Debian too, since this boot=on thing is the only sane way to specify boot drive... :(

Thank you!

/mjt

#5 lore raw
Quoted 28 lines · Michael Tokarev
Quoted 10 lines · Gerd Hoffmann

Hi,

Quoted 5 lines
Quoted 1 line

bootindex=1 for virtio

-drive file=winguest.raw,if=virtio,bootindex=1 --

this does not work:

Oops. I through it does, but seems this is only the case for the old & deprecated boot=on (and maybe even that only in qemu-kvm).

boot=on has been removed in qemu-kvm too. I had to resurrect it for Debian, so in debian it is supported still. And _that_ actually works, so I actually saved myself by providing the dropped feature. I can do the obvious (adding boot=on to the virtio drive) and it boots from it, despite the presence of ahci. Yay, thank you Gerd! :)

Quoted 9 lines

Review

Quoted 5 lines

qemu: -drive file=winguest.raw,if=virtio,bootindex=1: Invalid parameter 'bootindex'

I understand that I probably can replace this single

(quoted diff) +0 -2
-drive with 3 parameters -- -device virtio-blk-pci,
-drive if=none, and -device ide-drive.

It's two only:
-drive if=none,id=<name>,...
-device virtio-blk-pci,drive=<name>

Quoted 1 line

Ok, at least it is not entirely insane :)

That's the way you suppose to do that. Does it work if you specify bootindex for virtio this way? If it does then use it. Restoring deprecated hacks is not the way to deal with it. If it does not, then it is a bug that should be fixed.

Quoted 14 lines
Quoted 10 lines
Quoted 3 lines

Also, still, the question in the $subj: how to make the ahci drive non-bootable?

I think you can't.

seabios uses a few numbers just above 100 for the internal default ordering (hd first, then cdrom, then nic, then others) in case no bootindex is specified. So you can try bootindex=200, that should get ahci to the bottom of the boot menu, maybe that is good enougth.

I tried 1000 - it still places ahci before virtio. Unless I use boot=on for virtio case.

Quoted 6 lines

I guess I'll remove the deprecation warning for Debian too, since this boot=on thing is the only sane way to specify boot drive... :(

Thank you!

/mjt

--
Gleb.

#6 lore raw
Quoted 1 line · Gleb Natapov

On Tue, May 08, 2012 at 09:56:10PM +0400, Michael Tokarev wrote:

[]

Quoted 10 lines
Quoted 5 lines
Quoted 3 lines

It's two only:
-drive if=none,id=<name>,...
-device virtio-blk-pci,drive=<name>

Ok, at least it is not entirely insane :)

That's the way you suppose to do that. Does it work if you specify bootindex for virtio this way? If it does then use it. Restoring deprecated hacks is not the way to deal with it. If it does not, then it is a bug that should be fixed.

Using the "too verbose" version is, well, difficult to type, when you have to start many guests - eg, testing etc. That's why I think that 3 options for ahci drives is somewhat insane.

Technically there is no problem at all at combining, eg, -netdev and -device rtl8139, in the same way as current -drive file=foo,if=bar works, and it is MUCH easier to type and hence is MUCH user-friendly. And much less error-prone, too.

I think it'd be a good solution to allow bootindex and some other options to be recognizable in context of, eg -drive with if!=none, by combining options recognizable from if= with the ones recognizable by -drive. Ditto for -netdev..-device: let -netdev to recognize model=, and allow model-specific (e1000|8130|virtio-net-pci|whatever) to be recognized as well. This way there will be no need to specify id=foo and netdev=foo, the command line will be shorter and also more understandable.

Please don't say that the only sane option to start qemu guests is to use libvirt. Qemu has its great value exactly because it allows starting guests from command line, which is well-scriptable.

The old hacks which were prematurely removed from qemu-kvm makes the life easier for the _user_, which is the main target of the software. I'd love to stop using them but sometimes it is not possible. With this extboot thing, qemu-kvm dropped ability to boot from SCSI for example, and it turns out there are quite some users of this interface exists - despite the fact SCSI is broken, there is a proprietary bootrom exists etc -- we just broke users setups without providing viable alternative, which, to my view, is unacceptable.

Thanks,

/mjt

#7 lore raw

Il 09/05/2012 18:10, Michael Tokarev ha scritto:

Quoted 9 lines

The old hacks which were prematurely removed from qemu-kvm makes the life easier for the _user_, which is the main target of the software. I'd love to stop using them but sometimes it is not possible. With this extboot thing, qemu-kvm dropped ability to boot from SCSI for example, and it turns out there are quite some users of this interface exists - despite the fact SCSI is broken, there is a proprietary bootrom exists etc -- we just broke users setups without providing viable alternative, which, to my view, is unacceptable.

You were using a fork, and this implies some risks of things being broken when upstream decides to do differently (e.g. extboot vs. implementing boot support in SeaBIOS).

As far as I know, no feature was removed from upstream QEMU.

Paolo

#8 lore raw
In reply to Michael Tokarev
Quoted 9 lines · Michael Tokarev
Quoted 1 line · Gleb Natapov

On Tue, May 08, 2012 at 09:56:10PM +0400, Michael Tokarev wrote:

[]

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

It's two only:
-drive if=none,id=<name>,...
-device virtio-blk-pci,drive=<name>

Ok, at least it is not entirely insane :)

Quoted 9 lines
Quoted 4 lines

That's the way you suppose to do that. Does it work if you specify bootindex for virtio this way? If it does then use it. Restoring deprecated hacks is not the way to deal with it. If it does not, then it is a bug that should be fixed.

Using the "too verbose" version is, well, difficult to type, when you have to start many guests - eg, testing etc. That's why I think that 3 options for ahci drives is somewhat insane.

You are complaining to later. Verbose syntax is the only syntax going forward AFAIK. All other syntaxes are legacy and, as you can see, new devices will not support them.

But you didn't answer my question :) Does specifying bootindex correctly solves your problem?

Quoted 5 lines

Technically there is no problem at all at combining, eg, -netdev and -device rtl8139, in the same way as current -drive file=foo,if=bar works, and it is MUCH easier to type and hence is MUCH user-friendly. And much less error-prone, too.

For the record, I do not like this verbosity too.

Quoted 9 lines

I think it'd be a good solution to allow bootindex and some other options to be recognizable in context of, eg -drive with if!=none, by combining options recognizable from if= with the ones recognizable by -drive. Ditto for -netdev..-device: let -netdev to recognize model=, and allow model-specific (e1000|8130|virtio-net-pci|whatever) to be recognized as well. This way there will be no need to specify id=foo and netdev=foo, the command line will be shorter and also more understandable.

But I do not thing that correct solution is to support multiple command line syntaxes forever. Lets have one that works even if it is too verbose.

Quoted 3 lines

Please don't say that the only sane option to start qemu guests is to use libvirt. Qemu has its great value exactly because it allows starting guests from command line, which is well-scriptable.

I do not use libvirt. Verbose command line is still scriptable.

Quoted 3 lines

The old hacks which were prematurely removed from qemu-kvm makes the life easier for the _user_, which is the main target of the software.

What makes you think it was removed prematurely? If user refuses to learn proper command line syntax it will not be able to use more things than bootindex. AHCI for one and IIRC you need verbose syntax to enable vhost. Changing most of device properties require verbose syntax.

Quoted 3 lines

I'd love to stop using them but sometimes it is not possible. With this extboot thing, qemu-kvm dropped ability to boot from SCSI for example, and it turns out there are quite some users of this interface

That's the only example and extboot was never written for booting from SCSI, that was merely unintended side effect. LSI was always too broken to be used. Debian would be much better compiling it out from the start (IMHO).

Quoted 1 line

exists - despite the fact SCSI is broken, there is a proprietary

virtio-scsi is not broken.

Quoted 3 lines

bootrom exists etc -- we just broke users setups without providing viable alternative, which, to my view, is unacceptable.

Use proprietary bootrom.

--
Gleb.