Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

104.5. virtiofsd-1.14.0

The virtio-fs daemon — shares a host directory with a qemu guest

Version 1.14.0, release 1
Shelf virt — Virtual machines, their tooling, and remote-desktop and VNC protocols
Phase 41_system (System), 1004 of 1047 in build order
Licence Apache-2.0 AND BSD-3-Clause
Homepage https://gitlab.com/virtio-fs/virtiofsd
Build time 1.1 SBU
Installed size 2.9 MiB in 4 files
Recipe ports/core/virt/virtiofsd/kpkgbuild

About

virtiofsd is the daemon behind virtio-fs, the way a QEMU guest mounts a directory of the host. QEMU exposes a vhost-user-fs device, and this daemon, started beside the guest and connected to it through a Unix socket, serves the shared directory into it; QEMU has no server of its own for it. One daemon serves one directory. It confines itself with seccomp and drops capabilities with libcap-ng, which is why libseccomp and libcap-ng are in depends.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/virt.txt:

Serves a host directory to a guest over virtio-fs; a guest's command line names it.

Sources

Dependencies

Depends on: rust, libseccomp, libcap-ng.

Required by: no port names it.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install virtiofsd'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/virt/virtiofsd.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/virt/virtiofsd
echo '52b66e449ca583b4f050a2bff327ff812211a2c349b4130279fcfc6a64540f04  virtiofsd-1.14.0.tar.gz' | sha256sum -c -
echo '846b9b9431140febba6d079182a79754cb3f6fcc8d06fb7964297ef3b34d0d10  virtiofsd-vendor-1.14.0.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/virtiofsd
SRC=$SRC_ROOT/virtiofsd-1.14.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf virtiofsd-1.14.0.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz

export CARGO_HOME="$SRC_ROOT/.cargo"
export RUSTFLAGS="-C target-feature=-crt-static"
export CARGO_NET_OFFLINE=true
cargo build --release --frozen --offline
install -Dm755 target/release/virtiofsd "$PKG/usr/bin/virtiofsd"
install -d "$PKG/usr/share/qemu/vhost-user"
cat > "$PKG/usr/share/qemu/vhost-user/50-virtiofsd.json" <<'JSON'
{
  "description": "virtiofsd vhost-user-fs",
  "type": "fs",
  "binary": "/usr/bin/virtiofsd",
  "features": [
      "migrate-precopy",
      "posix-acl-negotiation-mode",
      "security-label-negotiation-mode",
      "separate-options"
  ]
}
JSON
chmod 644 "$PKG/usr/share/qemu/vhost-user/50-virtiofsd.json"

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/virtiofsd, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf virtiofsd-1.14.0-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/virtiofsd, and runs the triggers its paths call for.

Contents

Installed programs: virtiofsd.

Installed directories: /usr/share/licenses/virtiofsd, /usr/share/qemu/vhost-user.

Notes

The crates come from the vendor bundle, virtiofsd-vendor-<version>.tar.xz, made by ports/fetch with cargo vendor and unpacked into the top of the source tree; the build runs --frozen --offline (see Vendoring).

build.sh writes /usr/share/qemu/vhost-user/50-virtiofsd.json, the vhost-user descriptor of type fs that names the daemon. When a guest’s virtio-fs <filesystem> share names no <binary path=…> of its own, libvirt looks the daemon up through such descriptors, and the guest fails to start with Unable to find a satisfying virtiofsd when none qualifies. Upstream’s own 50-virtiofsd.json names /usr/libexec/virtiofsd; the one written here is the same file with the path where this package installs it, /usr/bin/virtiofsd.