Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oddmario/eb24d2a8ed1df0a345ad8c4eee60d3b5 to your computer and use it in GitHub Desktop.
Save oddmario/eb24d2a8ed1df0a345ad8c4eee60d3b5 to your computer and use it in GitHub Desktop.

Revisions

  1. oddmario revised this gist May 29, 2024. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -66,6 +66,11 @@ First change the current directory to the directory of the QEMU source files, th
    sudo make uninstall
    ```

    ## Note regarding VirtIO
    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 https://github.com/zhaodice/qemu-anti-detection/issues/21

    Thus, your guest systems will mostly not be able to identify the VirtIO devices and install the proper drivers for them.

    ## References
    - https://help.ubuntu.com/community/KVM/Installation
    - https://kifarunix.com/how-to-fix-qemu-kvm-not-connected-error-on-ubuntu-20-04/
  2. oddmario revised this gist May 28, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ 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
    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!
    @@ -18,7 +18,7 @@ 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
    ./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)
  3. oddmario revised this gist May 28, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ 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
    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
    ```

    Building time!
    @@ -18,7 +18,7 @@ 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
    ./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
    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)
  4. oddmario revised this gist May 28, 2024. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,8 @@ 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
    ./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
    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
    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)
  5. oddmario revised this gist May 28, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ 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
    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
    ```

    Building time!
    @@ -17,7 +17,7 @@ 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
    ./configure --enable-vnc --enable-sdl --enable-opengl --enable-kvm --enable-pa --enable-pipewire --enable-slirp --enable-spice --enable-spice-protocol --enable-vfio-user-server --enable-virglrenderer --enable-virtfs
    ./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
    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)
  6. oddmario revised this gist May 28, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ 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
    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
    ```

    Building time!
    @@ -17,7 +17,7 @@ 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
    ./configure --enable-vnc --enable-sdl --enable-opengl --enable-kvm
    ./configure --enable-vnc --enable-sdl --enable-opengl --enable-kvm --enable-pa --enable-pipewire --enable-slirp --enable-spice --enable-spice-protocol --enable-vfio-user-server --enable-virglrenderer --enable-virtfs
    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)
  7. oddmario revised this gist May 28, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ QEMU will be installed @ `/usr/local/share/qemu` and is ready to run. (you do no

    ## Installing virt-manager
    ```
    sudo apt install bridge-utils virt-manager libosinfo-bin
    sudo apt install bridge-utils virt-manager libvirt-clients libvirt-daemon-system libosinfo-bin
    ```

    ## Issues faced after running virt-manager:
  8. oddmario revised this gist May 25, 2024. 1 changed file with 15 additions and 9 deletions.
    24 changes: 15 additions & 9 deletions Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,11 @@
    ## Installing QEMU with the qemu-anti-detection patch
    Install the dependecies required for the building process:
    # Installing QEMU with the qemu-anti-detection patch

    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
    ```
    @@ -14,7 +20,7 @@ git apply ../qemu-anti-detection/qemu-8.2.0.patch
    ./configure --enable-vnc --enable-sdl --enable-opengl --enable-kvm
    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)
    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)

    ## Installing virt-manager
    ```
    @@ -24,11 +30,11 @@ sudo apt install bridge-utils virt-manager libosinfo-bin
    ## Issues faced after running virt-manager:
    - `Unable to connect to libvirt qemu ///system`

    **Cause:** The current user may be lacking access to the libvirt and/or the kvm group. or the KVM kernel module may be unloaded
    **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:**
    ```
    modprobe kvm
    sudo modprobe kvm
    sudo adduser `id -un` libvirt
    sudo adduser `id -un` kvm
    reboot
    @@ -45,12 +51,12 @@ sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
    reboot
    ```

    - `Error: No active connection to Installed on`
    - `Error: No active connection to install on`

    **Solution:**

    ```
    sudo chown username:username /var/run/libvirt/libvirt-sock
    sudo chown $(whoami):$(whoami) /var/run/libvirt/libvirt-sock
    ```

    ## To uninstall QEMU:
    @@ -63,7 +69,7 @@ sudo make uninstall
    - 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://www.youtube.com/watch?v=Zei8i9CpAn0
    - 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://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/822312999/Building+and+Running+QEMU+from+Source+Code
    - https://www.youtube.com/watch?v=Zei8i9CpAn0
  9. oddmario revised this gist May 25, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ git apply ../qemu-anti-detection/qemu-8.2.0.patch
    ./configure --enable-vnc --enable-sdl --enable-opengl --enable-kvm
    sudo make install -j$(nproc)
    ```
    QEMU will be installed @ `/usr/local/share/qemu`
    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)

    ## Installing virt-manager
    ```
  10. oddmario created this gist May 25, 2024.
    69 changes: 69 additions & 0 deletions Installing QEMU with the qemu-anti-detection patch.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,69 @@
    ## Installing QEMU with the qemu-anti-detection patch
    Install the dependecies 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
    ```

    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
    ./configure --enable-vnc --enable-sdl --enable-opengl --enable-kvm
    sudo make install -j$(nproc)
    ```
    QEMU will be installed @ `/usr/local/share/qemu`

    ## Installing virt-manager
    ```
    sudo apt install bridge-utils virt-manager libosinfo-bin
    ```

    ## Issues faced after running virt-manager:
    - `Unable to connect to libvirt qemu ///system`

    **Cause:** The current user may be lacking access to the libvirt and/or the kvm group. or the KVM kernel module may be unloaded

    **Solution:**
    ```
    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 Installed on`

    **Solution:**

    ```
    sudo chown username:username /var/run/libvirt/libvirt-sock
    ```

    ## To uninstall QEMU:
    First change the current directory to the directory of the QEMU source files, then run:
    ```
    sudo make uninstall
    ```

    ## References
    - 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://www.youtube.com/watch?v=Zei8i9CpAn0
    - 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