Skip to content
Search Fedora

    Browse this documentation

    KVM virtualization: virt-install, virsh, and nested virtualization, measured

    Fedora is both KVM’s upstream and one of its best hosts. Every command here was measured inside a Fedora 45 virtual machine — including nested virtualization.

    Terminal window
    sudo dnf install -y qemu-kvm libvirt virt-install guestfs-tools edk2-ovmf
    sudo systemctl enable --now libvirtd

    Measured versions: qemu-kvm 11.1.2, libvirt 12.6.0, virt-install 5.1.0, OVMF (UEFI firmware) 20260812.

    Package roles:

    PackagePurpose
    qemu-kvmthe VM engine (CPU/memory/device emulation)
    libvirtmanagement layer: API, daemons, XML definitions
    virt-installcreate VMs from the CLI
    guestfs-toolsoffline image editing (virt-customize etc.)
    edk2-ovmfUEFI firmware (Windows 11 / modern guests)
    Terminal window
    sudo virt-host-validate qemu

    Measured on this machine — itself a VM on PVE, i.e. nested:

    QEMU: Checking for hardware virtualization : PASS
    QEMU: Checking if device '/dev/kvm' exists : PASS
    QEMU: Checking if device '/dev/kvm' is accessible : PASS
    QEMU: Checking for cgroup 'cpu' controller support: PASS

    Hardware virtualization PASS means nested virtualization is enabled (the PVE host passes AMD-V through with cpu host). Physical machines likewise PASS. Fix any FAIL per its hint (BIOS SVM/VT-x, kernel module).

    Terminal window
    sudo virt-install --name=vmtest --memory=512 --vcpus=1 \
    --disk size=1 --os-variant=generic --noautoconsole

    Measured: starts successfully even nested (state running). Key flags:

    FlagMeaning
    --disk size=11G qcow2 in the default pool
    --cdrom=xxx.isoattach an install ISO
    --os-variant=win11precise variant improves virtio/firmware choices (osinfo-query os lists all)
    --network network=defaultNAT network (the default)
    --graphics spicegraphical console

    The default storage pool is /var/lib/libvirt/images/. Undefining a VM does not delete its disk:

    Terminal window
    sudo virsh undefine vmtest --nvram
    sudo rm /var/lib/libvirt/images/vmtest.qcow2
    Terminal window
    sudo virsh list --all # all VMs and states
    sudo virsh start vmtest # power on
    sudo virsh shutdown vmtest # graceful (ACPI)
    sudo virsh destroy vmtest # pull the plug (forced)
    sudo virsh autostart vmtest # start with the host
    sudo virsh console vmtest # serial console (guest needs serial enabled)
    sudo virsh dominfo vmtest # details
    • default network (NAT): guest reaches out, host reaches in (virsh net-dhcp-leases for IPs), outside cannot reach in — the common case
    • bridged (br0): the VM appears directly on the physical network with a same-segment IP — for servers offering services
    Terminal window
    sudo virsh net-list --all # default is usually active + autostart
    sudo virsh net-dhcp-leases default
    Terminal window
    # in the guest:
    sudo dnf install -y qemu-guest-agent
    # on the host (VM config needs the qemu-ga channel):
    sudo virsh qemu-agent-command vmtest '{"execute":"guest-ping"}'

    With the agent, virsh shutdown is reliable and the host can read IPs, freeze filesystems, and more — PVE’s qm guest exec depends on it too.

    • disks on virtio-scsi (--disk bus=scsi,controller=virtio-scsi), several times faster than IDE
    • NICs on virtio (--network model=virtio)
    • pass CPU topology through with --cpu host (nested/migration trade-offs in the libvirt docs)
    • Windows guests need the virtio-win driver ISO (dnf install virtio-win on the host)
    SymptomCause
    validate reports hardware virtualization FAILBIOS SVM/VT-x off, or host not passing through
    VM runs but is very slowdisk/NIC not on virtio
    shutdown hangsno qemu-guest-agent in the guest; use destroy
    console connects but prints nothingguest kernel lacks serial console parameters
    UEFI guest won’t installedk2-ovmf missing, or --boot uefi not set
    default pool full/var/lib/libvirt/images sits on root; virsh vol-delete