How would you set the boot order on KVM when using libvirt/virsh? (Either via config or command)
Asked
Active
Viewed 5.2k times
2 Answers
23
Please take a look at the section Operation System booting.
The most common option is the BIOS bootloader where it allows you specifying boot order via changing domain XML. try command virsh edit <your-domain-name>
then adjust the boot order with this example (copied from libvirt.org):
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='network'/>
<boot dev='cdrom'/>
<boot dev='hd'/>
<bootmenu enable='yes'/>
</os>
Which means the boot order is:
- boot from network like PXE boot
- boot from CD-ROM if no PXE boot
- boot from local hard disk if no PXE boot nor bootable CD

shawnzhu
- 7,233
- 4
- 35
- 51
-
1So technically yes this is the answer... however editing the config directly and restarting the container will fix it more permanently. I figured this out after a few weeks of toying around with it. Anyway I'll give you the points since you did have the answer. – Bravo Delta Mar 04 '14 at 05:10
-
I found that `virsh dumpxml` followed by `virsh define` did the trick. (I didn't want to be doing this in an editor.) – mpontillo May 21 '15 at 05:53
-
I found it can specify boot order via virtual machine manager as well. see step 4 of this link: https://fedoraproject.org/wiki/QA:Testcase_Boot_Methods_Pxeboot – shawnzhu May 21 '15 at 20:47
-
Thanks. I am still confused. see https://unix.stackexchange.com/questions/505554/how-shall-i-change-boot-sequenct-of-a-virtual-machine-in-kvm – Tim Mar 11 '19 at 02:46
2
If you have multiple hard disks a better solution is to use
<boot order='1'/>
for the first device you want to boot and
<boot order='2'/>
for the 2nd etc
For more information see https://libvirt.org/formatdomain.html#elementsDisks

zymhan
- 107
- 2
- 7

Ronald Duncan
- 131
- 1
- 5