tailscale / tailscale/tailscale

tailscale configure systray --enable-startup=systemd generates unit tied to default.target instead of graphical-session.target

Open
#20,311 2 comments 1 reaction 0 assignees View on GitHub
bug OS-linux systray
Dominant language
Go
Stars
36.5k
Forks
3.2k
Avg merge
2d 3h
Merged PRs (30d)
123

Description

### What is the issue?

`tailscale configure systray --enable-startup=systemd` generates a systemd user unit tied to `default.target` instead of `graphical-session.target`. Since `default.target` can be reached before the graphical session's D-Bus is fully up, the systray process starts too early, fails to connect to the session bus, and exits immediately.

Environment:
- OS: Ubuntu 26.04 (GNOME, Wayland)

Generated unit (`~/.config/systemd/user/tailscale-systray.service`):

​```ini
[Unit]
Description=Tailscale System Tray
Documentation=https://tailscale.com/kb/1597/linux-systray
Requires=dbus.service
After=dbus.service
PartOf=default.target

[Service]
Type=simple
ExecStart=/usr/bin/tailscale systray

[Install]
WantedBy=default.target
​```

Relevant logs (`journalctl --user -u tailscale-systray -b`):

​```
juil. 01 12:36:40 CRVS-L-001 systemd[5154]: Started tailscale-systray.service - Tailscale System Tray.
juil. 01 12:36:40 CRVS-L-001 tailscale[21562]: 2026/07/01 12:36:40 starting
juil. 01 12:36:43 CRVS-L-001 tailscale[21562]: 2026/07/01 12:36:43 new state: Stopped
juil. 01 12:36:49 CRVS-L-001 tailscale[21562]: 2026/07/01 12:36:49 exiting
juil. 01 12:36:49 CRVS-L-001 tailscale[21562]: 2026/07/01 12:36:49 ipnbus error: context canceled
juil. 01 12:36:49 CRVS-L-001 tailscale[21562]: 2026/07/01 12:36:49 watchIPNBus: ipnbus error: context canceled
juil. 01 12:36:49 CRVS-L-001 systemd[5154]: tailscale-systray.service: Main process exited, code=exited, status=1/FAILURE
​```

Proposed fix — tie the unit to `graphical-session.target` instead:

​```ini
[Unit]
Description=Tailscale System Tray
Documentation=https://tailscale.com/kb/1597/linux-systray
Requires=dbus.service
After=dbus.service graphical-session.target
PartOf=graphical-session.target

[Service]
Type=simple
ExecStart=/usr/bin/tailscale systray
Restart=on-failure
RestartSec=2

[Install]
WantedBy=graphical-session.target
​```

With this change, the systray reliably starts on login/reboot.

### Steps to reproduce

1. Run `sudo tailscale set --operator=$USER`
2. Run `tailscale configure systray --enable-startup=systemd`
3. Check the generated unit: `cat ~/.config/systemd/user/tailscale-systray.service` — it's tied to `default.target`
4. Reboot the machine
5. Expected: tray icon appears in the top panel
6. Actual: tray icon is absent. `systemctl --user status tailscale-systray` shows the service exited with status 1 shortly after boot (`ipnbus error: context canceled`)

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

Not a regression, this appears to be present since the `--enable-startup=systemd` feature was introduced in Tailscale 1.96. The generated unit has likely never correctly accounted for session/D-Bus startup ordering.

### OS

Linux

### OS version

Ubuntu 26.04 LTS

### Tailscale version

1.98.8 tailscale commit: 1241b225bc798707d02db3570992625d3a16594f long version: 1.98.8-t1241b225b-g0520dfda5 other commit: 0520dfda5d034816c38a15a8661160eb9a6d5ac4 go version: go1.26.3 (tailscale/go e877d97384)

### Other software

_No response_

### Bug report

BUG-b4bc7bb18e7509b343a66176da55ee9f56dfbff8549e00199d1c7832c7ac3e86-20260701105307Z-9766db338f781edb

Contributor guide

Open the contributing guide

Research direction

Start at the `tailscale configure systray --enable-startup=systemd` entry point and trace where `~/.config/systemd/user/tailscale-systray.service` is generated. Compare the generated unit with the proposed `graphical-session.target` ordering and startup behavior, then verify the service starts reliably on login and that the tray icon appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.