Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
vmrunner
VM-backed Rust tests with libkrun.
Requirements
Generic:
libkrunandlibkrunfw- Rust 1.85 or newer
- a Linux root qcow2 image or HTTP(S) image URL
- a full Rust guest target, for example
aarch64-unknown-linux-gnu curlwhenroot_qcow2uses an HTTP(S) URL
Linux:
/dev/kvmaccessunshare(1)inPATHwith--user --map-root-user --net --fork- user and network namespaces enabled
/dev/net/tunaccess forTunTap
macOS:
- macOS 14 or newer on Apple Silicon
- Apple Hypervisor.framework
gvproxyfor host or internet uplinks- Zig when
CC_LINUXis unset
Setup
macOS:
Linux: install libkrun, libkrunfw, rustup, util-linux, curl, and optional zig with your distro package manager.
Guest target examples:
- Apple Silicon or Linux
aarch64:aarch64-unknown-linux-gnu - Linux
x86_64:x86_64-unknown-linux-gnu
FreeBSD guests are temporarily disabled. Use Linux guest targets for now.
vmrunner rejects guest targets whose Rust target arch does not match the host arch. If guest_target is omitted, the macro uses <host-arch>-unknown-linux-musl.
Host target map:
No map match prints a warning and picks a target with the same arch when possible. Otherwise it falls back to <host-arch>-unknown-linux-musl.
Ubuntu cloud image example
URL roots are downloaded once to target/vmrunner-qcow2-imag/<file>.
For x86_64 hosts use:
https://cloud-images.ubuntu.com/daily/server/releases/26.04/release-20260720/ubuntu-26.04-server-cloudimg-amd64.imgguest_target = "x86_64-unknown-linux-gnu"
Image metadata and cache helpers are exported by vmrunner:
EXTERNAL_QCOW_FILESYSTEMS: structured entries withname,arch,url, anddigestQCOW2_IMAGE_CACHE_DIR,qcow2_image_cache_path_with_sha256,ensure_qcow2_image_cached_with_sha256
Known URLs are cached under target/vmrunner-qcow2-imag/sha256/<digest>/. FreeBSD .qcow2.xz metadata remains exported for cache helpers, but FreeBSD guests are disabled for now.
Image smoke tests use a libtest-mimic custom harness and run through Cargo:
Ubuntu and Fedora pass on the current x86_64 host. The FreeBSD trial is registered but ignored while FreeBSD guests are disabled.
Ubuntu cloud images normally put / on the first partition, so use /dev/vda1.
async
How it works
#[vmrunner::test]requiresroot_qcow2;guest_targetcan be omitted, fixed, or host-mapped.- HTTP(S)
root_qcow2values are cached undertarget/vmrunner-qcow2-imag. - Missing
init.krunsidecars are built before Linux namespace setup. - Linux tests always re-exec through
unsharebefore VM launch. TestCasecreates a writable qcow2 overlay per VM node withimago.- libkrun starts
init.krun, mounts the qcow2 root disk, then direct-execs the requested guest command. krun-init-blobstays out of the normal dependency graph. Bump it inkrun-init-build-package/Cargo.toml.
GPU support is opt-in with --features gpu.