Page MenuHomeVyOS Platform

Replace unionfs-fuse with kernel overlayfs for CLI config sessions
In progress, NormalPublicFEATURE REQUEST

Description

vyatta-cfg ("CStore") builds every CLI configuration session as a union of the shared active configuration and the session's own pending changes. Today that union is unionfs-fuse, a userspace FUSE daemon per session. This task replaces it with the kernel's overlayfs, mounted by a small privileged helper, and replaces libboost-filesystem with C++17 std::filesystem.

The migration is a Debian trixie upgrade blocker.

unionfs-fuse

  • Crashes on Debian trixie, so config sessions are unusable there @sarthurdev
  • Removed from Debian testing. VyOS builds it itself with fpm (scripts/package-build/unionfs-fuse), pinned to v3.6 while upstream is at v3.8; the package depends on libfuse3-dev at runtime.
  • Upstream is a single-maintainer project with ~40 open issues. Its metadata directory was renamed between releases, which vyatta-cfg had to track by hand.

Ubuntu and AppArmor
Ubuntu 25.04+ ships an AppArmor profile for fusermount3 that denies the session mount below /opt/vyatta/config, even inside a container. CI on Ubuntu 26.04 runners failed every commit until vyos-build unloaded the host profile around make test-oci (5ffd0a87). That workaround alters the host's security policy and will return on any Ubuntu-based host. overlayfs does not use fusermount3.

Think of containerlab

Performance
With FUSE, every lookup the CLI makes on the config tree is a round trip from the kernel to the daemon and back, on a tree that lives entirely in memory (tmpfs). overlayfs resolves lookups in the kernel. vyos-1x already works around the daemon's cache window (config_mgmt.py).

libboost
Boost was used only for filesystem operations. Its runtime packages carry the version (libboost-filesystem1.74.0 was hard-coded in debian/control), forcing packaging changes with every Debian release. std::filesystem removes the dependency, and a runtime library used by only this application

Design

Layout

RolePathoverlayfs
active configconfig/activelowerdir
session changesconfig/tmp/changes_only_<sid>upperdir
working configconfig/tmp/new_config_<sid>mount point
kernel scratchconfig/ovl_work/<sid>/<gen>workdir

The layout is unchanged. Options are pinned (index, metacopy, redirect_dir, xino off; nosuid,nodev); metacopy and redirect_dir would forfeit the allowance for offline changes to the lower tree that replacing the active config relies on.

Commit

A mounted overlay's layers may not be modified, so a commit builds the new active tree beside the current one, normalises its permissions for the vyattacfg group (overlayfs enforces lower-layer permissions; FUSE did not), swaps it in with renameat2(RENAME_EXCHANGE), and remounts its own session. Superseded trees are kept while any session or lazily detached overlay uses them. Commits never touch other sessions.

Refresh

Each session moves onto the newest tree on its next operation. Because overlayfs works file by file, carried-over edits could silently revert newer commits (lost values in multi-value nodes, resurrected deleted nodes). Policy: drop & refuse - edits that hide newer changes are dropped and listed, the next commit is refused once, all other pending edits are kept.

Privilege

CLI binaries hold no capabilities. vyos-cfg-overlay-helper (root:vyattacfg, 4750) performs mount, umount, refresh and clear, only on the caller's own session. As the config root is group-writable, it works through descriptors opened with O_NOFOLLOW, clears its environment and signals, and buffers output until it holds no lock.

Locking and robustness

  • Commit lock: one commit at a time.
  • Tree lock: commits exclusive around swap and removal; the helper shared while checking and mounting.
  • Session locks: serialize work on one session.

Interrupted steps leave markers (.session.reset, .remount, .restoring, .dropped) so a later operation finishes or resets the session instead of trusting a half-done state.

Behaviour changes

  • A commit that would revert another session's newer commit is refused once, with the nodes listed.
  • A session whose post-commit remount or restore fails is invalidated with a clear message.
  • vyos-1x writes through the session mount (configfs), installs op-mode values as the invoking user, and keeps session directories private.

Compatibility

  • Kernel: CONFIG_OVERLAY_FS=m, autoloaded on first mount. Also used for containers in VyOS
  • Upgrade: the config root is a fresh tmpfs per boot; nothing to migrate.
  • Containers: need CAP_SYS_ADMIN and mount(2) permitted, instead of fusermount3.

Details

Version
rolling
Is it a breaking change?
Behavior change
Issue type
Performance optimization

Event Timeline

c-po changed the task status from Open to In progress.
c-po claimed this task.
c-po triaged this task as Normal priority.
c-po added a subscriber: UnicronNL.