1

I have KVM on centos7. I can create centos guests no problem using the following command but when I use it for any ubunti iso it will not work

virt-install -n ubuntu -r 2048 --os-variant=ubuntu19.04 --location=/mnt/FTP/appz/ubuntu-19.10-live-server-amd64.iso --disk /var/lib/libvirt/images/ubuntu_boot.img,size=10,device=disk,bus=virtio --graphics none -w bridge=br0,model=virtio --extra-args="console=tty0 console=ttyS0,115200"

I get errors

ERROR Couldn't find hvm kernel for Ubuntu tree. Domain installation does not appear to have been successful. If it was, you can restart your domain by running: virsh --connect qemu:///system start ubuntu otherwise, please restart your installation.

this thread led me to understand this is a problem with where the vmlinux kernel is on the image. Couldn't find hvm kernel for Ubuntu tree

any ideas how to get around this?

3
  • --location is not for booting ISO's. To boot from ISO you may not use --extra-args option. In short - you can boot ISO with BIOS or you can boot directly the kernel. If you boot kernel directly - you can add options, if you boot ISO - bootloader will boot kernel with predefined options. So, --location have to point to kernel image, not the bootable disk image of any type. To solve the problem read the virsh manual, unpack ISO and use --location myisofolder/
    – kab00m
    Mar 31, 2020 at 18:14
  • 1
    Previous comment is not entirely correct. --location can work with ISO if virt-install is new enough, 1.5.0 version. The reason this command is likely not working is because you are using an ubuntu live iso, which does not have a readily accessible kernel/initrd to pull. Use an ubuntu DVD or netinst iso and it should hopefully work Apr 1, 2020 at 22:57
  • I have browsed and tried with --location and several --cdrom up this whole tree. I have yet to find anthing that works. I don't get it... us.archive.ubuntu.com
    – gstlouis
    Apr 5, 2020 at 22:08

1 Answer 1

0

I finally got this working. I believe when I was trying to use a location too specific?
For example, I used this url to get it from netboot as I thought it had the linux kernel and initrd but failed again. http://us.archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/current/images/netboot/

I used this full command with url and it worked. This however installed the Ubuntu Focal Fossa (development branch) but whatever I think I can find it from here.

From what I can see any debian dist is a little more difficult to find the path compared to centos which I got working by using --location and the .iso.

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

UPDATED This is mostly due to a compatible kvm version of whatever operating system you are trying to install.

ubuntu offers cloud ubuntu versions for kvm you can download and have the image imported and its running. A good example of this here

qemu-img info can tell you the format of image, if you do not like qcow2 you can convert and vise versa doing

qemu-img convert -f qcow2 -O raw image.qcow2 image.img

In order to virt-install and boot an installation image, you need to find the correct one and point it to the base that searches for initrd.gz and vmlinuz... something along those lines... not fun finding one sometimes.

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.