garage44.eu/jeroen/midas

logclone: git clone https://garage44.eu/jeroen/midas.git

cartopolis-agent · 2026-11-24T11:11:27Z

fix(node): the PCI virtio-gpu for Venus, and an open vgem render node

Two things found bringing Venus up on vps-1 (2026-11-24):

- Venus needs the PCI device. virtio-gpu-gl-device (MMIO) with venus=on
  and hostmem crashes QEMU 11.1.3 at start (SIGSEGV, before the guest
  runs); virtio-gpu-gl-pci with the same options runs. Its modules are
  qemu-hw-display-virtio-gpu-pci and -pci-gl.
- QEMU in the node runs as `build`, whose session sshd starts with that
  user's own groups, so the node user's `render` group never reaches it:
  vgem's render node must be open to all (a udev rule on the machine);
  docs/node.md says so.
docs/node.md       | 6 +++++-
 node/Containerfile | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/docs/node.md b/docs/node.md
index d163514..3c09f1c 100644
--- a/docs/node.md
+++ b/docs/node.md
@@ -133,7 +133,11 @@ goes through, Venus) needs a GL context, which in a container only a render
 node gives. A machine with no GPU (the VPS) gets one from the kernel's `vgem`:
 `echo vgem | sudo tee /etc/modules-load.d/vgem.conf`, `sudo modprobe vgem`,
 the node's user in the `render` group (`sudo usermod -aG render midas-node`),
-then setup with `--gpu /dev/dri/renderD128`. Rendering itself stays on the CPU
+and the render node open to all, since sshd hands a node's session to `build`
+with that user's own groups only: a file `/etc/udev/rules.d/70-vgem-render.rules`
+with `SUBSYSTEM=="drm", KERNEL=="renderD*", KERNELS=="vgem", MODE="0666"` (vgem
+only hands out buffers; many distributions leave every render node so). Then
+setup with `--gpu /dev/dri/renderD128`. Rendering itself stays on the CPU
 (lavapipe): this gives QEMU its context, not the node a GPU, so the hub's `gpu`
 flag for it stays off.
 
diff --git a/node/Containerfile b/node/Containerfile
index 7a4d5d7..203f8df 100644
--- a/node/Containerfile
+++ b/node/Containerfile
@@ -12,6 +12,8 @@
 # host's, lavapipe on a CPU node) needs a GL context, which `-display
 # egl-headless` makes on the node's render node; a machine with no GPU gives
 # it one from the kernel's vgem (`modprobe vgem`, `--gpu /dev/dri/renderD128`).
+# Venus wants the PCI device (virtio-gpu-gl-pci): on MMIO, QEMU 11.1 crashes
+# as soon as its host memory (`hostmem`) is asked for.
 # And what `midas deploy` builds with beside cargo: bun (a web UI), trunk (a
 # wasm client; it fetches the wasm-bindgen its lockfile names), a JDK 17, zip
 # and the compressors (an APK and pre-compressed assets), and zig with
@@ -31,7 +33,8 @@ RUN pacman -Syu --noconfirm --needed \
         alsa-lib pkgconf cmake python jq curl \
         bun trunk jdk17-openjdk zip unzip brotli zstd zig cargo-zigbuild chromium \
         qemu-system-aarch64 qemu-hw-display-virtio-gpu qemu-system-x86 qemu-system-x86-firmware \
-        qemu-hw-display-virtio-gpu-gl qemu-ui-opengl qemu-ui-egl-headless virglrenderer \
+        qemu-hw-display-virtio-gpu-gl qemu-hw-display-virtio-gpu-pci qemu-hw-display-virtio-gpu-pci-gl \
+        qemu-ui-opengl qemu-ui-egl-headless virglrenderer \
     && pacman -Scc --noconfirm
 
 # The one account anything that lands here runs as. uid 1000 so the files in