tailscale / tailscale/tailscale

FR: allow systemd service to use an alternate state directory

Open
#7,915 2 comments 0 reactions 0 assignees View on GitHub
fr L1 Very few OS-linux P2 Aggravating T0 New feature
Dominant language
Go
Stars
36.5k
Forks
3.2k
Avg merge
1d 23h
Merged PRs (30d)
132

Description

### What is the issue?

We are using the static binaries and installing the provided `tailscaled.service` unit and default environment configuration. These work fine if the rootfs is writable, but they cannot support a read-only rootfs. There is no way to override the state directory to place it in another location without jumping through a few hoops.

### Steps to reproduce

1. Build tailscale into a Yocto image, using a read-only rootfs
2. Observe that `/var/lib` is a volatile overlay and state is lost between boots
3. Try to use a drop-in service unit configuration to change `FLAGS`. This does not work, because `ExecStart` passes `--state` directly and `ExecStartPre`/`ExecStartPost` do not use `FLAGS`.

Presently, it seems that the way to work around this is to completely redefine all `ExecStart*` directives to use `--statedir` (and also unset the `StateDirectory` directive). This is not compatible with changes to the original service file.

Instead, a new variable `STATEDIR` could be defined in the default environment, and that option can be used to set `--statedir`.

### Are there any recent changes that introduced the issue?

_No response_

### OS

Linux

### OS version

Yocto kirkstone

### Tailscale version

1.38.4

### Other software

_No response_

### Bug report

BUG-8ba230914fbd6a4974cf6abf91a2acdf336b183876b7e2869c5ca218731ba008-20230418202212Z-3d837a1d5fa123c2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.