Wireguard no Longer working - DietPi Upgrade

So I did the latest DietPI upgrade and I think I may have gotten too new of a kernel.

When I tried to run Wireguard it would try to handshake and never connect.

Running

sudo dpkg-reconfigure wireguard-dkms

It gets stuck

Module build for kernel 5.4.79-v8+ was skipped since the
kernel headers for this kernel does not seem to be installed.

My uname -r shows 5.4.79-v7+

Any help would be appreciated.

Hi,

the message you have posted is as expected. you are running Raspberry OS 32bit, therefore compiling 64bit (5.4.79-v8+) is skipped by dpkg. Nothing to worry about.

Pls can you check status if wireguard

systemctl status wg-quick@wg0.service
journalctl -u wg-quick@wg0

Oh duh that makes sense, and for those commands

Here is the status of Wireguard.

systemctl status wg-quick@wg0.service
● wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0
   Loaded: loaded (/lib/systemd/system/wg-quick@.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2020-12-07 16:34:00 EST; 23h ago
     Docs: man:wg-quick(8)
           man:wg(8)
           https://www.wireguard.com/
           https://www.wireguard.com/quickstart/
           https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
           https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8
 Main PID: 610 (code=exited, status=1/FAILURE)

Trying Journal I get no entries, (It might be because I uninstalled/reinstalled Wireguard.

can you try following

wg-quick up wg0
 wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.9.0.1/24 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] resolvconf -a tun.wg0 -m 0 -x
[#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
[#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Edit:

I tried to start it and it errored again but i got this

sudo journalctl -u wg-quick@wg0
-- Logs begin at Tue 2020-12-08 10:55:12 EST, end at Tue 2020-12-08 16:05:27 EST. --
Dec 08 16:04:35 DietPi systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Dec 08 16:04:35 DietPi wg-quick[20710]: wg-quick: `wg0' already exists
Dec 08 16:04:35 DietPi systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAI
LURE
Dec 08 16:04:35 DietPi systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
Dec 08 16:04:35 DietPi systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.

well you can’t start wireguard interface wg0 twice :wink:

Dec 08 16:04:35 DietPi wg-quick[20710]: wg-quick: `wg0' already exists

before starting the service, you would need to bring down the interface you started manually before

wg-quick down wg0

btw this doesn’t looks like a DietPi wireguard server configuration. :thinking:

So bringing the interface down and starting it fixed my issue.
Wouldn’t a reboot on the Pi have done that before?

Either way that fixed my issue.

yes probably a reboot would have been fixed it as well. This is always recommended after a kernel update to load the new version

Strange, I reboot it twice and it still was acting up. Maybe the whole reinstall afterwards fixed it and just needed that.

Thanks for all the help.

Also, I set up wireguard before it was included in the DietPi-software I believe so maybe that is why it’s not standard.

Would it be better if I uninstalled it and reinstalled it via dietpi-software?

that’s a good explanation. At least it’s fixed now :slight_smile: