On this page
How to read what wg-quick prints
wg-quick is a script that runs one command after another and prints each with [#] in front. The first command that fails stops it. Right after that it removes the interface, so the last lines are often [#] ip link delete dev wg0: that is cleaning up, not the error. The error is the line before it, and the [#] line above says which command gave it.
resolvconf: command not foundCause
DNSin the file, noresolvconfin the systemWhat to doSee the next section
wg-quick: `wg0' already exists
CauseThe interface is up already, often by the service at boot
What to do
sudo wg-quick down wg0, then upwg-quick: `wg0' is not a WireGuard interface
Cause
downfor a tunnel that isn't up, or the name belongs to another programWhat to do
sudo wg show interfaceslists the real onesError: Unknown device type.orRTNETLINK answers: Operation not supportedafterip link addCauseThe running kernel has no WireGuard
What to doLoad the module, reboot after a kernel update, or wireguard-go
RTNETLINK answers: Operation not supportedafterip -6 address addCauseIPv6 is off in the kernel (
ipv6.disable=1)What to doRemove the IPv6 address from
Address, or turn IPv6 onError: ipv6: IPv6 is disabled on this device.orRTNETLINK answers: Permission deniedCauseIPv6 is switched off with sysctl (
disable_ipv6=1)What to doThe same: remove the IPv6 address or turn IPv6 on
RTNETLINK answers: Operation not permittedCauseNo right to change the network: a container, or no root
What to doSee “Operation not permitted” below
RTNETLINK answers: File existsafterip route addCauseAnother interface already has a route to exactly this network
What to doNarrow
AllowedIPs, or take the other tunnel downRTNETLINK answers: Address already in useafterip link setCause
ListenPortis taken by another program or tunnelWhat to doAnother port, or
sudo ss -ulnpto see who holds itTemporary failure in name resolution, thenTrying again in 1.00 seconds...CauseThe name in
Endpointdoesn't resolve yet: no network or DNSWhat to doWait for the network, or put the IP into
Endpointiptables-restore: command not foundCauseFull tunnel, and neither nftables nor iptables is installed
What to do
sudo apt install nftablespermission denied on keywithnet.ipv4.conf.all.src_valid_markCauseFull tunnel in a container that may not change sysctl
What to doStart it with
--sysctl net.ipv4.conf.all.src_valid_mark=1wg-quick: The config file must be a valid interface name, followed by .conf
CauseThe file's name is longer than 15 characters or has spaces or brackets
What to doRename it, for example
wg0.conf
resolvconf: command not found
WireGuard itself knows nothing of DNS. For a DNS line wg-quick runs resolvconf -a wg0 -m 0 -x, and the program isn't part of the wireguard-tools package. What to install depends on who runs DNS on the system, and the first command below tells that.
On Ubuntu 22.04 the usual cause is that resolvectl is there and its second name isn't: the file resolvconf came into the systemd-resolved package later, in 24.04 it is included. One program answers to both names, its manual says so, so a link is enough.
systemctl is-active systemd-resolvedactive: take the link from the next command. Anything else: install a resolvconf of its own.
sudo ln -s "$(command -v resolvectl)" /usr/local/bin/resolvconfMakes resolvectl answer to the name wg-quick calls. On Arch the package systemd-resolvconf does the same.
sudo apt install openresolvOn Arch: sudo pacman -S openresolv, on Alpine: sudo apk add openresolv.
PostUp = resolvectl dns %i 1.1.1.1; resolvectl domain %i "~."For systems with systemd-resolved. %i is the interface, ~. sends all names to this DNS.
- Just delete the
DNSline and the tunnel comes up, but names go to the DNS the system already had, often the provider's: that is a DNS leak. Failed to set DNS configurationandresolve1in the rest of the line: the link is there, systemd-resolved isn't running.sudo systemctl enable --now systemd-resolved.signature mismatch: /etc/resolv.confcomes from openresolv: another program rewrote the file after it.sudo resolvconf -uwrites it anew; then decide which of the two should manage DNS.Failed to resolve interface "tun.wg0": a leftover/etc/resolvconf/interface-orderfrom the old resolvconf package makes wg-quick puttun.in front. Update wireguard-tools or remove the old package withsudo apt purge resolvconf.
wg-quick: `wg0' already exists
Before doing anything wg-quick checks whether an interface with this name is there, and stops if it is. Most often the tunnel was started at boot by wg-quick@wg0, or is still up from last time. To apply an edited file without dropping connections there is syncconf; it doesn't change addresses, DNS or routes, for those restart the tunnel.
sudo wg-quick down wg0 &&
sudo wg-quick up wg0Restart by hand. If the service manages the tunnel, use sudo systemctl restart wg-quick@wg0 and not both.
sudo bash -c 'wg syncconf wg0 <(wg-quick strip wg0)'Applies keys, peers, AllowedIPs and endpoints to the running tunnel. sudo systemctl reload wg-quick@wg0 does the same.
ip -d link show wg0If down says it isn't a WireGuard interface, this shows what it is and which type. A name taken by another program is best left alone: rename your file.
RTNETLINK answers: Operation not supported
The line above is [#] ip link add dev wg0 type wireguard: the kernel was asked for an interface of a type it doesn't know. Newer systems word it as Error: Unknown device type. WireGuard has been part of the kernel since 5.6; on an older kernel it is a separate module. The other common reason is an update: the kernel's package was replaced, the computer wasn't restarted, and the modules of the running version are gone.
The same failure gives Unable to access interface: Protocol not supported in wg show wg0.
uname -r; ls /lib/modules; sudo modprobe wireguardThe running version has to be in the list. Not there: reboot. There, but modprobe doesn't find wireguard: the kernel was built without it, or is older than 5.6.
sudo apt install wireguardBrings the module together with the tools where the kernel has none of its own. After that, sudo modprobe wireguard.
- Virtual servers without their own kernel (OpenVZ, LXC): the module must be loaded on the host. You can't do that from inside, so ask the hosting company or take a KVM server.
- wireguard-go. If the module isn't there but
wireguard-gois installed, wg-quick takes it by itself and says[!] Missing WireGuard kernel module. Falling back to slow userspace implementation.It needs/dev/net/tun.
RTNETLINK answers: Operation not permitted
Creating an interface needs the right to manage the network. wg-quick asks for sudo by itself, so on an ordinary computer you rarely see this; in a container, root inside is not root for the network.
docker run --cap-add NET_ADMIN --sysctl net.ipv4.conf.all.src_valid_mark=1 IMAGEThe right to manage the container's network, and the sysctl a full tunnel needs. The module itself is taken from the host. IMAGE is your image.
- LXC and Proxmox: load
wireguardon the host; for wireguard-go let the container use/dev/net/tun. Unable to access interface: Operation not permittedfromwg showis simpler: run it with sudo.
If that isn't it
If the tunnel comes up at your hand and not at boot, look at the service's log. Its unit waits for the network and repeats failed name lookups without end, so with no DNS at boot it keeps starting. If the last line is Configuration parsing error, the trouble is in the file: see the guide on config errors.
journalctl -u wg-quick@wg0 -b --no-pagerWhat the service printed since the last boot, with the [#] lines.