Aev VM
Aev VM is a Rust VM manager with a native Aen console. It uses QEMU/KVM for hardware virtualization while Rust owns VM definitions, process lifecycle, QMP control, the bounded RFB client, and the native console. KnottCompositor
The Rust manager creates qcow2 VMs and controls QEMU through QMP. The native Aen console displays guest RFB pixels and forwards keyboard and pointer input. Private socket tests cover this transport; complete guest boot and physical display acceptance remain separate release checks.
KnottCompositor <- native Aen frames <- KnottVM Rust console
|
private Unix RFB
|
QEMU/KVM
|
private Unix QMP
|
KnottVM lifecycle
Requirements
- Linux x86-64 with Rust 1.88 or newer
qemu-system-x86_64andqemu-img/dev/kvmaccess for hardware acceleration; TCG is the automatic fallback- OVMF/EDK2 for the default UEFI firmware
- An SMM-capable OVMF Secure Boot image for optional
uefi-securemode - A running native Aen session on KnottCompositor
On Arch Linux, the headless host packages are qemu-base and edk2-ovmf.
Install
Run aev-vm in a terminal to create a VM or select one to open. On KnottOS,
open Aev VM in Applications or the App Store to launch the same menu in
Lios. The bundled knottvm command uses the existing VM definitions and
storage directories.
Build from source
The binary is target/release/aev-vm.
KnottCompositor
Use the native Aen session already managed by KnottDesktop. The console resolves
AEN_WINDOW_SOCKET, then KNOTT_COMPOSITOR_SHELL_SOCKET with .windows appended,
then $XDG_RUNTIME_DIR/knottx-shell.sock.windows.
For an explicitly configured existing session:
doctor verifies a native configure handshake without uploading a visible
frame; it does not certify scanout or guest boot. No compositor restart or
hardware display takeover is needed to open a console. See
the native Aen guide for frame limits and input behavior.
The opt-in scripts/e2e-headless.sh test uses a private native-only software
compositor and QEMU.
First VM
run starts a stopped VM and opens its console. Closing the console leaves the
VM running. Reopen it with aev-vm console workstation.
Add --tpm2 to aev-vm init when the guest needs a software TPM 2.0.
stop first requests an ACPI shutdown and escalates to QMP quit after the
configured timeout. kill means immediate QMP quit; it does not send a Unix
signal to an unverified PID.
Screenshots
Capture a running VM's current QEMU framebuffer without opening a console:
Screenshots are binary PPM files. QEMU writes to a fixed file inside the VM's private runtime directory; KnottVM validates the format and 256 MiB size limit before publishing the requested destination with owner-only permissions. Existing files and symlinks are never replaced.
Runtime Memory
Every VM includes a virtio memory balloon. A running VM can cooperatively return memory to the host without changing its next-boot configuration:
Targets are limited to 256 MiB through the VM's configured boot memory.
restore requests that configured maximum again. Balloon changes are
asynchronous and require a functioning guest virtio-balloon driver; show
reports QEMU's current guest-reported byte count. Targets are runtime-only and
reset when QEMU restarts.
Guest Agent
Every VM includes a private virtio-serial channel named
org.qemu.guest_agent.0. Install and enable qemu-guest-agent inside the
guest to use OS-aware controls:
The channel is proxied through an owner-only Unix socket. agent shutdown
asks the guest operating system to perform the action; stop remains the
QMP/ACPI lifecycle fallback when an agent is unavailable.
Snapshots
Internal snapshots are intentionally offline so disk mutation cannot race a running guest:
Snapshots cover only the qcow2 system disk; they do not include UEFI variable or software TPM state. To prevent a disk rollback from being paired with newer TPM state, KnottVM rejects snapshot creation and reversion for VMs with software TPM 2 enabled. Existing snapshots can still be listed or deleted. Portable backups include the stopped VM's software TPM state.
Cloning
Cloning is offline and creates an independent full qcow2 copy rather than a fragile backing-file chain:
The clone receives its own disk, UEFI variable file, runtime sockets, and deterministic MAC identity. Installation-media configuration is retained, while host port forwards are cleared to prevent listener conflicts.
Backup And Restore
Portable backups are offline, independent, and self-verifying:
A backup directory contains an independent qcow2 image, portable TOML
definition, optional UEFI variables, and a versioned JSON manifest with SHA-256
and exact-size checks for every artifact. Verification also runs qemu-img check. Restore verifies first, publishes the new definition last, assigns a new
MAC identity, clears host port forwards, and does not retain installation-media
paths.
Deletion
Deletion requires an explicit confirmation and a stopped VM:
KnottVM removes only its definition, managed system.qcow2, UEFI variables,
and runtime metadata. A manually configured disk outside the VM's managed data
directory is reported and preserved. Unknown files in the data directory are
also left untouched. Before creation, launch, or disk mutation, ownership checks
compare canonical paths and file identities across definitions and pending
deletions. They also detect another VM's reference to a managed path before its
disk file exists; unreadable or unresolved peer references fail closed. A
private cross-process lock serializes ownership scans, and deletion holds it
until the disk and its tombstone are cleared.
Configuration
VM definitions use strict, versioned TOML under
$XDG_CONFIG_HOME/knottvm/vms. Disks and UEFI variables live under
$XDG_DATA_HOME/knottvm/vms. Owner-only sockets, PID metadata, and operation
locks live under $XDG_RUNTIME_DIR/knottvm.
Example definition:
= 1
= "workstation"
= "7d845e9b-b00f-4d7c-b845-e0bffb33d063"
= 8192
= 8
= "auto"
= "uefi"
= "none"
= "/home/user/Downloads/installer.iso"
[]
= "/home/user/.local/share/knottvm/vms/workstation/system.qcow2"
= "qcow2"
[]
= "user"
[[]]
= "tcp"
= "127.0.0.1"
= 2222
= 22
Remove install_media after installation if the ISO should no longer be
attached, or manage it without editing TOML:
Media changes require the VM to be stopped. aev-vm command NAME prints the
exact argument-safe QEMU launch for inspection.
USB Passthrough
An exact Linux USB bus and device address can be cold-plugged into a stopped
VM. Use lsusb to identify the current numbers:
The guest receives the entire physical device through QEMU's usb-host
backend. The invoking user must already have permission to open its
/dev/bus/usb node; KnottVM never elevates privileges or changes device
permissions. Do not run KnottVM as root or pass through host hubs, keyboards,
or other devices needed to control the host.
USB addresses can change after reconnect. Stop the VM and update the binding before restarting it:
Host USB bindings are intentionally cleared from clones and portable backups. An absent, inaccessible, busy, or unsupported device makes VM startup fail rather than silently booting without it. Up to 14 host devices can be assigned to one VM.
Host Directory Shares
KnottVM can expose an existing host directory through QEMU's built-in virtio-9p transport without an external helper. Shares default to read-only and are changed while the VM is stopped:
On a Linux guest with 9p support, mount the tag with:
Guest writes require explicit opt-in:
Writable shares let guest software modify or delete files as the host user
running QEMU. KnottVM uses mapped-xattr, never changes host permissions, and
does not treat 9p as an isolation boundary. Share paths are host-local and are
therefore cleared from clones and portable backups. Up to 16 shares can be
configured per VM.
Storage Growth
System disks can only grow, never shrink, and the VM must be stopped:
After growing the virtual disk, expand the partition and filesystem inside the guest using its operating-system tools.
Port Forwarding
User-mode networking can expose guest services on IPv4 loopback without root or a bridge:
Remove it while the VM is stopped:
TCP and UDP are supported. Listener addresses are restricted to loopback by configuration validation so a typo cannot expose a guest service publicly.
Compute And Audio
Compute, accelerator, network, and audio settings are changed atomically while the VM is stopped:
Audio is disabled by default. --audio pipewire creates an Intel HDA duplex
device connected directly to the user's PipeWire session; this is a QEMU/host
integration and does not require compositor-specific audio APIs.
Machine Identity
Each new VM receives a stable UUID exposed through QEMU's vmgenid device.
KnottVM automatically generates a different identity for clones and restores,
and changes it after snapshot rollback so modern guests can detect duplicated
or rolled-back machine state.
Firmware And Secure Boot
New VMs use standard UEFI by default. Hosts with an SMM-capable OVMF Secure Boot image can select the secure firmware profile at creation or while the VM is stopped:
The secure profile uses Q35 with SMM enabled, read-only secure OVMF code, a
protected writable pflash device, and per-VM variable storage. doctor reports
the matched uefi-secure-code and uefi-secure-vars paths. bios, uefi,
and uefi-secure are the supported modes.
Selecting uefi-secure provides firmware capable of enforcing Secure Boot; it
does not enroll keys. Enrollment and verification policy remain guest/firmware
operations. The per-VM UEFI variables containing enrollment state are retained
by clones and included in verified backups.
Design Choices
- QEMU/KVM is the hypervisor instead of an incomplete new device model.
- All control and display channels are Unix sockets inside mode-0700 runtime
directories. RFB security type
Noneis accepted only on that local socket. - The console uses the native Aen window SDK with bounded opaque BGRA frames, configure revisions and explicit frame acknowledgement credit.
- Native GPU import and explicit synchronization remain prerequisites for an accelerated console presenter.
- Guest-controlled dimensions, names, clipboard messages, rectangles, and framebuffer allocations are bounded before allocation or copying.
See docs/ARCHITECTURE.md for component and failure-boundary details.
See COMPOSITOR_NEEDED.md for requirements that must be implemented in
KnottCompositor rather than worked around in the VM manager.
Current Limits
- One x86-64 system disk and one optional installation ISO
- CPU frame scaling and native socket uploads; GPU presentation is pending
- Native compositor-resolved keysyms, with a basic evdev fallback; primary touch maps to guest pointer input, while IME text commits and multitouch remain pending
- Absolute tablet input remains the default;
aev-vm configure NAME --pointer-device mouseopts into relative QEMU input and Aen capture. Escape releases capture, and a deliberate click requests it again. - USB passthrough is cold-plug only and uses reconnect-sensitive Linux bus and address selectors; no USB hotplug or stable physical-port matching yet
- Host directory sharing uses virtio-9p and primarily targets Linux guests;
virtiofsdis not installed on the current validation host - Framebuffer screenshots are bounded binary PPM files; image conversion is intentionally left to external user tools
- No bridged networking, live migration, host-side Secure Boot enrollment UI,
or atomic focus-generation fence from host clipboard read through final guest
delivery. Host-to-guest paste is disabled by default; the unsafe
--unsafe-unfenced-host-clipboard-pasteoption explicitly opts in despite that delivery race. Guest-to-host copy is an explicit shortcut scoped to the focused Aen window. aev-vm init --tpm2enables a persistent per-VM TPM 2.0. It requires the externalswtpmandswtpm_ioctlhelpers; KnottVM does not install them. Backups retain TPM state, while clones start with a fresh TPM identity.- KnottCompositor itself still needs broader toolkit compatibility, production input semantics, GPU composition, and session mediation
This is a tested foundation, not a claim of feature parity with mature desktop products. The process boundaries allow those features to be added without replacing VM definitions, QMP control, or the compositor-native console.
Development
The end-to-end test requires the sibling KnottCompositor debug binary. It boots real temporary QEMU VMs, validates QMP, screenshots, secure UEFI, balloon control, storage, host shares, network, USB configuration, snapshots, clone, backup/restore, and deletion, opens the RFB/native Aen console for three seconds, and cleans all temporary state.
Local verification — 2026-11-08
Offline all-target tests passed 154 library, 1 main, and 6 console-socket
cases. Strict Clippy and formatting pass. The headless end-to-end script now
creates private mode-0700 XDG directories before its doctor check and passes
against KnottCompositor's headless backend. QEMU used TCG because /dev/kvm
is not accessible here. The run exercises VM lifecycle/QMP, screenshots,
storage, shares, snapshots, clone/backup/restore, and the native Aen console;
it does not qualify KVM acceleration, complete guest OS boot, or physical
display. Its temporary /tmp state is cleaned on exit.
Licensed under either Apache-2.0 or MIT.