# wg-quick: 'wg0' already exists

TL;DR: a wg0 interface is already up from an earlier run, so wg-quick will not create a second one. Run `sudo wg-quick down wg0` first, then `up` again. This bites when a previous `up` half-succeeded or the config was applied by hand.

```text
wg-quick: 'wg0' already exists
```

## Steps

1. Take the existing interface down:

```bash
sudo wg-quick down wg0
```

Expected: no output.

2. Confirm it is gone:

```bash
ip link show wg0
```

Expected: `Device "wg0" does not exist.`

3. Bring it up fresh:

```bash
sudo wg-quick up wg0
```

Expected: the interface is created and `wg show wg0` lists peers.

## When this applies

- re-running `wg-quick up` after it was killed midway
- scripts that call `up` without a matching `down`
- the interface was created manually and then wg-quick ran

## When it doesnt

- `RTNETLINK answers: File exists` — leftover addresses, a level deeper than this
- config file missing — different error entirely
- you actually want two tunnels — give the second a different interface name

## Compatibility

wireguard-tools wg-quick on Linux.

## Other phrasings

- `wg-quick interface already exists`
- `cannot create wg0: exists`

## Why it happens

wg-quick refuses to create an interface that already exists rather than silently reusing it, because reusing it could mean applying a new config to a live tunnel halfway.

## Edge cases

- If `down` claims the interface is not defined but `ip link` shows it, delete it directly with `ip link delete wg0`.
- Persistent interfaces managed by systemd-networkd should be restarted through the service, not wg-quick.
