Alright, let's say I've run my A/B test on Tailscale versus a more traditional VPN setup. The results are in, and the null hypothesis wins: I need to rip it out. The docs are, predictably, excellent for installation but a bit coy on the full scorched-earth removal.
Running the standard `tailscale down && sudo apt remove tailscale` feels like it leaves crumbs. And in my world, crumbs are untracked variables that mess with the next experiment.
What's the full cleanup ritual on, say, Ubuntu/Debian? I'm talking:
* The systemd services (and any residual configs they leave behind)
* The state files lurking in `/var/lib` or `~/.config`
* The network namespaces or iptables rules it might have orphaned
* Any packages or repos it added during installation
I've seen a few stray `tailscale0` interfaces linger after removal like a bad smell. Want to make sure the next networking tool I test doesn't have to deal with its ghost.
just sayin'
Data over dogma.
Oh man, I feel you on the "leaving crumbs" thing. It's the same anxiety I get when migrating data between CRMs - those stray custom fields and orphaned workflows that haunt you six months later.
For Tailscale, you're right that `remove` doesn't cut it. After you purge the package, you gotta manually nuke `/var/lib/tailscale/` and `/etc/systemd/system/tailscaled.service.d/` if it exists. Also, check for and remove any `tailscale-` entries in `iptables -L` or `nft list ruleset`. That lingering `tailscale0` interface usually vanishes after a reboot, but if it's stubborn, `sudo ip link delete tailscale0` can shoo it away.
Forgot to check `~/.config/tailscale/` for user-level configs. And if you added their repo, cleaning up `/etc/apt/sources.list.d/` is the final step for a truly clean slate. Nothing worse than contaminating your next test environment.
That's a solid starting list. I'm in a similar boat, just trying to clean up after an eval.
One thing I'd add: before deleting the tailscale0 interface, you might need to bring it down first with `sudo ip link set tailscale0 down`. I got an "operation not permitted" error once when I skipped that step.
Also, if you used their apt repository, don't forget to run `sudo apt-key list` and check for a Tailscale key you might want to remove.
Good point on the apt-key cleanup, that's the kind of thing that sits in a dark corner for years. Though honestly, with apt moving away from trusted.gpg.d, that whole key management feels like a transitional mess.
And yeah, the "operation not permitted" on the interface is classic. Makes you wonder what other little daemons or caches are holding onto it. A full reboot is the nuclear option, but sometimes you just want it gone now.
Honestly, this whole cleanup drill is a decent argument for running it containerized in the first place. Blow away the container, and the only crumbs are in your image cache.
—DW
Totally get the desire for a clean removal slate, especially after an A/B test. The `tailscale0` interface is a classic haunt - I've had it stick around even after purging the package.
One specific thing I'd add: check for lingering systemd configs in `/etc/default/tailscale` or a leftover override directory like `/etc/systemd/system/tailscaled.service.d/`. Sometimes the service is gone but the environment file sticks around, which could hypothetically conflict if you ever reinstall.
Oh, and double-check your DNS resolution config in `/etc/resolv.conf` or whatever system your distro uses. I've seen Tailscale add search domains that remained after removal, which messed with my network diagnostics later. A simple reboot *usually* clears it, but you can't always reboot a production-ish test box.
Good call on the iptables/nftables check too. Those rules can be sneaky.
Happy testing!
Oh, that's a great catch on the `/etc/default/tailscale` file. I've been bitten by leftover environment variables before, but with a different service. Those files are so easy to forget because they survive even a `purge`.
Your point about DNS is critical, and it's not just `/etc/resolv.conf`. If you're on a system using systemd-resolved, Tailscale can add configs to that too. After removal, I've had to run `sudo systemd-resolve --statistics` to check for leftover domains and sometimes manually reset the DNS settings with `resolvectl`. A reboot fixes it, but like you said, that's not always an option.
Data nerd out
Yep, leftover DNS configs are the worst! If you're on a systemd-resolved system, you can also check `resolvectl domain` and `resolvectl dns` to see if any Tailscale domains or servers are still attached to your main link. I've had to do a `resolvectl revert ` to clear them out completely. Makes you wish all installers came with a proper `-p purge` flag that actually purges everything, doesn't it?
git push and pray
Yeah, the ghost interface is a pain. Had the same issue on a test box. After the purge and file cleanup, I still saw it in `ip link`. Bringing it down first as user865 mentioned worked for me.
But I'm a bit lost on the iptables part. How do you safely identify which rules are Tailscale's? I'm always nervous about deleting the wrong rule and breaking something else.
Good list to start from. The package repo cleanup is key, I've had old sources.list.d entries cause weird conflicts months later. For the iptables rules, I usually look for anything referencing "tailscale" or "tsfw" in the chain names, that's a safe bet. But yeah, scares me too. 😅 Anyone know a safer command to just list those specific rules without touching anything else?
You've outlined the critical areas perfectly. The 'crumbs' analogy is apt, as these remnants can cause non-deterministic behavior in subsequent tests. Beyond the standard directories, there are a few less obvious ones.
On a typical Debian/Ubuntu install, the full checklist I use is:
1. Package and repository cleanup:
```bash
sudo apt purge tailscale
sudo rm -f /etc/apt/sources.list.d/tailscale.list
sudo rm -f /usr/share/keyrings/tailscale-archive-keyring.gpg # if present
```
2. Systemd and state removal:
```bash
sudo systemctl disable --now tailscaled
sudo rm -rf /var/lib/tailscale/
sudo rm -rf /etc/systemd/system/tailscaled.service.d/
sudo rm -f /etc/default/tailscale
```
3. Network artifact cleanup (post-reboot is safest):
```bash
sudo ip link del tailscale0 2>/dev/null
sudo iptables-save | grep -v tailscale | sudo iptables-restore # for iptables-legacy
sudo nft delete table ip tailscale 2>/dev/null # for nftables
```
The iptables command you mentioned is the correct, safe approach. It lists all rules, filters out any line containing 'tailscale', and restores the remainder. It's atomic for the rule-set and won't touch unrelated rules.
The `tailscale0` interface often requires the link to be brought down first, as others noted, but if the kernel module is unloaded (which `purge` should do), a `del` should work. If it persists across a reboot, it points to a deeper issue, possibly a udev rule or another service re-creating it.
For your next experiment, consider snapshotting the state of these directories and `iptables-save`/`nft list ruleset` before installation to have a precise diff for rollback.
Data over dogma
Thanks for posting this! I've been trying to learn proper cleanup myself, and your point about the "crumbs" messing with the next experiment makes total sense.
I just went through this on my Ubuntu test VM. Following the steps everyone mentioned, I still had that `tailscale0` interface showing up in `ip link`. I had to run `sudo ip link delete tailscale0` after bringing it down, like user865 said. That finally got rid of the ghost.
Could someone explain the safest way to check for leftover iptables rules? I see people mention looking for "tsfw", but I'm scared of breaking something.
> check for leftover iptables rules
For nftables (the default on newer systems), check `sudo nft list ruleset | grep -i tailscale`.
For iptables-legacy, list all rules and chains. The safest command is to dump the tables and pipe it to grep:
```bash
sudo iptables-save | grep -E '(tsfw|tailscale)'
```
This only prints lines containing those matches. If it prints nothing, there are no Tailscale rules. Then you can review the output and delete chains with `sudo iptables -X `.
Don't delete the FORWARD or INPUT chains themselves. Just custom chains with those keywords.
Trust but verify, then don't trust.
> running it containerized in the first place
That's the real win. I run most tools like this in a throwaway Podman container for exactly this reason. The cleanup is `podman stop; podman rm`. No ghost interfaces, no leftover systemd junk.
The apt-key migration is a mess. Even after removing the .gpg file, I've seen apt-get update whine about a missing key. Usually have to nuke the entire list file and sometimes the keyring dir.
—cp
Oh, that ghost interface is the worst, isn't it? It's always the last thing hanging around. Besides the `ip link delete` you need, sometimes the kernel module for WireGuard itself can hold onto it if you're using kernel WireGuard mode. A reboot usually clears it, but I've had to `sudo modprobe -r wireguard` before in a pinch to nudge it loose.
Also, great call on checking the repos. The keyring file can be stubborn. I've seen `apt update` complain even after removing the list file because the key is cached somewhere in `/var/lib/apt/lists/`. A `sudo apt update` after the purge often forces it to clear the cache.
Yeah, that ghost interface is the worst. The `ip link delete` trick usually gets it, but I've also had to completely shut down the service and flush any lingering routes before the kernel would let the interface go.
One more spot for total cleanup, especially if you run it as a user service sometimes: check `~/.config/tailscale`. It can hold a user-level state file that's easy to miss and might cause weirdness if you ever reinstall.
Happy testing!