To install KVM on Arch Linux, install the following packages:
sudo pacman -S qemu virt-manager dnsmasq dmidecode vde2
Check if the
qemu package added the
$ getent group | grep kvm kvm:x:992:
Add your user to the
kvm group with
sudo usermod -aG kvm $USER.
Then, reboot your machine. After that, start the
libvirtd service with
sudo systemctl start libvirtd.service.
sudo systemctl enable libvirtd.service to enable the service from the next boot.
If you check for the service status with
sudo systemctl status libvirtd.service. There probably will be the following error:
May 08 16:34:18 transang libvirtd: /usr/bin/ebtables not available, firewall backend will not function: No such file or directory May 08 16:34:18 transang libvirtd: internal error: Failed to initialize a valid firewall backend
You should not worry because
ebtables is optional. If you want to suppress this warning, install the package with
sudo pacman -S ebtables. However, because it conflicts with
iptables-nft in the
iptables package, it will ask to remove the
:: iptables-nft and iptables are in conflict. Remove iptables? [y/N]
If after the installation, your virtual device does not start, try starting the device from the command line.
From AVD Manager, right-click to the device, and choose "View Details" to get and copy the device name.
Boot the device with the following command:
Android/Sdk/emulator/emulator -avd Pixel_4_XL_API_29
If there are warnings, they will be shown in the command line for debugging/googling.
emulator: Android emulator version 188.8.131.52 (build_id 7324830) (CL:N/A) handleCpuAcceleration: feature check for hvf Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs" cannot add library /home/transang/Android/Sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed added library /home/transang/Android/Sdk/emulator/lib64/vulkan/libvulkan.so cannot add library /home/transang/Android/Sdk/emulator/lib64/vulkan/libvulkan.so.1: full emulator: INFO: GrpcServices.cpp:315: Started GRPC server at 127.0.0.1:8554, security: Local emulator: INFO: EmulatorAdvertisement.cpp:93: Advertising in: /run/user/1000/avd/running/pid_2340.ini emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037 emulator: emulator window was out of view and was recentered emulator: INFO: boot completed emulator: INFO: boot time 23442 ms emulator: Increasing screen off timeout, logcat buffer size to 2M. emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037 emulator: Revoking microphone permissions for Google App. deleteSnapshot: for default_boot KVM: injection failed, MSI lost (Operation not permitted)
Even though there are the above warnings, the emulator works fine on my machine.
Mostly, you will want the
adb command line while developing. If the command is not available, you can install it with
sudo pacman -S android-tools.
There are several Vulkan-related packages that might be helpful.
sudo pacman -S nvidia-utils vulkan-icd-loader vulkan-tools vulkaninfo