Specifying the kernel and initrd with virt-install
The virt-install command has two parameters that can be used to specify the location of the installation media: --cdrom and --location.
Starting install...
ERROR Couldn't find kernel for install 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 tp-ubuntu-22.04.1
otherwise, please restart your installation.
virt-install \
--name name-of-the-vm \
--virt-type kvm \
--boot uefi,bootmenu.enable=on,bios.useserial=on \
--ram 2048 \
--vcpus 1 \
--cpu host \
--network network=default,model=virtio \
--graphics none \
--video virtio \
--console pty,target.type=virtio \
--serial pty \
--extra-args 'console=ttyS0,115200n8 --- console=ttyS0,115200n8' \
--rng /dev/urandom \
--controller type=scsi,model=virtio-scsi \
--disk pool=default,size=25,format=qcow2,bus=virtio,discard=unmap,cache=none \
--os-variant ubuntu22.04 \
--location /var/lib/libvirt/images/iso/ubuntu-20.04.5-live-server-amd64.iso,initrd=casper/initrd,kernel=casper/vmlinuz