How to Fix “KVM Acceleration Not Available” Error in QEMU/KVM Virtualization


2 views

When working with QEMU/KVM virtualization, you might encounter the warning: WARNING KVM acceleration not available, using 'qemu'. This indicates that while your VM will still run, it's falling back to slower software emulation instead of using hardware-accelerated virtualization through KVM.

Before troubleshooting, verify your system meets these requirements:

# Check CPU virtualization support
egrep -c '(vmx|svm)' /proc/cpuinfo
# Should return > 0

# Check kernel modules
lsmod | grep kvm
# Should show kvm_intel or kvm_amd loaded

1. BIOS Settings Disabled

Many systems ship with virtualization disabled in BIOS. You'll need to enable:

  • Intel VT-x (for Intel CPUs)
  • AMD-V (for AMD CPUs)

2. Missing KVM Kernel Modules

Try loading the appropriate modules:

# For Intel CPUs
sudo modprobe kvm_intel

# For AMD CPUs
sudo modprobe kvm_amd

# Verify
lsmod | grep kvm

3. Nested Virtualization Conflicts

If running inside another VM, ensure nested virtualization is enabled:

# For Intel
sudo modprobe -r kvm_intel
sudo modprobe kvm_intel nested=1

# For AMD
sudo modprobe -r kvm_amd
sudo modprobe kvm_amd nested=1

After applying fixes, verify KVM is active:

# Check acceleration status
virsh capabilities | grep kvm
# Should show <domain type='kvm'>

# Alternative check
sudo virt-host-validate
# All KVM checks should pass

Without KVM acceleration, expect significant performance degradation:

Metric With KVM Without KVM
CPU Performance Near-native ~10-20% of native
I/O Latency Low High
Memory Access Fast Slow

If issues persist, check your libvirt configuration:

# Check the URI connection
virsh uri
# Should show qemu:///system

# Examine domain XML
virsh dumpxml [VM_NAME] | grep type
# Should show type='kvm'

If hardware acceleration isn't possible, consider these optimizations:

# Use TCG accelerator with multiple threads
qemu-system-x86_64 -accel tcg,thread=multi -smp 4 ...

# Enable KSM memory deduplication
echo 1 | sudo tee /sys/kernel/mm/ksm/run

When setting up a CentOS 7 virtual machine using virt-install, you're encountering the warning:

WARNING  KVM acceleration not available, using 'qemu'

This indicates that while your Intel processor supports VT-x (visible in flags: vmx in cpuinfo), the KVM kernel module isn't properly loaded or configured.

First, let's verify all prerequisites:

# Check CPU virtualization support
egrep -c '(vmx|svm)' /proc/cpuinfo

# Verify KVM modules are loaded
lsmod | grep kvm

# Check user permissions
groups | grep libvirt

# Verify nested virtualization (if applicable)
cat /sys/module/kvm_intel/parameters/nested

For Debian 8 (Jessie) with Linux 3.16 kernel, try these steps:

# Install required packages
sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils

# Load KVM modules
sudo modprobe kvm
sudo modprobe kvm_intel

# Add your user to necessary groups
sudo usermod -aG kvm,libvirt $(whoami)

# Verify KVM is working
sudo virsh cpu-baseline /usr/share/libvirt/cpu_map/x86_64-cpu.xml

Edit your libvirtd configuration:

# /etc/libvirt/qemu.conf
user = "root"
group = "root"
security_driver = "none"

Then restart the service:

sudo systemctl restart libvirtd

When using virt-install, explicitly specify the KVM accelerator:

sudo virt-install \
  --name centos01 \
  --ram 2048 \
  --vcpus 2 \
  --disk path=/var/lib/libvirt/images/centos01.qcow2,size=8 \
  --cdrom /path/to/CentOS-7-x86_64-Minimal-1511.iso \
  --os-type linux \
  --os-variant centos7.0 \
  --network network=default \
  --graphics vnc \
  --hvm \
  --accelerate \
  --machine accel=kvm

If issues persist:

  • Check BIOS settings for VT-x/AMD-V enablement
  • Verify no competing hypervisors are running (VirtualBox, VMware)
  • Examine dmesg for KVM-related errors: dmesg | grep kvm
  • Test with a simpler configuration: kvm -enable-kvm -m 1024 test.img