Skip to content

Commit 40cb72f

Browse files
bketelsenCopilot
andcommitted
fix(tailscale): add Upholds= drop-in for reliable boot-time activation
The WantedBy=multi-user.target + preset approach doesn't reliably work for sysext-provided services. At PID 1 startup the sysext hasn't been merged yet, so the /etc/systemd/system/multi-user.target.wants/ symlink points to a missing unit file. systemd silently drops the dangling Wants= reference and never retriggers it after the daemon-reload that reload-sysext.service performs. Add usr/lib/systemd/system/multi-user.target.d/10-tailscale.conf to the sysext with Upholds=tailscaled.service. This drop-in is brand-new to systemd after the post-merge daemon-reload, so it is processed cleanly when multi-user.target activates — ensuring tailscaled starts on every boot without modification to the base image. Ref: https://www.flatcar.org/docs/latest/provisioning/sysext/ Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5a8da4f commit 40cb72f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

docs/plans/2026-02-24-tailscale-sysext-design.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Official Tailscale APT repository (`pkgs.tailscale.com/stable/debian`), consiste
1818
- `/usr/share/factory/etc/default/tailscaled` — factory default config (port + flags)
1919
- `/usr/lib/tmpfiles.d/tailscale.conf` — restores /etc/default/tailscaled at boot
2020
- `/usr/lib/systemd/system-preset/40-tailscale.preset` — auto-enables tailscaled.service
21+
- `/usr/lib/systemd/system/multi-user.target.d/10-tailscale.conf``Upholds=tailscaled.service` drop-in for reliable boot activation
2122

2223
## /etc Configuration Handling
2324

@@ -30,6 +31,10 @@ The `tailscaled.service` unit has `EnvironmentFile=/etc/default/tailscaled`. Wit
3031

3132
System preset enables `tailscaled.service` by default. User authenticates post-boot via `tailscale up`.
3233

34+
The preset alone is insufficient for reliable boot-time activation of sysext-provided services. At PID 1 startup the sysext is not yet merged, so the `/etc/systemd/system/multi-user.target.wants/tailscaled.service` symlink's target is missing; systemd silently drops the dangling `Wants=` reference. After `reload-sysext.service` merges the overlay and runs `daemon-reload`, the previously-evaluated wants list for `multi-user.target` is not re-triggered for the newly-available unit.
35+
36+
The fix is a `multi-user.target.d/10-tailscale.conf` drop-in (shipped inside the sysext) that uses `Upholds=tailscaled.service`. Since this drop-in is brand-new to systemd after the daemon-reload, it is processed cleanly when `multi-user.target` activates — ensuring tailscaled starts on every boot. See [Flatcar sysext docs](https://www.flatcar.org/docs/latest/provisioning/sysext/) for background.
37+
3338
## Runtime State
3439

3540
All persistent state lives in `/var/lib/tailscale/` (managed by systemd `StateDirectory=tailscale`). No build-time state needed.
@@ -58,6 +63,7 @@ mkosi.images/tailscale/
5863
mkosi.finalize
5964
mkosi.extra/usr/lib/
6065
systemd/system-preset/40-tailscale.preset
66+
systemd/system/multi-user.target.d/10-tailscale.conf ← Upholds= drop-in
6167
tmpfiles.d/tailscale.conf
6268
6369
mkosi.conf (add tailscale to Dependencies)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Unit]
2+
Upholds=tailscaled.service

0 commit comments

Comments
 (0)