Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't find hvm kernel for Ubuntu tree

My server environment is centos7.3,I want to install kvm Ubuntu16.04 on it.My installation commands are as follows:

virt-install --name demo01 --ram 4096 \
--disk path=/var/lib/libvirt/images/demo01.img,size=90 \
--vcpus 2 --os-type linux --os-variant ubuntunatty \
--network bridge=br0 --graphics none --console pty,target_type=serial \ 
--location /workspace/ubuntu-16-server.iso \
--extra-args 'console=ttyS0,115200n8 serial' --host-device 04:00.0 \ 
--features kvm_hidden=on --machine q35 \

Then an error happened:

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 demo01
otherwise, please restart your installation.
like image 697
bing Avatar asked Dec 02 '25 23:12

bing


1 Answers

Tested solution for Ubuntu 20.04 Server with my extra args for autoinstall:

virt-install \
  --name=$VMNAME \
  --os-variant=ubuntu20.04 \
  --memory=2048 \
  --vcpus=1 \
  --network network=default \
  --disk=${IMG_PATH},cache=none,format=qcow2,bus=virtio \
  --location=/home/user/Downloads/ubuntu-20.04.3-live-server-amd64.iso,kernel=casper/vmlinuz,initrd=casper/initrd \
  --extra-args "autoinstall ds=nocloud-net;s=http://192.168.122.1:3003/" \
  --noreboot

From man virt-install:

Additionally, --location can take 'kernel' and 'initrd' sub options. These paths relative to the specified location URL/ISO that allow selecting specific files for kernel/initrd
           within the install tree. This can be useful if virt-install/ libosinfo doesn't know where to find the kernel in the specified --location.

           For example, if you have an ISO that libosinfo doesn't know about called my-unknown.iso, with a kernel at 'kernel/fookernel' and initrd at 'kernel/fooinitrd', you can make this
           work with:

             --location my-unknown.iso,kernel=kernel/fookernel,initrd=kernel/fooinitrd
like image 99
Tarik Avatar answered Dec 06 '25 03:12

Tarik