How to fix error ‘Could not access KVM kernel module’ in Proxmox, Virtualizor, SolusVM, Redhat, CentOS and Ubuntu
KVM is a Linux virtualization technology that’s used in many virtualization solutions such as Proxmox, Virtualizor and SolusVM. All major Linux systems like RedHat, CentOS, Debian and Ubuntu have in-built support for KVM.
Bobcares helps VPS providers and server owners setup and maintain virtualization systems through our Server Management services. A common error found during the initial setup of KVM is “Could not access KVM kernel module“.
Today we’ll take a look at the different causes for this error, and how to fix it.
What is the error ‘Could not access KVM kernel module’?
If the KVM module is not enabled in the system due to some reason, it will show the error message ‘Could not access KVM kernel module: No such file or directory‘.
The error message happens during instances like starting a VM in Proxmox VE:
The same error can be shown while executing other KVM related tasks such as taking VM backups. For eg. here’s an error from Proxmox KVM virtual machines.
What causes the error ‘Could not access KVM kernel module’ in Proxmox, Virtualizor, Redhat, CentOS and Ubuntu.
The error ‘Could not access KVM kernel module‘ can occur due to 3 many reasons:
1. CPU does not have virtualization support
For KVM module to work, the CPU of the machine should have virtualization support enabled.
Using ‘lscpu’ command helps to verify whether the CPU supports hardware virtualization:
The given result is for AMD processor. In machines with Intel processor, this virtualization extension name would be shown as Intel VT.
If there is no virtualization support for your processor, then KVM will not work at all in that machine.
2. KVM modules not loaded into the kernel
If the CPU supports virtualization, then check whether the KVM modules are loaded into the kernel. Missing kernel modules can cause the error ‘Could not access KVM kernel module’.
To check if the KVM modules are being loaded, list them using the command:
lsmod | grep kvm
If the module is not listed, try loading the kernel modules for KVM – kvm and kvm_amd / kvm_intel – using ‘modprobe’ command:
The module ‘kvm_amd’ is applicable for AMD processors whereas ‘kvm_intel’ is to be loaded for Intel processors.
If the modules are successfully loaded, it will display the modules in ‘lsmod’ output, as shown in the snippet.
3. Virtualization support is not enabled in the BIOS
By default, the virtualization support may not be enabled by all CPU vendors. In such cases, the ‘modprobe kvm’ command will work but ‘modprobe kvm_amd’ will give error.
To check if the virtualization support is disabled in the BIOS, check the ‘dmesg’ output after executing the modprobe command.
If virtualization is disabled in BIOS, it will display the message:
In such scenarios, we must edit the BIOS settings and enable virtualization support. We’ll see how to do that in both AMD and Intel processors.