Run tailscale up over SSH with setsid and a [t]ailscale pkill pattern
Symptom#
tailscale up run over SSH died when the SSH session ended. A plain pkill -f tailscale also killed its own session.
Cause#
The command stayed attached to the SSH session, so it ended with the session. pkill -f matches full command lines, and the shell running it has the word tailscale in its own command line, so it matched itself.
Fix#
Start tailscale up with setsid and </dev/null, so it is detached from the session. Write the pkill pattern as [t]ailscale, so the pattern does not match its own command line. Also add the device tag to the Tailscale policy before you approve the join.
Evidence#
Found while building the gw-in gateway on the lab host. Fixed in the Ansible code and recorded in docs/fresh-setup/08-gw-in.md. After the fix, gw-in reported changed=0 on a second run.