This procedure was done on an Ubuntu 24.04 system
Install the dependencies required for the building process:
sudo apt install git build-essential ninja-build python3-venv libglib2.0-0 libglib2.0-dev flex bison libpixman-1-dev libsdl2-dev libsdl2-image-dev mesa-common-dev libglfw3-dev libgles2-mesa-dev libgl-dev libepoxy-dev libpipewire-0.3-dev libspice-protocol-dev libspice-server-dev libvirglrenderer-dev libjson-c-dev libcmocka-dev libusbredirparser-dev libgtk-3-dev libusb-1.0-0-dev
Building time!
git clone https://github.com/zhaodice/qemu-anti-detection.git
wget https://download.qemu.org/qemu-8.2.2.tar.xz
tar xvJf qemu-8.2.2.tar.xz
cd qemu-8.2.2
git apply ../qemu-anti-detection/qemu-8.2.0.patch
sudo rm -rf build
./configure --enable-vnc --enable-sdl --enable-opengl --enable-kvm --enable-pa --enable-pipewire --enable-slirp --enable-spice --enable-spice-protocol --enable-usb-redir --enable-virglrenderer --enable-virtfs --enable-vhost-kernel --enable-vhost-user --enable-gtk --enable-system --enable-libusb
sudo make install -j$(nproc)
QEMU will be installed @ /usr/local/share/qemu
and is ready to run. (you do not need to add any entries into the PATH environment variable)
sudo apt install bridge-utils virt-manager libvirt-clients libvirt-daemon-system libosinfo-bin
Unable to connect to libvirt qemu ///system
Cause: The current user may be lacking access to the libvirt
and/or the kvm
group(s), or the KVM kernel module may be unloaded
Solution:
sudo modprobe kvm
sudo adduser `id -un` libvirt
sudo adduser `id -un` kvm
reboot
No hypervisor options were found for this connection.
Cause: AppArmor is restricting access to the libvirtd service. Verify using systemctl status libvirtd
Solution:
sudo mkdir -p /etc/apparmor.d/disable
sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
reboot
Error: No active connection to install on
Solution:
sudo chown $(whoami):$(whoami) /var/run/libvirt/libvirt-sock
First change the current directory to the directory of the QEMU source files, then run:
sudo make uninstall
VirtIO is mainly unusable with the qemu-anti-detection
patch because it changes any "VirtIO" entries to things like "ASUS". See https://github.com/search?q=repo%3Azhaodice%2Fqemu-anti-detection+virtio&type=code and zhaodice/qemu-anti-detection#21
Thus, your guest systems will mostly not be able to identify the VirtIO devices and install the proper drivers for them.
- https://help.ubuntu.com/community/KVM/Installation
- https://kifarunix.com/how-to-fix-qemu-kvm-not-connected-error-on-ubuntu-20-04/
- https://askubuntu.com/a/1395276/862595
- https://github.com/zhaodice/qemu-anti-detection?tab=readme-ov-file#patching-and-building-qemu
- https://polyos.iscas.ac.cn/en/docs/developer-guides/build-qemu/on-ubuntu/
- https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/822312999/Building+and+Running+QEMU+from+Source+Code
- https://www.youtube.com/watch?v=Zei8i9CpAn0