M2处理器下创建虚拟机提示KVM不可用的问题求助
Hey there, let's get this KVM issue sorted out for your M2 chip. Since M2 uses ARM64 architecture, the KVM setup steps are a bit different from x86 systems—here's what you need to do:
1. Check for the correct ARM KVM modules
On ARM64 (like M2), the KVM kernel module isn't the x86-specific kvm_intel or kvm_amd—it's kvm_arm64. Your original lsmod | grep kvm command might have missed it because you were looking for the wrong module names.
- Run this to check loaded modules:
You should see bothlsmod | grep kvmkvmandkvm_arm64listed. If not, load them manually:sudo modprobe kvm sudo modprobe kvm_arm64 - To make sure these modules load automatically on boot, create a config file:
echo -e "kvm\nkvm_arm64" | sudo tee /etc/modules-load.d/kvm.conf
2. Verify hardware virtualization is enabled
M2 supports virtualization, but you need to confirm it's active in your system:
- On Linux (e.g., Asahi Linux), run:
If you see entries containinggrep -E 'hyp' /proc/cpuinfohyp, virtualization is enabled. If not, you may need to adjust UEFI settings (Asahi Linux enables this by default, but double-check if you've modified anything). - On macOS, check Hypervisor Framework support with:
A return value ofsysctl kern.hv_support1means it's enabled. If not, restart your Mac in Recovery Mode (hold Command+R), open Terminal, and run:
Then restart normally.csrutil enable --without-hypervisor
3. Install the full set of virtualization tools
Your original sudo apt-get install kvm qemu command might have installed minimal packages. Install the complete suite to ensure KVM works properly:
sudo apt-get install qemu-system-arm qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager
- Add your user to the necessary groups to avoid needing
sudoevery time:sudo usermod -aG libvirt $USER sudo usermod -aG kvm $USER - Log out and back in for the group changes to take effect.
4. Confirm QEMU can access KVM acceleration
Finally, verify that QEMU recognizes the KVM accelerator:
- On Linux, run:
You should seeqemu-system-aarch64 -accel helpkvmlisted under available accelerators. - On macOS, run the same command—look for
hvf(Apple's Hypervisor Framework, which QEMU uses as KVM equivalent on Apple Silicon).
When creating your VM, make sure you select "QEMU/KVM" as the connection type, and in the VM's settings, ensure hardware acceleration is enabled.
内容的提问来源于stack exchange,提问作者kp_regal

