7

This command:

virt-install   \
   --name bla  \
   --ram=1024  \
   --disk path=/home/me/libvirt/images/bla.qcow2,bus=virtio,size=10  \
   --location /home/me/Downloads/ubuntu-18.10-desktop-amd64.iso

Reports:

ERROR    Couldn't find hvm kernel for Ubuntu tree.

How can I fix this?

(Since there are many duplicate posts and answers with regard to this issue, I am answering it, too.)

8

Instead of using

 --location /home/me/Downloads/ubuntu-18.10-desktop-amd64.iso

use

 --cdrom /home/me/Downloads/ubuntu-18.10-desktop-amd64.iso

The difference is (from the man page):

-c CDROM , --cdrom=CDROM
File or device use as a virtual CD-ROM device for fully virtualized guests. It can
be path to an ISO image, or to a CDROM device. It can also be a URL from which to 
fetch/access a minimal boot ISO image. The URLs take the same format as described
for the "--location" argument. If a cdrom has been specified via the "--disk" 
option, and neither "--cdrom" nor any other install option is specified, the 
"--disk" cdrom is used as the install media.

-l LOCATION , --location=LOCATION
Distribution tree installation source. virt-install can recognize certain 
distribution trees and fetches a bootable kernel/initrd pair to launch the 
install. 

So the correct command in this case is:

virt-install   \
   --name bla  \
   --ram=1024  \
   --disk path=/home/me/libvirt/images/bla.qcow2,bus=virtio,size=10  \
   --cdrom /home/me/Downloads/ubuntu-18.10-desktop-amd64.iso
1
  • 1
    This advice makes it impossible to pass --initrd-inject any longer. – 0xC0000022L Apr 29 '20 at 21:10
3

Technically, you can use --location with an updated virt-install 1.5+ and args explained here from Cole Robinson. I tested it and it was true.

However getting a Ubuntu working with --location in my opinion is a pain in the a$$. I finally got it working with the following --location and full command:

virt-install -n ubuntuscrap -r 2048 --os-variant=ubuntu19 --location http://us.archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/  --disk /var/lib/libvirt/images/ubuntu20.img,size=10,device=disk,bus=virtio --graphics none -w bridge=br0,model=virtio --extra-args 'console=ttyS0,115200n8 serial' --force --debug

Make sure you explore the URL in --location to get the proper release of Ubuntu you want. I'm sure you'll have some trial and error to do...

With a CentOS .iso image I did not have this problem and used --location and it worked fine.

2

I found a solution:

mount -o ro /images/ubuntu-20.04-live-server-amd64.iso /mnt

cd /mnt

virt-install \
    --name myguest\
    --memory 4096 \
    --disk /vms/myguest.disk,size=40 \
    --cdrom /images/ubuntu-20.04-live-server-amd64.iso \
    --nographics \
    --os-type linux \
    --boot kernel=casper/vmlinuz,initrd=casper/initrd,kernel_args="console=ttyS0"

at the end of installation: virsh edit myguest (and remove kernel,initrd and args lines) virsh start myguest

1

If you use --cdrom in replace of --location you will loose some options like --extra-args ! This useful parameter could not be used in cooperation with --cdrom ! If you want to use --extra-args you must use --location !

If you like this parameter you must overcome to this problem such a different way!

If you want to overcome to this problem, you must know that .iso files are a type of compressed files, first of all! Yes! They are some special type of compressed files like .zip or .rar, .tar.gz and so etc.

You could learn how to extract them by following this link.

The reason that you got ERROR: Couldn't find hvm kernel for Ubuntu tree. is that your image(.iso file) doesn't include install/vmlinux file(vmlinuz file is not available directly in your root install folder)! Check the existence of this file by extracting .iso file( It must have vmlinuz file exactly within your root install folder).

If you couldn't find that, you must find other related .iso from ubuntu website which includes this desired file at this specific path!

It's remarkable that Ubuntu provides different .iso files like live iso, minimal iso and so etc for each distro and version and platform! You need just to look for much appropriate one.

Do your best and have fun.

1

I have been struggling with this problem while trying to install Ubuntu 20.04.1 server with virt-install. I have found some of answers helpful, but found a different solution.

First. The original question references a "Desktop" iso file. Though, the solution in regards to a "live-server-amd64.iso" where mounting the ISO to /mnt, was actually helpful for me in getting my install to kick start.

However, my install ended up moving way to slowly. I'm not entirely certain why it was so slow. The install ultimately crashed when I tried to cancel the updates that were taking forever. There is another solution though, that doesn't involve mounting the ISO and providing those kernel boot options.

There is a legacy (non-live) version of Ubuntu 20.04.1 server available.

http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/

Found it on this thread over here.

Non-live Ubuntu Server 20.04 release

With the Legacy version of 20.04.1 server, it will actually run with the --location parameter instead of the --cdrom parameter, thereby enabling the --extra-args console=ttyS0 options.

0
0

This can be fixed by upgrading 'virt-install' to v2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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