Tailscale in a container: /dev/net/tun does not exist, the fixes
CreateTUN("tailscale0") failed; /dev/net/tun does not exist: the server is a container. How to check, the fix for LXC, OpenVZ and Docker, and userspace mode.
CreateTUN("tailscale0") failed; /dev/net/tun does not exist means tailscaled could not create its network interface because the machine has no TUN device, which usually means the server is a container (an LXC or OpenVZ VPS, a Proxmox LXC, a Docker container), not a virtual machine. tailscaled then exits, so every tailscale command after it says “failed to connect to local tailscaled; it doesn’t appear to be running”. A container cannot create the device for itself: whoever runs the host passes /dev/net/tun in (the Proxmox host, the VPS provider, whoever starts the Docker container), or you start tailscaled with --tun=userspace-networking, which needs no device but makes this machine’s own connections to the tailnet go through a local proxy.
The two messages, and which one is the cause
The first is in tailscaled’s own log, the second is what the tailscale CLI prints afterwards. As of release 1.104.7 (November 2026), the TUN failure comes from the WireGuard library Tailscale uses, wrapped by tailscaled; put together from the source’s format strings, the log line reads:
wgengine.NewUserspaceEngine(tun "tailscale0") error:
tstun.New("tailscale0"): CreateTUN("tailscale0") failed;
/dev/net/tun does not existCopiedBefore it, tailscaled tries modprobe tun and logs what it finds, so a container’s log usually also carries “is CONFIG_TUN enabled in your kernel? `modprobe tun` failed with: …”. In a container that hint points the wrong way: the kernel belongs to the host, and nothing done inside the container loads a module into it. After the failure the daemon stops, and on a systemd server its unit has Restart=on-failure, so it fails again on every restart. Read it with:
sudo journalctl -u tailscaled -n 50CopiedWhen the device node is present but the container is not allowed to open it, the same line ends in the system’s own error, such as operation not permitted, instead of “does not exist”. The cause is the same and so is the fix.
The CLI message has three forms on Linux, chosen by whether a tailscaled process is running and whether its socket exists:
- “failed to connect to local tailscaled; it doesn’t appear to be running (sudo systemctl start tailscaled ?)” No tailscaled process and no socket. The hint in brackets is added whenever a
systemctlbinary is on the path, so it can appear in a container where systemd is not running at all; without it the sentence ends at “running”. If the TUN line is in the log, starting the service again just fails again. - “failed to connect to local tailscaled (no tailscaled process found): …” A socket file is there but nothing answers it, usually left behind by a daemon that died.
- “failed to connect to local tailscaled (which appears to be running as …, pid …). Got error: …” A daemon is running but the CLI cannot talk to it, and the error at the end says why. One common reason is a different socket: the default is
/var/run/tailscale/tailscaled.sock; a tailscaled started by hand with its own--socketpath needs the same path on the CLI, astailscale --socket=<path> status.
Is this server a container?
A VPS sold as OpenVZ or LXC shares its host’s kernel, and so does a container on a KVM machine. Three checks settle it:
systemd-detect-virt -c
cat /run/systemd/container
ls -l /dev/net/tunCopiedsystemd-detect-virt -c names the container technology, among them openvz, lxc, docker and podman, and exits non-zero when the machine is not a container, per its manual. /run/systemd/container exists only where systemd is running inside a container, and holds the same kind of name. Where neither tool is there, systemd’s container interface says to look for container= in PID 1’s environment; this prints only that variable, because the rest of PID 1’s environment can hold keys:
sudo grep -z '^container=' /proc/1/environ | tr '\0' '\n'CopiedSetting the variable is up to the container runtime, so an empty answer does not prove the machine is not a container. The last check is the one that matters for Tailscale: ls: cannot access '/dev/net/tun' means the device is missing, and a character device with numbers 10, 200 means it is there.
Proxmox LXC: the host passes the device
On Proxmox, the change is made on the Proxmox host, in the container’s config file, then the container is restarted. Tailscale’s LXC page gives these lines for Proxmox 7, in /etc/pve/lxc/<id>.conf:
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=fileCopiedProxmox 6 and earlier use lxc.cgroup.devices.allow in the first line. The same page gives the command form, run on the host:
pct set <id> --dev0 /dev/net/tunCopiedThe first line allows the container to use device 10:200 and the second puts the host’s node inside it; missing the first is how a container ends up with the node and a permission error. With both in place, tailscaled runs in its normal mode and nothing else changes.
A container VPS: only the provider can enable TUN
On an OpenVZ or LXC plan, the host is the provider’s. OpenVZ’s own documentation grants a container the device “by running the following commands on the host node”, vzctl set $CTID --devnodes net/tun:rw --capability net_admin:on --save, which no command inside the VPS can do. Ask the provider’s support to enable TUN for the server; whether they do is their decision, and if they will not, use userspace networking below. An agent box that should run any VPN, Docker networking or system services the way a laptop does is better on a plan that is a real virtual machine (KVM, or the provider’s own hypervisor), which choosing a VM for AI agents weighs against the alternatives.
Docker: the official image, or the device
A Docker container gets no /dev/net/tun unless it is given one. Tailscale’s image tailscale/tailscale avoids the question by default: its TS_USERSPACE setting is “Enabled by default. This is equivalent to tailscaled --tun=userspace-networking.” So the TUN error from that image means TS_USERSPACE=false was set without the device. Kernel networking “requires /dev/net/tun and additional capabilities”; in Compose, the capabilities are from Tailscale’s Compose how-to and the device line from Tailscale’s Docker guide:
services:
tailscale:
image: tailscale/tailscale:latest
environment:
- TS_AUTHKEY=<tskey-YOUR-AUTH-KEY>
- TS_STATE_DIR=/var/lib/tailscale
- TS_USERSPACE=false
volumes:
- ./tailscale-state:/var/lib/tailscale
devices:
- /dev/net/tun:/dev/net/tun
cap_add:
- net_admin
- net_rawCopiedThe device is the host’s, so this only works where the Docker host itself has /dev/net/tun: Docker inside an OpenVZ or LXC VPS is back to the provider question. Keep the state directory on a volume; the docs warn that without it the container registers as a new machine each time it starts. If the agent runs on a VM with Docker, installing Tailscale on the VM itself rather than in a container avoids all of this.
Userspace networking, and what it changes
Userspace networking “lets you run Tailscale where you don’t have access to create a VPN tunnel device”. On a server where tailscaled runs under systemd, set the flag in /etc/default/tailscaled, which the service reads, adding a SOCKS5 and HTTP proxy if programs on this machine need to reach the tailnet:
FLAGS="--tun=userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055"CopiedThen sudo systemctl restart tailscaled and sudo tailscale up. In a container with no service manager, Tailscale’s page starts the daemon in the background directly:
tailscaled --tun=userspace-networking \
--socks5-server=localhost:1055 \
--outbound-http-proxy-listen=localhost:1055 &
tailscale up --auth-key=<your-auth-key>CopiedStarted that way, nothing restarts it after a reboot or a crash; on an agent server that has to stay reachable, that is a job for whatever starts the container’s other processes.
The machine joins the tailnet as usual and shows in the admin console, but there is no tailscale0 interface. What that means, as far as Tailscale’s docs say:
- Reaching this machine works. Tailscale’s walkthrough runs tailscaled in userspace mode inside a container, turns on Tailscale SSH with
tailscale up --ssh, and connects to it with plainsshfrom another device, which is the usual way into an agent server (Tailscale SSH for an agent server covers the tags and access rules). - Connections out from this machine need the proxy. A program on it cannot reach a
100.xaddress directly; it goes through the SOCKS5 or HTTP proxy above. Tailscale’s example setsALL_PROXY=socks5://localhost:1055/andHTTP_PROXY=http://localhost:1055/for the program; the HTTP proxy carries only HTTP and HTTPS, and SOCKS5 carries any traffic, for the programs that support it. - SSH out uses
tailscale ssh. The CLI reference: “when your local node is in userspace-networking mode and can’t make a direct connection, usetailscale ssh”, which connects through the local tailscaled. An agent that pushes to a git server on the tailnet or runs commands on another of your machines needs this or the SOCKS5 proxy. - Subnet routing and exit nodes work, with limits. Per Tailscale’s comparison of the two modes, a userspace router relays only TCP and UDP (“any IP protocol other than TCP or UDP (such as SCTP) is not supported”), relays ICMP only partly, and is slower; it recommends kernel mode for heavily used subnet routers.
For an agent that you reach over Tailscale and that otherwise talks only to the public internet, none of these limits come into play, since its internet traffic does not pass through Tailscale unless it uses an exit node. It is the agent’s own connections to your other machines that need the proxy, and a program that does not support proxy settings cannot make them.
A machine where tailscaled does start but tailnet traffic still goes nowhere has a different problem; when another VPN is on the same machine, see Tailscale and WireGuard on one machine.