KVM, QEMU and libvirt
Quick answer
KVM supplies Linux kernel virtualization interfaces; QEMU implements virtual machines and emulated devices and can use KVM acceleration. Libvirt provides management APIs and tools such as virsh. These are related layers, not three interchangeable hypervisors.
Diagnose the layer that failed: guest configuration, virtual device, virtualization acceleration or management connection. A management tool listing a guest does not prove that the guest service is healthy; verify its workload from an authorized client.
Prepare the practice environment
Run python3 lab-fixtures/containers-virtualization/setup.py from the extracted root as an ordinary user. Enter the printed private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. The Python helper parses fictional examples or inspects its own child. No runtime daemon, external network or root access is needed. Do not apply the fictional JSON to any runtime. Version checks need the named tools.
Prerequisites
Review: Capabilities, rootless and overlay filesystems.
How it works
KVM exposes /dev/kvm on supported configured hosts; its presence does not guarantee permission or successful acceleration. QEMU can use software CPU emulation (TCG) or a suitable accelerator; guest architecture, firmware, virtual disk and virtual NIC are independent choices. Libvirt domain definitions describe guest hardware and lifecycle; a management connection may refer to local or remote infrastructure. A lab VM should have a small bounded disk, RAM and vCPU allocation, no host secrets, an isolated network or no network, and a recovery console. Snapshots may capture disk and sometimes memory depending on implementation; consistency depends on guest/application coordination. Restore tests and separate backups remain necessary. Never attach production disks or connect to an unknown management URI. The plan here is fictional; no guest is booted.
Try the examples
if test -c /dev/kvm; then printf 'KVM device present\n'; else printf 'KVM device absent\n'; fiThis is the observed local result; presence alone would not prove usability.
Expected stdout:
KVM device absentParse a bounded offline plan without launching a virtual machine.
Expected stdout:
2 vCPUs; 1024 MiB RAM; 8 GiB disk; network noneVersion only; run on your own disposable lab host with QEMU installed. No guest is started.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Never equate /dev/kvm presence with successful guest execution. Avoid attaching real disks, exposing host directories, or taking a snapshot as your only recovery measure.
Practice
Review vm.json and design a disposable guest with no network access, a fresh virtual disk and a separate backup plan. Identify the role of KVM, QEMU and libvirt.
Related references
Study: virsh, qemu-system-x86-64. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
KVM, QEMU and libvirt — Knowledge Check
Apply container and virtualization concepts to concrete local examples.
What does KVM provide?
What is QEMU TCG?
What is virsh primarily used for?
What does a VM snapshot replace?