Stop Rebuilding the Whole OS Image: Practical systemd-sysext and confext on Linux
说明与用途
使用 systemd-sysext 和 systemd-confext,可以在不重建镜像的情况下快速扩展不可变的 Linux 镜像,在 /usr、/opt 或 /etc 上叠加 OverlayFS 层。
问题
Immutable Linux images make adding a single tool or temporary /etc overlay slow and error‑prone because rebuilding the whole image is required.
结果
Extensions can be merged and unmerged in seconds, preserving the immutable base image and enabling rapid, reversible changes to /usr, /opt, or /etc.
工作流
- Create extension directory under /var/lib/extensions/ or /var/lib/confexts/
- Add an identity file /usr/lib/extension-release.d/extension-release.NAME (or /etc/extension-release.d/extension-release.NAME) matching host os-release
- Place payload files (binaries, scripts, config) in the appropriate hierarchy (e.g., /usr/bin for sysext, /etc/ssh/ for confext)
- Run
sudo systemd-sysext merge(orsystemd-confext merge) to activate the overlay - Verify overlay with
findmnt /usrorsystemd-sysext status - Use
sudo systemd-sysext unmerge(orsystemd-confext unmerge) to revert the change
证据
systemd-sysext and systemd-confext solve a narrower problem cleanly: merge extension images into the live hierarchy with OverlayFS, then unmerge them without rewriting the base OS.
When you merge: systemd finds installed extension images, builds an OverlayFS stack over the host hierarchy, overmounts /usr + /opt (sysext) or /etc (confext).
- 记录日期: 2026-09-22T10:30:28.649Z