Windows10 wsl2 安装 tailscale 服务

date
Jan 12, 2023
slug
win10-wsl2-install-tailscale
status
Published
tags
Linux
ENV
summary
众所周知,目前仅有 windows11 的 wsl 支持了 systemd。而 win10 的支持日程遥遥无期,感觉微软在欺骗我们升级 windows11。
type
Post

1. 首先去 tailscale 的官网进行安装

这是链接 Download · Tailscale ,装完之后会发现。无法通过系统的服务对其进行启动。
$ sudo tailscale up
Failed to connect to connect to tailscaled. (safesocket.Connect: dial unix /var/run/tailscale/tailscaled.sock: connect: no such file or directory)
$ systemctl status tailscaled.service
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
使用 service 也没有找不到这个服务。
$ service tailscaled start
tailscaled: unrecognized service

2. 解决方案,在启动 shell 的时候启动

# Starting Tailscale daemon automatically if not running...
RUNNING=`ps aux | grep tailscaled | grep -v grep`
if [ -z "$RUNNING" ]; then
    sudo tailscaled > /dev/null 2>&1 &
    disown
fi
这个脚本在每次启动 shell 前会检测 tailscaled 是否运行,如果未运行则启动。解决方案出处:tailscaled doesn't start under WSL; no systemd · Issue #562 · tailscale/tailscale (github.com)

© therainisme 2025