Files
it-know-how/Linux/Disable KVM for VirtualBox.md
T

76 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
How can I disable the [[kvm]] Kernel in [[Linux]], so that I can launch a virtual machine in VirtualBox
---
When you run [[VirtualBox]] on a Linux host, it can conflict with the **KVM kernel modules** (`kvm` and `kvm_intel` or `kvm_amd`). VirtualBox doesnt use KVM, and if those modules are loaded, they can prevent VirtualBox VMs from starting properly.
To disable KVM, you can either **temporarily unload** the modules or **permanently blacklist** them.
---
### 🔹 Option 1: Temporarily Disable KVM
Run the following commands (with root privileges):
```bash
sudo modprobe -r kvm_intel
sudo modprobe -r kvm_amd
sudo modprobe -r kvm
```
- If your CPU is Intel, unload `kvm_intel`.
- If your CPU is AMD, unload `kvm_amd`.
- Then unload the generic `kvm` module.
This will disable KVM until the next reboot.
---
### 🔹 Option 2: Permanently Disable KVM
To prevent KVM from loading on boot, blacklist the modules:
1. Create a blacklist file:
```bash
sudo nano /etc/modprobe.d/blacklist-kvm.conf
```
2. Add these lines:
```
blacklist kvm
blacklist kvm_intel
blacklist kvm_amd
```
3. Save and exit.
4. Update initramfs (on some distros, required):
```bash
sudo update-initramfs -u
```
5. Reboot your system.
---
### 🔹 Verify
After reboot (or unloading), check that no KVM modules are loaded:
```bash
lsmod | grep kvm
```
If the output is empty, KVM is disabled and VirtualBox should work.
---
⚠️ **Note:** If you ever want to use QEMU/KVM again, youll need to remove those blacklist entries and reboot.
Would you like me to also show you how to make VirtualBox auto-unload KVM just when you launch a VM (without disabling it system-wide)? That way, you can keep using both VirtualBox and KVM on the same system.