QEMU won't boot anything

I have been attempting to setup a Windows 7 VM with GPU passthrough on Ubuntu 17.04 and have not had any success getting anything to boot, from hard drives, to ISOs, to even actual DVDs. I get the same result every time, QEMU telling telling me there are no bootable devices.

Here is my executable for the VM:

 #!/bin/bash

vmname="windows7vm"

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

else

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

cp /usr/share/OVMF/OVMF_VARS.fd /tmp/my_vars.fd

qemu-system-x86_64 \
-name $vmname,process=$vmname \
-machine type=pc,accel=kvm \
-cpu host \
-smp 3,sockets=1,cores=3,threads=1
-m size=4G \
-mem-path /run/hugepages/kvm \
-mem-prealloc \
-balloon none \
-rtc clock=host,base=localtime \
-vga none \
-nographic \
-serial none \
-parallel none \
-soundhw hda \
-usb -usbdevice host:1532:0214 -usbdevice host:1532:0043 \
-device vfio-pci,host=04:00.0,multifunction=on \
-device vfio-pci,host=04:00.1 \
-drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/tmp/my_vars.fd \
-boot order=dc \
-drive if=virtio,id=disk0,cache=none,format=raw,file=/dev/sdb
-drive file=/home/keith/WIN_VM/win7install.iso,index=1,media=cdrom \
-drive file=/home/keith/WIN_VM/virtio-win-0.1.141.iso,index=2,media=cdrom \

exit 0
fi

QEMU basically tells me

Boot failed: could not read the boot disk
Booting from DVD/CD...
Boot failed: Could not read from CDROM (code 0003)

and later:

No bootable device.

As well as the aforementioned issues, when I close the QEMU window, I am greeted with

 unknown keycodes `(unnamed)', please report to [email protected]
./WIN_VM/win7vm.sh: line 24: -m: command not found
./WIN_VM/win7vm.sh: line 41: -drive: command not found

in the terminal. I am relatively new to most of this virtualization stuff, however I am pretty familiar with linux. Any possible solutions are welcome. Thanks in advance :slight_smile:

Have you tried to use Virt-Manager?
You may be missing something in the configuration that you are doing. The GUI should help you do a good once over.

Did you ensure to install qemu-kvm?
You make calls to kvm features but they will not work without it.

Lines 23 and 40 are missing \

I’m not sure if that’s the root of your problem, but it’s not helping.

2 Likes

Good eye.