Bobcares

5 Fixes for “Warning: KVM is not Available” in VIRT-MANAGER

by | Aug 12, 2024

There are several reasons why the “Warning: KVM is not available” in virt-manager occurs, and the fixes differ based on the particular problem. Let’s look into the details in this post. Bobcares, as a part of our Server Management Service offers solutions to every query that comes our way.

Overview
  1. Fixing “Warning: KVM is not available” in Virt-Manager
  2. Causes & Fixes
  3. Key Considerations
  4. Conclusion

Fixing “Warning: KVM is not available” in Virt-Manager

Virt-Manager’s “Warning: KVM is not available” problem usually means that the system does not have the Kernel-based Virtual Machine (KVM) activated or enabled. The Linux kernel’s KVM virtualization module enables near-native performance while running virtual machines (VMs). The various causes and its fixes are given in the following section.

virt-manager warning kvm is not available

Causes & Fixes

1. KVM Package not Installed

The KVM virtualization technique cannot be used by virt-manager if the KVM package is not installed.

Fix: We must install the needed KVM packages in order to fix this. Use the following command to set up the correct packages on Ubuntu/Debian-based systems:

sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils

The following packages are set up by this command:

QEMU emulator and KVM kernel modules for hardware virtualization are provided by qemu-kvm.

The configuration files required to operate the libvirt daemon are included in libvirt-daemon-system.

For managing and controlling virtual machines and hypervisors from the terminal, use the client-side libraries and APIs included in libvirt-clients.
Bridge-utils provide resources for creating and controlling bridge devices.

Run the following command to install the KVM packages on Fedora, CentOS, or RHEL systems:

sudo yum install qemu-kvm libvirt libvirt-python libguestfs-tools-c

The following packages are set up by this command:

The QEMU emulator and KVM kernel modules are provided by qemu-kvm.

The libvirt consists of administration tools and the libvirt daemon.

The libvirt-python contains Python bindings for the libvirt library.

Tools for reading as well as altering virtual machine disk images are provided by libguestfs-tools-c.

2. KVM Kernel Modules not Loaded

It’s possible that the KVM kernel modules won’t load even if the KVM package is present. This may limit the use of KVM virtualization technology by virt-manager.

Fix: We can use the following command to see if the KVM kernel modules are loaded:

lsmod | grep kvm

It shows that the KVM kernel modules are not loaded if the output is empty. We may use the following commands to load the KVM kernel modules:

sudo modprobe kvm
sudo modprobe kvm_intel # for Intel CPUs
sudo modprobe kvm_amd # for AMD CPUs

To load kernel modules, use the modprobe command. The primary KVM kernel module is called kvm; in contrast, kvm_intel and kvm_amd are dedicated to AMD and Intel CPUs, respectively. Following the running of these commands, virt-manager should be able to use the KVM virtualization technology and the KVM kernel modules should have been loaded.

3. Virtualization disabled in BIOS

The CPU must enable hardware virtualization, which is offered by AMD-V or Intel VT-x technology, for KVM to function correctly. The BIOS settings need to enable hardware virtualization, even if the CPU does support it, before the operating system and virtualization programs like virt-manager may access it.

KVM virtualization technology cannot be used by virt-manager if hardware virtualization is turned off in the BIOS. As a result, we can see the error message “KVM is not available.”

Fix: We must verify that hardware virtualization is enabled in the BIOS settings in order to fix this problem. Here’s how to accomplish it:

1. Go into the BIOS configuration menu after restarting the machine. Depending on the manufacturer of the motherboard, the key to access the BIOS may vary, but it typically involves one of the F1, F2, F10, or Del keys.

2. Go to the BIOS settings and find the “CPU Configuration” or “Virtualization” section. The BIOS may change its exact position.

3. Look for choices like “Intel Virtualization Technology” or “AMD-V” that are associated with Intel VT-x or AMD-V. Make sure we have these settings activated.

4. Exit the BIOS setup after saving the changes. The changed settings will be applied when the machine restarts.

4. Conflicting drivers

In certain cases, the use of specific drivers—like the opencl-amdgpu-pro-orca driver—can lead to conflicts and interfere with KVM’s functionality.

Fix: To fix the issue, we must run the following steps:

1. Remove the Conflicting Driver:

i. If OpenCL support isn’t needed, remove the driver:

On Ubuntu/Debian: sudo apt-get remove opencl-orca-amdgpu-pro-icd

On Fedora/CentOS/RHEL: sudo yum remove opencl-orca-amdgpu-pro-icd

ii. Restart the system afterward.

2. Modify libvirtd Environment:

i. If we need the driver, add this line to /etc/libvirt/libvirtd.conf:

environment_variables = ["LD_LIBRARY_PATH=/opt/amdgpu-pro/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/libfakeroot:/usr/lib/x86_64-linux-gnu"]

ii. Restart the libvirtd service:

sudo systemctl restart libvirtd

This allows KVM to work with the driver installed.

5. Permissions issues

We must ensure that the user account is part of the libvirt group, which is required to use virt-manager without sudo.

Fix: We can add the user to the group with the following command:

sudo usermod -a -G libvirt your_username

Then, log out and log back in for the changes to take effect.

Key Considerations

When fixing the “Warning: KVM is not available” error in Virt-Manager, we must consider the following key points:

1. Hardware Virtualization Support:

i. Ensure that the CPU supports hardware virtualization (Intel VT-x or AMD-V).

ii. Verify that hardware virtualization is enabled in the BIOS/UEFI settings.

2. KVM Module Availability:

i. Check that the necessary KVM kernel modules (kvm and either kvm_intel or kvm_amd) are loaded.

ii. If not, manually load them using:

sudo modprobe kvm
sudo modprobe kvm_intel # For Intel CPUs
sudo modprobe kvm_amd # For AMD CPUs

3. Permissions:

i. Make sure the user running Virt-Manager has sufficient permissions.

ii. The user should be part of the kvm group:

sudo usermod -aG kvm

4. Conflicting Drivers or Software:

i. Check for any drivers or software that might conflict with KVM, such as the opencl-amdgpu-pro-orca driver.

ii. Remove or reconfigure conflicting drivers if necessary.

5. Other Hypervisors:

Ensure no other hypervisors (e.g., VirtualBox, VMware) are running and locking the virtualization hardware.

6. CPU Compatibility:

Confirm that the CPU supports the required virtualization features by checking for vmx (Intel) or svm (AMD) flags:

grep -E "(vmx|svm)" /proc/cpuinfo

By addressing these considerations, we can resolve the KVM availability issue in Virt-Manager and enable effective virtualization on the system.

[Looking for a solution to another query? We are just a click away.]

Conclusion

The “Warning: KVM is not available” error in Virt-Manager typically indicates issues with hardware virtualization support, KVM module availability, user permissions, or conflicting software. To resolve it, ensure hardware virtualization is enabled in BIOS/UEFI, verify and load the necessary KVM modules, check user permissions, and address any conflicting drivers or software.

We can properly address these areas with the fixes from our Experts in this article. It will restore KVM functionality and enable successful virtualization.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.