fix(os): ship systemd drop-ins as vendor config, not into /etc - #1158
Merged
Conversation
The image stages its drop-ins into /etc/systemd/system/<unit>.d. That is the
administrator's layer, and systemctl(1) is explicit about what it means:
revert UNIT... removes drop-in configuration files that modify the
specified units [...] the matching directories foo.service.d/ with all
their contained files are removed, both below the persistent and runtime
configuration directories (i.e. below /etc/systemd/system and
/run/systemd/system)
So an ordinary `systemctl revert docker` deletes dstack-prepare.conf and
dstack-guest-agent.conf, and docker loses its ordering against
dstack-prepare.service and dstack-guest-agent.service. The same applies to
containerd, and to the tee simulator's ordering drop-in on
dstack-prepare.service. None of these are operator configuration; they are
ordering the image itself depends on.
The split was already visible inside a single drop-in directory:
dstack-prepare.service.d holds 10-nvidia-gpu-ordering.conf under
${systemd_system_unitdir} and tee-simulator.conf under ${sysconfdir}.
Nothing is lost by moving them. Drop-ins from every search directory are
applied, ordered lexically by filename, so `systemctl edit` still wins with
its override.conf. The image simply stops occupying the namespace reserved
for whoever operates it.
There is no measurement consequence either way: dstack overlays /etc, /usr
and /bin alike, measured content in the lower layer and writes in a tmpfs
that resets each boot.
Verified by rebuilding both affected recipes; dstack-guest and
dstack-tee-simulator now package their drop-ins under
/usr/lib/systemd/system/.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The path changes are consistent across both image backends and the parity tracking update matches the new vendor drop-in location.
Pull request overview
This PR fixes image-shipped systemd drop-in placement by moving vendor-owned drop-ins from the operator layer (/etc/systemd/system/<unit>.d/) into the vendor unit directory (/usr/lib/systemd/system/<unit>.d/), preventing systemctl revert from deleting required ordering configuration.
Changes:
- Update Yocto recipes to install the affected drop-ins under
${systemd_system_unitdir}(vendor) instead of${sysconfdir}/systemd/system(admin). - Update the mkosi build staging script to ship docker/containerd drop-ins and the simulator drop-in under
/usr/lib/systemd/system. - Adjust
os/mkosi/parity.jsonto track the simulator drop-in at its new path.
File summaries
| File | Description |
|---|---|
| os/yocto/layers/meta-dstack/recipes-core/dstack-tee-simulator/dstack-tee-simulator.bb | Move tee-simulator.conf drop-in install + packaging path into ${systemd_system_unitdir}. |
| os/yocto/layers/meta-dstack/recipes-core/dstack-guest/dstack-guest.bb | Install docker/containerd drop-ins into ${systemd_system_unitdir} and update FILES:${PN} accordingly. |
| os/mkosi/parity.json | Update simulator drop-in path from etc/systemd/system/... to usr/lib/systemd/system/... for backend parity checks. |
| os/mkosi/components/dstack-rust/dstack-rust-build.sh | Stage docker/containerd drop-ins and simulator drop-in under /usr/lib/systemd/system instead of /etc/systemd/system. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The image stages its systemd drop-ins into
/etc/systemd/system/<unit>.d/. That is the administrator's layer, andsystemctl(1)is explicit about what living there means:So a perfectly ordinary
systemctl revert dockerdeletesdstack-prepare.confanddstack-guest-agent.conf, and docker loses its ordering againstdstack-prepare.serviceanddstack-guest-agent.service. Same for containerd, and for the simulator's ordering drop-in ondstack-prepare.service.None of these are operator configuration. They are ordering the image itself depends on:
The inconsistency was already visible inside a single drop-in directory —
dstack-prepare.service.d/holds10-nvidia-gpu-ordering.confunder${systemd_system_unitdir}andtee-simulator.confunder${sysconfdir}.What changed
Four drop-ins move from
/etc/systemd/system/to/usr/lib/systemd/system/, in both image backends:dstack-guest-agent.confdocker.servicedstack-prepare.confdocker.servicedstack-prepare.confcontainerd.servicetee-simulator.confdstack-prepare.serviceparity.jsonis updated so the backend comparison tracks the new paths.Nothing is lost
Drop-ins from every search directory are applied, ordered lexically by filename across directories, so
systemctl editstill wins with itsoverride.conf. The image simply stops occupying the namespace reserved for whoever operates it — and gains the property thatsystemctl revertrestores the vendor state instead of destroying it.There is no measurement consequence either way: dstack overlays
/etc,/usrand/binalike, with measured content in the lower layer and writes in a tmpfs that resets each boot.Testing
Rebuilt both affected recipes against the vendored yocto tree.
bitbake -c packagesucceeds and the drop-ins land in the new location:shellcheck -x -P SCRIPTDIRclean on the mkosi build script,parity.jsonstill parses.Scope
The NVIDIA fabric-manager drop-in has the same problem but is fixed in #1157, which already touches that file — this PR deliberately leaves it alone to avoid a conflict. After both land, no image-shipped drop-in remains under
/etc.