From 3aa7a380c17a2af9c623e02da292cc20acf4c2a5 Mon Sep 17 00:00:00 2001 From: JumpyVi <62212220+jumpyvi@users.noreply.github.com> Date: Mon, 20 Apr 2026 09:31:16 -0400 Subject: [PATCH 1/6] Add toolbox for libvirt --- .github/workflows/build-qemu-app.yml | 115 +++++++++++++++++++++++++++ apps/qemu/Containerfile.qemu | 33 ++++++++ 2 files changed, 148 insertions(+) create mode 100644 .github/workflows/build-qemu-app.yml create mode 100644 apps/qemu/Containerfile.qemu diff --git a/.github/workflows/build-qemu-app.yml b/.github/workflows/build-qemu-app.yml new file mode 100644 index 00000000..ac31c455 --- /dev/null +++ b/.github/workflows/build-qemu-app.yml @@ -0,0 +1,115 @@ +name: Build and Push Qemu App Toolbox +on: + pull_request: + merge_group: + workflow_dispatch: +permissions: {} + +env: + IMAGE_NAME: qemu-box + IMAGE_TAGS: latest + IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + push-ghcr: + name: Build and push image + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: write + id-token: write + strategy: + fail-fast: false + steps: + # Checkout push-to-registry action GitHub repository + - name: Checkout Push to Registry action + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Verify Ublue-OS Ubuntu toolbox + uses: EyeCantCU/cosign-action/verify@58722a084c82190b57863002d494c91eabbe9e79 # v0.3.0 + with: + containers: ubuntu-toolbox:latest + pubkey: https://raw.githubusercontent.com/ublue-os/toolboxes/main/cosign.pub + registry: ghcr.io/ublue-os + + # Build metadata + - name: Image Metadata + uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + id: meta + with: + images: | + ${{ env.IMAGE_NAME }} + labels: | + io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/boxkit/main/README.md + + # Build image using Buildah action + - name: Build Image + id: build_image + uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2 + with: + containerfiles: | + ./apps/qemu/Containerfile.qemu + image: ${{ env.IMAGE_NAME }} + tags: ${{ env.IMAGE_TAGS }} + labels: ${{ steps.meta.outputs.labels }} + oci: false + + # Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR. + # https://github.com/macbre/push-to-ghcr/issues/12 + - name: Lowercase Registry + id: registry_case + uses: ASzc/change-string-case-action@d0603cd0a7dd490be678164909f65c7737470a7f # v6 + with: + string: ${{ env.IMAGE_REGISTRY }} + + # Push the image to GHCR (Image Registry) + - name: Push To GHCR + uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2 + if: github.event_name != 'pull_request' + id: push + env: + REGISTRY_USER: ${{ github.actor }} + REGISTRY_PASSWORD: ${{ github.token }} + with: + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ steps.registry_case.outputs.lowercase }} + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} + extra-args: | + --compression-format=zstd:chunked + + - name: Login to GitHub Container Registry + uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0 + if: github.event_name != 'pull_request' + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Sign container + - uses: sigstore/cosign-installer@ba7bc0a3fef59531c69a25acd34668d6d3fe6f22 # v4.1.0 + if: github.event_name != 'pull_request' + with: + cosign-release: "v2.6.1" + + - name: Sign container image + if: github.event_name != 'pull_request' + run: | + echo "${{ env.COSIGN_PRIVATE_KEY }}" > cosign.key + wc -c cosign.key + cosign sign -y --key cosign.key ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}@${TAGS} + env: + TAGS: ${{ steps.push.outputs.digest }} + COSIGN_EXPERIMENTAL: false + COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }} + + - name: Echo outputs + env: + BUILD_IMAGE_OUTPUTS: ${{ toJSON(steps.build_image.outputs) }} + run: | + echo "$BUILD_IMAGE_OUTPUTS" diff --git a/apps/qemu/Containerfile.qemu b/apps/qemu/Containerfile.qemu new file mode 100644 index 00000000..478bf6fd --- /dev/null +++ b/apps/qemu/Containerfile.qemu @@ -0,0 +1,33 @@ +FROM alpine:edge + +RUN apk add --no-cache \ + ovmf \ + seabios \ + libvirt-client \ + libvirt-daemon \ + libvirt-common-drivers \ + libvirt-qemu \ + qemu-system-x86_64 \ + qemu-system-i386 \ + qemu-system-riscv64 \ + qemu-system-aarch64 \ + qemu-system-arm \ + qemu-audio-alsa \ + qemu-audio-oss \ + qemu-audio-pa \ + qemu-audio-sdl \ + qemu-audio-spice \ + qemu-block-curl \ + qemu-block-dmg-bz2 \ + qemu-block-nfs \ + qemu-block-ssh \ + qemu-chardev-spice \ + qemu-hw-display-qxl \ + qemu-hw-display-virtio-gpu \ + qemu-hw-display-virtio-gpu-pci \ + qemu-hw-display-virtio-vga \ + qemu-hw-usb-redirect \ + qemu-img + + +RUN ln -sfv /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/autostart/default.xml \ No newline at end of file From 2a4caf55a6d24ca729a0bba07ea89b7295b64040 Mon Sep 17 00:00:00 2001 From: JumpyVi <62212220+jumpyvi@users.noreply.github.com> Date: Mon, 20 Apr 2026 09:53:15 -0400 Subject: [PATCH 2/6] Switch libvirt to ubuntu-questing --- apps/qemu/Containerfile.qemu | 38 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/apps/qemu/Containerfile.qemu b/apps/qemu/Containerfile.qemu index 478bf6fd..1171786d 100644 --- a/apps/qemu/Containerfile.qemu +++ b/apps/qemu/Containerfile.qemu @@ -1,33 +1,15 @@ -FROM alpine:edge +FROM ubuntu:questing -RUN apk add --no-cache \ - ovmf \ - seabios \ - libvirt-client \ - libvirt-daemon \ - libvirt-common-drivers \ - libvirt-qemu \ - qemu-system-x86_64 \ - qemu-system-i386 \ - qemu-system-riscv64 \ - qemu-system-aarch64 \ +RUN apt-get update && apt-get install -y \ + qemu-system-x86 \ qemu-system-arm \ - qemu-audio-alsa \ - qemu-audio-oss \ - qemu-audio-pa \ - qemu-audio-sdl \ - qemu-audio-spice \ - qemu-block-curl \ - qemu-block-dmg-bz2 \ - qemu-block-nfs \ - qemu-block-ssh \ - qemu-chardev-spice \ - qemu-hw-display-qxl \ - qemu-hw-display-virtio-gpu \ - qemu-hw-display-virtio-gpu-pci \ - qemu-hw-display-virtio-vga \ - qemu-hw-usb-redirect \ - qemu-img + qemu-system-riscv \ + qemu-system-modules-opengl \ + qemu-system-modules-spice \ + qemu-system-misc \ + swtpm \ + libvirt-daemon-system \ + libvirt-clients RUN ln -sfv /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/autostart/default.xml \ No newline at end of file From 67aaac374e7b41a505dffe32c82811c026e24db1 Mon Sep 17 00:00:00 2001 From: JumpyVi Date: Thu, 23 Apr 2026 20:01:37 -0400 Subject: [PATCH 3/6] Re-add users --- apps/qemu/Containerfile.qemu | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/qemu/Containerfile.qemu b/apps/qemu/Containerfile.qemu index 1171786d..8235bb3a 100644 --- a/apps/qemu/Containerfile.qemu +++ b/apps/qemu/Containerfile.qemu @@ -12,4 +12,11 @@ RUN apt-get update && apt-get install -y \ libvirt-clients +RUN getent group swtpm || groupadd swtpm && \ + getent passwd swtpm || useradd -g swtpm -d /var/lib/swtpm -s /usr/sbin/nologin swtpm + +RUN getent group qemu || groupadd qemu && \ + getent passwd qemu || useradd -g qemu -d /var/lib/qemu -s /usr/sbin/nologin qemu + + RUN ln -sfv /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/autostart/default.xml \ No newline at end of file From 7449cc7df43957d5b519ad250ff581884b68a1a0 Mon Sep 17 00:00:00 2001 From: JumpyVi Date: Thu, 23 Apr 2026 20:05:06 -0400 Subject: [PATCH 4/6] Fix users and egl --- apps/qemu/Containerfile.qemu | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/qemu/Containerfile.qemu b/apps/qemu/Containerfile.qemu index 8235bb3a..62eae74d 100644 --- a/apps/qemu/Containerfile.qemu +++ b/apps/qemu/Containerfile.qemu @@ -9,7 +9,8 @@ RUN apt-get update && apt-get install -y \ qemu-system-misc \ swtpm \ libvirt-daemon-system \ - libvirt-clients + libvirt-clients \ + libegl1 RUN getent group swtpm || groupadd swtpm && \ @@ -19,4 +20,4 @@ RUN getent group qemu || groupadd qemu && \ getent passwd qemu || useradd -g qemu -d /var/lib/qemu -s /usr/sbin/nologin qemu -RUN ln -sfv /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/autostart/default.xml \ No newline at end of file +RUN rm /etc/libvirt/qemu/networks/autostart/default.xml \ No newline at end of file From c2bd31fd9c3ee6e22e380a52a589020747daebcf Mon Sep 17 00:00:00 2001 From: JumpyVi <62212220+jumpyvi@users.noreply.github.com> Date: Thu, 23 Apr 2026 20:30:37 -0400 Subject: [PATCH 5/6] Remove default network --- apps/qemu/Containerfile.qemu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/qemu/Containerfile.qemu b/apps/qemu/Containerfile.qemu index 62eae74d..bd5cf841 100644 --- a/apps/qemu/Containerfile.qemu +++ b/apps/qemu/Containerfile.qemu @@ -20,4 +20,5 @@ RUN getent group qemu || groupadd qemu && \ getent passwd qemu || useradd -g qemu -d /var/lib/qemu -s /usr/sbin/nologin qemu -RUN rm /etc/libvirt/qemu/networks/autostart/default.xml \ No newline at end of file +RUN rm /etc/libvirt/qemu/networks/autostart/default.xml +RUN rm /etc/libvirt/qemu/networks/default.xml From e3c69735273f1492e0dc660f533d81a571ca0be5 Mon Sep 17 00:00:00 2001 From: JumpyVi <62212220+jumpyvi@users.noreply.github.com> Date: Sat, 25 Apr 2026 21:26:44 -0400 Subject: [PATCH 6/6] Update Containerfile.qemu --- apps/qemu/Containerfile.qemu | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/qemu/Containerfile.qemu b/apps/qemu/Containerfile.qemu index bd5cf841..942a3657 100644 --- a/apps/qemu/Containerfile.qemu +++ b/apps/qemu/Containerfile.qemu @@ -1,4 +1,4 @@ -FROM ubuntu:questing +FROM ubuntu:resolute RUN apt-get update && apt-get install -y \ qemu-system-x86 \ @@ -12,13 +12,13 @@ RUN apt-get update && apt-get install -y \ libvirt-clients \ libegl1 +RUN rm -f /etc/libvirt/qemu/networks/autostart/default.xml && \ + rm -f /etc/libvirt/qemu/networks/default.xml -RUN getent group swtpm || groupadd swtpm && \ - getent passwd swtpm || useradd -g swtpm -d /var/lib/swtpm -s /usr/sbin/nologin swtpm +RUN echo 'user = "root"' >> /etc/libvirt/qemu.conf && \ + echo 'group = "root"' >> /etc/libvirt/qemu.conf && \ + echo 'swtpm_user = "root"' >> /etc/libvirt/qemu.conf && \ + echo 'swtpm_group = "root"' >> /etc/libvirt/qemu.conf -RUN getent group qemu || groupadd qemu && \ - getent passwd qemu || useradd -g qemu -d /var/lib/qemu -s /usr/sbin/nologin qemu - - -RUN rm /etc/libvirt/qemu/networks/autostart/default.xml -RUN rm /etc/libvirt/qemu/networks/default.xml +RUN echo 'unix_sock_group = "root"' >> /etc/libvirt/libvirtd.conf && \ + echo 'unix_sock_rw_perms = "0770"' >> /etc/libvirt/libvirtd.conf