Return to

QEMU no boot device

Hi, I have been working on setting up gpu passthrough the last couple days and its been going well but I have ran into an issue. The problem I am running into is there are no boot devices when I power on the virtual machine. It drops me into an EFI shell with none of the options being bootable. From other examples I saw online, one of the entries in the EFI shell will have fs0 instead of BLK# to the left of the names.
Some misc information, I am running Arch kernel version 4.13.12 with the latest versions from the repositories. Im trying to install Windows 8.1 into a virtual machine. I have tried multiple ISOs and no luck.
libvirt XML:

<domain type='kvm'>
  <memory unit='KiB'>6144000</memory>
  <currentMemory unit='KiB'>6144000</currentMemory>
  <vcpu placement='static' current='7'>8</vcpu>
    <type arch='x86_64' machine='pc-i440fx-2.10'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/ovmf/ovmf_code_x64.bin</loader>
    <bootmenu enable='yes'/>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    <vmport state='off'/>
  <cpu mode='host-passthrough' check='partial'>
    <topology sockets='1' cores='4' threads='2'/>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/home/dan/Downloads/Win8.1.iso'/>
      <target dev='hda' bus='ide'/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/win8.1.qcow2'/>
      <target dev='hdb' bus='ide'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    <interface type='network'>
      <mac address='52:54:00:9f:cc:0d'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    <serial type='pty'>
      <target port='0'/>
    <console type='pty'>
      <target type='serial' port='0'/>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' autoport='yes'>
      <listen type='address'/>
      <image compression='off'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='2'/>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='3'/>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>

I have spent some time working on this and decided to go ahead and use the command line tools instead of gui tools. I found some tutorials on making a script to run the command qemu-system-x86_64 and found that the lines -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/ovmf_code_x64.bin and -drive if=pflash,format=raw,file=/tmp/my_vars.bin are the ones that are preventing me from booting. Without those two lines, I am able to boot properly. I am assuming that this is needed but looking at the arch wiki for setting up an OVMF-based guest VM in which it says to edit the qemu.conf and add:

nvram = [

So my thinking is that I dont need those two lines in my script since I had added that to my qemu.conf. Some direction would be helpful.

Here is the script I run:



if ps -A | grep -q $vmname; then
   echo "$vmname is already running." &
   exit 1


# use pulseaudio                                                                                                                                                                                                                             
export QEMU_AUDIO_DRV=pa
export QEMU_PA_SAMPLES=8192
export QEMU_PA_SERVER=/run/user/1000/pulse/native

cp /usr/share/ovmf/ovmf_vars_x64.bin /tmp/my_vars.bin

qemu-system-x86_64 \
  -name $vmname,process=$vmname \
  -machine type=q35,accel=kvm \
  -cpu host \
  -enable-kvm \
  -smp 4,sockets=1,cores=2,threads=2 \
  -m 6G \
  -mem-prealloc \
  -balloon none \
  -rtc clock=host,base=localtime \
  -vga qxl \
  -display gtk \
  -serial none \
  -parallel none \
  -soundhw hda \
  -device vfio-pci,host=02:00.0,multifunction=on \
  -device vfio-pci,host=02:00.1 \
  -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/ovmf_code_x64.bin \
  -drive if=pflash,format=raw,file=/tmp/my_vars.bin \
  -boot order=cd \
  -drive id=disk0,if=virtio,cache=none,format=raw,file=/home/dan/win.img \
  -drive file=/home/dan/Downloads/Windows8.1.iso,index=3,media=cdrom
   exit 0