VPNSmith
self-host-vpnINFO

wg-quick: resolvconf: command not found. The DNS Line Needs a Program You Do Not Have

wg-quick does not set DNS itself. It shells out to resolvconf, and on a minimal server that binary is simply absent. Three ways to fix it, and the one that is right depends on what already manages your resolver.

By Eric Gerard · Founder · VPNSmith - Self-host VPN & GDPR VPS specialist4 min readPhoto via Pexels

Affiliate disclosure - This post contains Contabo affiliate links. If you grab a VPS through them, we earn a commission at no extra cost to you.

The config is correct, the keys match, and wg-quick up wg0 stops on:

resolvconf: command not found

The message names the real problem exactly, and almost nobody reads it that way. It is not saying your DNS setting is wrong. It is saying a program called resolvconf was supposed to apply it and does not exist on this machine.

What wg-quick actually does with a DNS line

wg-quick is a shell script wrapping the wg command. When your config contains:

[Interface]
DNS = 10.10.0.1

it does not write /etc/resolv.conf itself. It runs the external resolvconf binary and lets that program arbitrate, because several things on a Linux system may want to control the resolver at once and overwriting the file directly is how they fight.

On a desktop distribution that program is present. On a minimal server image, a cloud instance or a container, it usually is not, and the script fails at exactly that line.

An almost empty wire supermarket shelf photographed close up, with a single opened cardboard box of gnocchi left standing on it, the rest of the rack bare
An almost empty wire supermarket shelf photographed close up, with a single opened cardboard box of gnocchi left standing on it, the rest of the rack bare

Fix 1: install a resolvconf implementation

The direct answer, when nothing else manages your resolver:

apt install openresolv        # Debian, Ubuntu
pacman -S openresolv          # Arch

Then wg-quick up wg0 works unchanged.

⛔ Do not do this if systemd-resolved is running. You would then have two programs claiming authority over one file, and the symptom is worse than the error you started with: DNS that works until something restarts and then does not. Check first:

systemctl is-active systemd-resolved

Fix 2: use systemd-resolved, which you may already have

If that command answers active, the machine already has a resolver manager and wg-quick can talk to it through a compatibility shim. On Debian and Ubuntu:

apt install systemd-resolvconf

This provides a resolvconf command that forwards to systemd-resolved rather than a second independent implementation. Confirm afterwards that the file is managed the way you expect:

ls -l /etc/resolv.conf

A symlink into /run/systemd/resolve/ means systemd-resolved owns it. A plain file means something else does, and that is worth resolving before adding a tunnel to the mix.

Fix 3: set DNS yourself with PostUp

If you would rather not install anything, replace the DNS line with commands that do the job directly:

[Interface]
PostUp = printf 'nameserver 10.10.0.1\n' > /etc/resolv.conf
PostDown = printf 'nameserver 1.1.1.1\n' > /etc/resolv.conf

This is blunt and it works, and its two limits should be stated. It overwrites whatever was in the file, so anything else that manages the resolver will disagree with you. And the PostDown line has to restore something sensible, because a tunnel that goes down leaving an empty resolv.conf takes DNS with it.

For a container or a single purpose VPS where nothing else touches the resolver, this is a perfectly reasonable choice.

Fix 4: decide you do not need it

Delete the DNS line and the tunnel comes up immediately.

That is the correct answer in exactly one case: when the tunnel exists to reach a network, not to hide your lookups. A site to site link between two servers has no reason to change either machine's resolver.

⛔ It is the wrong answer when the tunnel is for privacy. Without tunnel DNS, every name you look up still goes to your previous resolver in the clear, and the traffic being encrypted afterwards does not undo that. The mechanics of that leak are in DNS leak prevention.

Choosing between them

systemd-resolved deja actif -> systemd-resolvconf (fix 2) rien ne gere le resolveur -> openresolv (fix 1) conteneur, VPS mono-usage -> PostUp (fix 3) tunnel entre deux serveurs -> retirer la ligne DNS (fix 4)

If you only want your internal domains resolved through the tunnel and the rest left alone, that is a different setup again: WireGuard split DNS.

And if the tunnel now comes up but nothing loads, DNS was not the problem: see MTU for pages that hang, and handshake troubleshooting if wg show reports no handshake at all.

★ Nuremberg GDPR datacenter · ✓ Dedicated IPv4 included · 200+ Mbps guaranteed

Self-host your VPN on your own VPS → ContaboFull root access · public IPv4 · pick your region

Frequently asked questions

Why does wg-quick say resolvconf: command not found?
Because wg-quick does not configure DNS itself. When the config contains a DNS line, it runs the external resolvconf command to apply it, and on a minimal server image that binary is not installed. The tunnel configuration is fine; a helper program is missing.
Can I just delete the DNS line?
Yes, and the tunnel will come up immediately. The consequence is that name lookups keep going to your existing resolver rather than through the tunnel, which is a DNS leak if the point of the tunnel was privacy. It is the right answer only when you did not need tunnel DNS.
Which package provides resolvconf?
On Debian and Ubuntu it is openresolv or resolvconf, and on Arch it is openresolv. On a system already running systemd-resolved, installing another resolvconf implementation can create two managers for one file, which is worse than the original error.
What is the difference between resolvconf and systemd-resolved here?
They solve the same problem in incompatible ways. resolvconf is a small program that arbitrates writes to /etc/resolv.conf; systemd-resolved is a daemon that owns the file through a symlink and is configured with resolvectl. Pick whichever already manages your system and do not install the other.
Does this error mean my VPN is insecure?
No. The error happens before the interface is fully configured, so either the tunnel does not come up at all, or it comes up without the DNS setting you asked for. The second case is worth knowing about, because the tunnel works and the lookups quietly do not use it.