This question already has an answer here:

I've installed a system with Ubuntu Server 16.04 and have KVM installed on it (I selected "virtualization server" during the install, so KVM is likely configured correctly).

the problem: I'm unable to install a KVM guest using virt-install. It acts as if it can't read the install media.

I'm getting this error "Couldn't find hvm kernel ..." when trying to create the VM:

Starting install...
ERROR    Couldn't find hvm kernel for Ubuntu tree.
Domain installation does not appear to have been successful.

This is the script I'm using to try to create the VM; I run it using sudo.

#! /bin/bash
if [ ! -d /var/www/html/isos/ubus-docker ]; then
  mkdir -p /var/www/html/isos/ubus-docker
umount /var/www/html/isos/ubus-docker/
mount -o loop ~/iso/ubuntu-16.04.1-server-amd64.iso /var/www/html/isos/ubus-docker/
virt-install \
  --connect qemu:///system \
  --name ubus-docker \
  --memory maxmemory=4096,memory=512 \
  --vcpus 2 \
  --location http://heind-gb0/isos/ubus-docker/ \
  --extra-args "console=tty0 console=ttyS0,115200" \
  --os-variant ubuntu16.04 \
  --disk path=/dev/heind-gb0-vg/vm-ubus-docker \
  --network network=default \
  --virt-type kvm \
  --hvm \      
  --graphics none

When I visit http://heind-gb0/isos/ubus-docker/ in a web browser, I see a nice list of the files and directories in the root of the ISO. (I installed and configured nginx explicitly to serve this ISO.) (note: that's a local server running on the KVM host, so don't bother surfing to it :-))

I don't know how to troubleshoot this. Any help would be welcome.

(Note: I'm running Ubuntu Server, console only, no GUI. And I want to do the guest VM install entirely from the console as well.)

UPDATE: This does seem to be an issue introduced in a recent release of virt-manager. The issues is under discussion on the virt-tool-list list. And I'm looking through the source repo history to find working code and perhaps develop a patch to restore support for Ubuntu installation ISOs (and hoping someone more familiar with the code gets there first :-)).

UPDATE 2: It was an issue with the newer releases of virt-manager. Now fixed (see answer in comments below). Not sure when fix will make it into virt-manager packages though.

marked as duplicate by karel, Eric Carvalho, Charles Green, Elder Geek, Thomas Mar 9 at 8:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1. You do not need to specify "--hvm" as this is implied if you connect to a qemu-based hypervisor. 2. The man page says "This parameter may not be available if connecting to a Xen hypervisor on a machine without hardware virtualization support". Are you sure your CPU supports Virtualisation, and it is enabled in BIOS? – ridgy Aug 7 '16 at 11:16
  • @ridgy I'm sure the hardware supports virtualization. It's an i5-6200, but to confirm that the command "kvm-ok" yields "INFO: /dev/kvm exists" and "KVM acceleration can be used". – Dave Hein Aug 7 '16 at 12:18

I reported this issue to the virt-manager maintainers on their mailing list. See http://www.redhat.com/archives/virt-tools-list/2016-August/msg00009.html. You can follow that thread for more details. Knowing that this worked in Ubuntu 14.04 and not in Ubuntu 16.04 was key to resolving the problem.

Bottom line, this is fixed now in the master branch of https://github.com/virt-manager/virt-manager.

The commit that fixed it is: https://github.com/virt-manager/virt-manager/commit/3f15a489cda87f8028828d567848193dd2640a43

I'm not sure when this will make to the various virt-manager packages. But you can grab the source and run virt-install from there. (Note: you'll need to add some packages, and I created a Python virtual environment, so you might want to experiment on a VM before messing about with extra packages on a system you need to remain stable and clean.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.