Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] WireGuard installation fails on Raspberry Pi 2 #920

Closed
4 tasks done
acarl005 opened this issue Jan 23, 2020 · 38 comments
Closed
4 tasks done

[BUG] WireGuard installation fails on Raspberry Pi 2 #920

acarl005 opened this issue Jan 23, 2020 · 38 comments
Labels
Broken Dependency Dependency has issues, issue is pending dependency to be fixed bug Great Thread issues/threads with great log reporting and great troubleshooting hints Status: In Progress

Comments

@acarl005
Copy link

acarl005 commented Jan 23, 2020

In raising this issue, I confirm the following:

  • I have read and understood the contributors guide.
  • The issue I am reporting can be replicated.
  • The issue I am reporting can be is directly related to the pivpn installer script.
  • The issue I am reporting isn't a duplicate (see FAQs, closed issues, and open issues).

Describe the bug
My VPN isn't functioning because WireShark was unable to be started.

To Reproduce

  1. Use Raspberry Pi 2, running the Sep 2019 version of Raspbian Lite, plugged into router via ethernet cable.
  2. Install pivpn using the recommended source at https://install.pivpn.dev.
  3. Select mostly the default options, including WireGuard.
  4. I assigned a public DNS name rather than a public IP.

Expected behavior
For the VPN to be correctly functioning and routing traffic.

Actual behavior
Attempting to connect to the VPN from another computer results in no successful network traffic. WireGuard is not able to start on my Pi.

Debug Commands

$ pivpn debug
::::		PiVPN debug		 ::::
=============================================
::::		Latest commit		 ::::
commit 4a49787b28650a9ad84867f3cc11ea70303a7c4e (grafted, HEAD -> master, origin/test, origin/master, origin/HEAD)
Author: Orazio <orazioedoardo@users.noreply.github.com>
Date:   Tue Jan 21 15:54:20 2020 +0100

    Changed variable name, corrected rm typo
=============================================
::::	    Installation settings    	 ::::
PLAT=Raspbian
OSCN=buster
USING_UFW=0
IPv4dev=eth0
dhcpReserv=1
IPv4addr=192.168.1.189
IPv4gw=192.168.1.1
install_user=pi
install_home=/home/pi
VPN=wireguard
pivpnPORT=9337
pivpnDNS1=1.1.1.1
pivpnDNS2=1.0.0.1
pivpnHOST=REDACTED
INPUT_CHAIN_EDITED=0
FORWARD_CHAIN_EDITED=0
UNATTUPG=1
TO_INSTALL=(iptables-persistent qrencode raspberrypi-kernel-headers wireguard wireguard-tools wireguard-dkms unattended-upgrades)
=============================================
::::  Server configuration shown below   ::::
[Interface]
PrivateKey = server_priv
Address = 10.6.0.1/24
ListenPort = 9337
# begin andy
[Peer]
PublicKey = andy_pub
PresharedKey = psk
AllowedIPs = 10.6.0.2/32
# end andy
=============================================
::::  Client configuration shown below   ::::
[Interface]
PrivateKey = andy_priv
Address = 10.6.0.2/24
DNS = 1.1.1.1, 1.0.0.1

[Peer]
PublicKey = server_pub
PresharedKey = psk
Endpoint = REDACTED:9337
AllowedIPs = 0.0.0.0/0
=============================================
:::: 	Recursive list of files in	 ::::
::::�	[4m/etc/wireguard shown below	 ::::
/etc/wireguard:
configs  keys  wg0.conf

/etc/wireguard/configs:
andy.conf  clients.txt

/etc/wireguard/keys:
andy_priv  andy_pub  psk  server_priv  server_pub
=============================================
::::		Self check		 ::::
:: [OK] IP forwarding is enabled
:: [OK] Iptables MASQUERADE rule set
:: [ERR] WireGuard is not running, try to start now? [Y/n] y
Job for wg-quick@wg0.service failed because the control process exited with error code.
See "systemctl status wg-quick@wg0.service" and "journalctl -xe" for details.
Done
:: [OK] WireGuard is enabled (it will automatically start on reboot)
:: [ERR] WireGuard is not listening, try to restart now? [Y/n] y
Job for wg-quick@wg0.service failed because the control process exited with error code.
See "systemctl status wg-quick@wg0.service" and "journalctl -xe" for details.
Done
[INFO] Run pivpn -d again to see if we detect issues
=============================================
:::: WARNING: This script should have automatically masked sensitive       ::::
:::: information, however, still make sure that PrivateKey, PublicKey      ::::
:::: and PresharedKey are masked before reporting an issue. An example key ::::
:::: that you should NOT see in this log looks like this:                  ::::
:::: YIAoJVsdIeyvXfGGDDadHh6AxsMRymZTnnzZoAb9cxRe                          ::::
=============================================
::::		Debug complete		 ::::
$ 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 Wed 2020-01-22 20:15:05 EST; 12s 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
  Process: 1050 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=1/FAILURE)
 Main PID: 1050 (code=exited, status=1/FAILURE)

Jan 22 20:15:04 raspberrypi systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Jan 22 20:15:04 raspberrypi wg-quick[1050]: [#] ip link add wg0 type wireguard
Jan 22 20:15:04 raspberrypi wg-quick[1050]: RTNETLINK answers: Operation not supported
Jan 22 20:15:05 raspberrypi wg-quick[1050]: Unable to access interface: Protocol not supported
Jan 22 20:15:05 raspberrypi wg-quick[1050]: [#] ip link delete dev wg0
Jan 22 20:15:05 raspberrypi wg-quick[1050]: Cannot find device "wg0"
Jan 22 20:15:05 raspberrypi systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 20:15:05 raspberrypi systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
Jan 22 20:15:05 raspberrypi systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
$ wg-quick up wg0
[#] ip link add wg0 type wireguard
RTNETLINK answers: Operation not supported
Unable to access interface: Protocol not supported
[#] ip link delete dev wg0
Cannot find device "wg0"
$ sudo modprobe wireguard
modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.19.75-v7+
$ lsmod | grep wire
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
$ uname -a
Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Desktop (please complete the following information):

  • VPN Protocol: WireGuard
  • OS: Raspbian Lite
  • Version: September 2019, kernel ver 4.19

If there's any other information I can provide, please let me know~!

@orazioedoardo
Copy link
Member

orazioedoardo commented Jan 23, 2020

Can I see the output of these commands?

find /lib/modules -name wireguard.ko
dpkg -s wireguard-tools
dpkg -s wireguard-dkms
dpkg -s raspberrypi-kernel
dpkg -s raspberrypi-kernel-headers
dkms status

@coolapso
Copy link
Member

Kernel headers are missing ... this error is usually related with that.

@metriics
Copy link

Hi, having the same issue. I have the same errors as @acarl005.

@orazioedoardo I am getting these outputs from the commands you mentioned:
find /lib/modules -name wireguard.ko
This has no output.

dpkg -s wireguard-tools

Status: install ok installed
Priority: optional
Section: net
Installed-Size: 265
Maintainer: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Architecture: armhf
Source: wireguard
Version: 1.0.20200121-2
Depends: libc6 (>= 2.8), libmnl0 (>= 1.0.3-4~)
Recommends: nftables | iptables, wireguard-dkms (>= 0.0.20191219) | wireguard-modules (>= 0.0.20171001)
Description: fast, modern, secure kernel VPN tunnel (userland utilities)
 WireGuard is a novel VPN that runs inside the Linux Kernel and uses
 state-of-the-art cryptography (the "Noise" protocol). It aims to be
 faster, simpler, leaner, and more useful than IPSec, while avoiding
 the massive headache. It intends to be considerably more performant
 than OpenVPN. WireGuard is designed as a general purpose VPN for
 running on embedded interfaces and super computers alike, fit for
 many different circumstances. It runs over UDP.
 .
 This package contains command-line tools to interact with the
 WireGuard kernel module.  Currently, it provides only a single tool:
 .
 wg: set and retrieve configuration of WireGuard interfaces
Homepage: https://www.wireguard.com```

`dpkg -s wireguard-dkms`
```Package: wireguard-dkms
Status: install ok installed
Priority: optional
Section: kernel
Installed-Size: 1716
Maintainer: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Architecture: all
Source: wireguard-linux-compat
Version: 0.0.20200121-2
Depends: dkms (>= 2.1.0.0), perl:any
Recommends: wireguard-tools (>= 0.0.20191219), wireguard (>= 0.0.20191219)
Description: fast, modern, secure kernel VPN tunnel (DKMS version)
 WireGuard is a novel VPN that runs inside the Linux Kernel and uses
 state-of-the-art cryptography (the "Noise" protocol). It aims to be
 faster, simpler, leaner, and more useful than IPSec, while avoiding
 the massive headache. It intends to be considerably more performant
 than OpenVPN. WireGuard is designed as a general purpose VPN for
 running on embedded interfaces and super computers alike, fit for
 many different circumstances. It runs over UDP.
 .
 This package uses DKMS to automatically build the wireguard kernel
 module.
 .
 The module will be reloaded on upgrade if the wireguard metapackage
 is also installed.
Homepage: https://www.wireguard.com```

`dpkg -s raspberrypi-kernel`
```Package: raspberrypi-kernel
Status: install ok installed
Priority: optional
Section: kernel
Installed-Size: 275447
Maintainer: Serge Schneider <serge@raspberrypi.org>
Architecture: armhf
Source: raspberrypi-firmware
Version: 1.20200114-1
Replaces: raspberrypi-bootloader (<< 1.20160324-1)
Provides: linux-image
Breaks: raspberrypi-bootloader (<< 1.20160324-1)
Conffiles:
 /etc/default/raspberrypi-kernel aa1f56ed7333c9749dba288036f96334
Description: Raspberry Pi bootloader
 This package contains the Raspberry Pi Linux kernel.
Homepage: https://github.com/raspberrypi/firmware```

`dpkg -s raspberrypi-kernel-headers`
```Package: raspberrypi-kernel-headers
Status: install ok installed
Priority: optional
Section: kernel
Installed-Size: 159214
Maintainer: Serge Schneider <serge@raspberrypi.org>
Architecture: armhf
Source: raspberrypi-firmware
Version: 1.20200114-1
Provides: linux-headers
Description: Header files for the Raspberry Pi Linux kernel
 This package provides the architecture-specific kernel header files for
 the Raspberry Pi Linux kernel, generally used for building out-of-tree
 kernel modules.
Homepage: https://github.com/raspberrypi/firmware```

`dkms status`
This has no output.

Seems like the wireguard module doesn't get installed? 

@alexschomb
Copy link

I'm having the exact same issues on a Raspberry Pi 4. Complete fresh install of the latest Raspbian Lite, just enabled ssh, installed updates and ran the pivpn script (Method 1, selected all default options like WireGuard/DHCP/external IP/...). raspberrypi-kernel-headers, wireguard-dkms, ... is installed. It all comes down to the kernel module and as a result of that the interface not being available:

pi@raspberrypi:~ $ sudo modprobe wireguard
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.75-v7l+/modules.dep.bin'
modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.19.75-v7l+
pi@raspberrypi:~ $ sudo wg-quick up wg0
[#] ip link add wg0 type wireguard
RTNETLINK answers: Operation not supported
Unable to access interface: Protocol not supported
[#] ip link delete dev wg0
Cannot find device "wg0"

@metriics
Copy link

I'm having the exact same issues on a Raspberry Pi 4. Complete fresh install of the latest Raspbian Lite, just enabled ssh, installed updates and ran the pivpn script (Method 1, selected all default options like WireGuard/DHCP/external IP/...). raspberrypi-kernel-headers, wireguard-dkms, ... is installed. It all comes down to the kernel module and as a result of that the interface not being available:

pi@raspberrypi:~ $ sudo modprobe wireguard
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.75-v7l+/modules.dep.bin'
modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.19.75-v7l+
pi@raspberrypi:~ $ sudo wg-quick up wg0
[#] ip link add wg0 type wireguard
RTNETLINK answers: Operation not supported
Unable to access interface: Protocol not supported
[#] ip link delete dev wg0
Cannot find device "wg0"

Yep, same here. Fresh install, enabled SSH, installed noip2 and set DDNS name in the pivpn script rather than public ip.

@alexschomb
Copy link

I just tried to update the kernel with rpi-update with no success. It seems like the newest kernel being delivered by default is a testing version now. It might help going back to an older stable version.

pi@raspberrypi:~ $ apt search raspberrypi-kernel
Sorting... Done
Full Text Search... Done
raspberrypi-kernel/testing,now 1.20200114-1 armhf [installed]
  Raspberry Pi bootloader

raspberrypi-kernel-headers/testing,now 1.20200114-1 armhf [installed]
  Header files for the Raspberry Pi Linux kernel

Unfortunately the recommended command just brings you back to the same testing kernel:
sudo apt install --reinstall raspberrypi-bootloader raspberrypi-kernel

@metriics
Copy link

metriics commented Jan 23, 2020

Hey, I was looking through a thread on /r/pihole about wireguard, and in the troubleshooting section it mentioned the issue we are having with missing module. Link

The command he runs is sudo BRANCH-stable rpi-update

EDIT: I'm trying this right now.

@alexschomb
Copy link

That doesn't work, but we might be lucky by using the commit hash of the correct commit.

sudo rpi-update HASH

The commits can be found here, still figuring out how far back to go...
https://github.com/Hexxeh/rpi-firmware/commits/master

@orazioedoardo
Copy link
Member

orazioedoardo commented Jan 23, 2020

@alexschomb @metriics Since all packages seem to be installed I think the issue reduces to wireguard-dkms not actually compiling the kernel module.

As a workaround we could tell dkms to build and install the module:

sudo -s
source /usr/src/wireguard-*/dkms.conf
dkms add wireguard/$PACKAGE_VERSION
dkms build wireguard/$PACKAGE_VERSION
dkms install wireguard/$PACKAGE_VERSION
exit

pivpn debug and say yes to the self check

I'm not sure whether dkms will register a new wireguard module when the wireguard-dkms package is upgraded, so hold on, I'm trying to reproduce with a clean install to make sure it's not an issue with wireguard-dkms version 0.0.20200121-2

@alexschomb
Copy link

alexschomb commented Jan 23, 2020

Can confirm that this definitely works on my system! Thank you 👍

@orazioedoardo
Copy link
Member

Can confirm that this definitely works on my system!

Stable kernel from raspberrypi-kernel?

@alexschomb
Copy link

Nope. I was using the following kernel (I was in the middle of downgrading step by step):
Hexxeh/rpi-firmware@b2b5f9e

I'll try to confirm this works with a fresh system and the newest "stable" kernel.

By the way, there is a minor bug I noticed. When the interface is not available, but a client was added to PiVPN (that never was connected to it before) the following output is printed:

pi@raspberrypi:~ $ pivpn -c
Unable to access interface: Protocol not supported
::: Connected Clients List :::
/opt/pivpn/clientSTAT.sh: line 30: [: : integer expression expected
numfmt: invalid number: ‘’
numfmt: invalid number: ‘’
Name      Remote IP      Virtual IP      Bytes Received      Bytes Sent      Last Seen
test                                                                         (not yet)

@orazioedoardo
Copy link
Member

orazioedoardo commented Jan 23, 2020

Nope. I was using the following kernel (I was in the middle of downgrading step by step):
Hexxeh/rpi-firmware@b2b5f9e

I'll try to confirm this works with a fresh system and the newest "stable" kernel.

4.19.93 is indeed the kernel from the official repository.

By the way, there is a minor bug I noticed. When the interface is not available, but a client was added to PiVPN (that never was connected to it before) the following output is printed:

Makes sense since the script runs wg show wg0 dump, which is empty if the interface is not available, thanks.

@metriics
Copy link

Can confirm that worked for me as well. After building and installing I reran the PiVPN install script and rebooted, seems everything is working. Due to a router issue I can't portforward for now so I can't say for sure if it is functioning but the module shows up and I am getting no interface errors.

The module shows up now as well after running the find command mentioned earlier:
/lib/modules/4.19.93-v7l+/kernel/net/wireguard.ko

@alexschomb
Copy link

alexschomb commented Jan 23, 2020

I can now confirm that this definitely fixes the issue. I did a complete clean install of latest Raspbian, did sudo apt update && sudo apt upgrade -y, rebooted, installed pivpn (Method 1), rebooted. The issue was there again. Then I ran the commands to install the dkms module and rebooted. Bam, everything works as expected! (Connecting from external networks via port forwarding works as well)

Now, how to fix this bug for everyone so that no workaround is required? (Meaning: Who should be informed? Authors of wireguard-dkms?)

@orazioedoardo
Copy link
Member

orazioedoardo commented Jan 23, 2020

@alexschomb Just tried to install wireguard on a fully updated Debian. I can confirm that wirguard-dkms 0.0.20200121-2 does not compile the module, in fact someone reported this in the bug tracker: link 1, link 2. Wait for wireguard-dkms version 0.0.20200121-3.

@coolapso coolapso added bug Status: In Progress Unrelated Broken Dependency Dependency has issues, issue is pending dependency to be fixed Great Thread issues/threads with great log reporting and great troubleshooting hints and removed Needs Investigation Unrelated labels Jan 23, 2020
@acarl005
Copy link
Author

This worked for me as well! Thanks for your help y'all.

@jameshope87
Copy link

jameshope87 commented Jan 24, 2020

This fix doesn't seem to be working for me.

I get this when I try the commands:

pi@homepi:~/configs $ sudo -s root@homepi:/home/pi/configs# source /usr/src/wireguard-*/dkms.conf root@homepi:/home/pi/configs# dkms add wireguard/$PACKAGE_VERSION Error! DKMS tree already contains: wireguard-0.0.20200121 You cannot add the same module/version combo more than once.

@orazioedoardo
Copy link
Member

@jameshope87 You cannot add the same module/version combo more than once. means that your kernel module is already loaded. What's your pivpn debug?

@jameshope87
Copy link

It gave the same kind of thing as the previous poster.

I noticed that I am still running stretch, with kernel 4.19.66-v7+

So I am updating that, and I will try again and report back.

@danielk117
Copy link

I've got the same error as @acarl005 and the workaround from @orazioedoardo throws You cannot add the same module/version combo more than once. like @jameshope87. So I tried to uninstall and remove first, like this:

sudo -s
source /usr/src/wireguard-*/dkms.conf
dkms uninstall wireguard/$PACKAGE_VERSION
dkms remove wireguard/$PACKAGE_VERSION
dkms add wireguard/$PACKAGE_VERSION
dkms build wireguard/$PACKAGE_VERSION
dkms install wireguard/$PACKAGE_VERSION
exit

Afterwards I run pivpn debug and I was possible to start wireguard:

::::            Self check               ::::
:: [OK] IP forwarding is enabled
:: [OK] Iptables MASQUERADE rule set
:: [OK] Iptables FORWARD rule set
:: [ERR] WireGuard is not running, try to start now? [Y/n] y
Done
:: [OK] WireGuard is enabled (it will automatically start on reboot)
:: [OK] WireGuard is listening on port 443/udp
[INFO] Run pivpn -d again to see if we detect issues

And now I'm able to connect to my vpn!

::: Connected Clients List :::
Name        Remote IP               Virtual IP      Bytes Received      Bytes Sent      Last Seen
iphone      xxx.xx.xxx.x:24423      10.6.0.2        21KiB               33KiB           Jan 01 2020 - 08:47:23

@orazioedoardo
Copy link
Member

@danielk117 Do you still have the affected version 0.0.20200121-2? dpkg -s wireguard-dkms | grep Version:

By the way I noticed a bug in pivpn -c: it shows the month number instead of the day of the month (Jan 01 2020 - 08:47:23 instead of Jan 27 2020 - 08:47:23). To fix edit /opt/pivpn/clientSTAT.sh as root and replace %m with %d here:

printf "%s \t %s \t %s \t %s \t %s \t %s\n" "$CLIENT_NAME" "$REMOTE_IP" "${VIRTUAL_IP/\/32/}" "$(hr "$BYTES_RECEIVED")" "$(hr "$BYTES_SENT")" "$(date -d @"$LAST_SEEN" '+%b %m %Y - %T')"

@danielk117
Copy link

@orazioedoardo No I've got version 0.0.20200121-3, but the same errors described here.

@orazioedoardo
Copy link
Member

First install of PiVPN/WireGuard on this Pi?

@danielk117
Copy link

Yes!

@orazioedoardo
Copy link
Member

orazioedoardo commented Jan 27, 2020

Not sure what's the problem then. When version 0.0.20200121-3 came out I tried PiVPN on a clean install and had no error. Perhaps on your side DKMS had a module loaded, but for a different kernel (maybe a new kernel and you just had to reboot).

@danielk117
Copy link

It was nearly a clean raspbian install and I rebooted a couple of times (mutiple installs and repairs of PiVPN, because I tought I did something wrong).
But it's been working reliably for two days now.

@Flint4
Copy link

Flint4 commented Aug 20, 2020

Had the same issue on an installation which was already working for a few weeks. For me,

apt-get update && sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel

helped. It reinstalled versions 1.20200811-1

I think the issue started after unattended-upgrades did updates on
libraspberrypi-doc (1.20200811-1) over (1.20200723-1)
libraspberrypi-dev (1.20200811-1) over (1.20200723-1)
libraspberrypi-bin (1.20200811-1) over (1.20200723-1)
libraspberrypi0 (1.20200811-1) over (1.20200723-1)
raspberrypi-bootloader (1.20200811-1) over (1.20200723-1)
raspberrypi-kernel (1.20200811-1) over (1.20200723-1)
raspberrypi-kernel-headers (1.20200811-1) over (1.20200723-1)

@gonsaaa
Copy link

gonsaaa commented Aug 20, 2020

Had the same issue on an installation which was already working for a few weeks. For me,

apt-get update && sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel

helped. It reinstalled versions 1.20200811-1

I think the issue started after unattended-upgrades did updates on
libraspberrypi-doc (1.20200811-1) over (1.20200723-1)
libraspberrypi-dev (1.20200811-1) over (1.20200723-1)
libraspberrypi-bin (1.20200811-1) over (1.20200723-1)
libraspberrypi0 (1.20200811-1) over (1.20200723-1)
raspberrypi-bootloader (1.20200811-1) over (1.20200723-1)
raspberrypi-kernel (1.20200811-1) over (1.20200723-1)
raspberrypi-kernel-headers (1.20200811-1) over (1.20200723-1)

This also helped me.
it is working now.

@gtmartin69
Copy link

sudo -s
source /usr/src/wireguard-*/dkms.conf
dkms uninstall wireguard/$PACKAGE_VERSION
dkms remove wireguard/$PACKAGE_VERSION
dkms add wireguard/$PACKAGE_VERSION
dkms build wireguard/$PACKAGE_VERSION
dkms install wireguard/$PACKAGE_VERSION
exit

This worked for me, the comment to just add, build, install did not, I needed to uninstall and remove first. I never tried the last post commands as I never made it that far down in this post until after this successfully created the wg0 network interface.

Thank you guys!

@anton26
Copy link

anton26 commented Oct 31, 2020

@gtmartin69 yes, the steps mentioned works

@boomam
Copy link

boomam commented Nov 8, 2020

Steps mentioned do not work for me.
Fresh Raspbian install on RPi-4.

Errors at every step past source (see below), running latest Raspbian as of today, all updates installed too.

dkms uninstall wireguard/$PACKAGE_VERSION
Error! The module wireguard 1.0.20200908 is not currently installed.
This module is not currently ACTIVE for kernel 5.4.74-v7l+ (armv7l)

dkms remove wireguard/$PACKAGE_VERSION
Error! Invalid number of parameters passed.
Usage: remove / --all
or: remove / -k

dkms add wireguard/$PACKAGE_VERSION
Error! DKMS tree already contains: wireguard-1.0.20200908
You cannot add the same module/version combo more than once

dkms build wireguard/$PACKAGE_VERSION
Error! echo
Your kernel headers for kernel 5.4.74-v7l+ cannot be found at
/lib/modules/5.4.74-v7l+/build or /lib/modules/5.4.74-v7l+/source.

dkms install wireguard/$PACKAGE_VERSION
Error! echo
Your kernel headers for kernel 5.4.74-v7l+ cannot be found at
/lib/modules/5.4.74-v7l+/build or /lib/modules/5.4.74-v7l+/source.

@boomam
Copy link

boomam commented Nov 8, 2020

Update -
Uninstalling pivpn, then manually installing dkms, rebooting, installing pivpn again, rebooting - now works.
Very strange...

@jasonzou0
Copy link

I've got the same error as @acarl005 and the workaround from @orazioedoardo throws You cannot add the same module/version combo more than once. like @jameshope87. So I tried to uninstall and remove first, like this:

sudo -s
source /usr/src/wireguard-*/dkms.conf
dkms uninstall wireguard/$PACKAGE_VERSION
dkms remove wireguard/$PACKAGE_VERSION
dkms add wireguard/$PACKAGE_VERSION
dkms build wireguard/$PACKAGE_VERSION
dkms install wireguard/$PACKAGE_VERSION
exit

Afterwards I run pivpn debug and I was possible to start wireguard:

::::            Self check               ::::
:: [OK] IP forwarding is enabled
:: [OK] Iptables MASQUERADE rule set
:: [OK] Iptables FORWARD rule set
:: [ERR] WireGuard is not running, try to start now? [Y/n] y
Done
:: [OK] WireGuard is enabled (it will automatically start on reboot)
:: [OK] WireGuard is listening on port 443/udp
[INFO] Run pivpn -d again to see if we detect issues

And now I'm able to connect to my vpn!

::: Connected Clients List :::
Name        Remote IP               Virtual IP      Bytes Received      Bytes Sent      Last Seen
iphone      xxx.xx.xxx.x:24423      10.6.0.2        21KiB               33KiB           Jan 01 2020 - 08:47:23

This is great and solved my problem where pivpn broke after a recent Raspberry OS upgrade. Only minor change is that instead of 'dkms remove wireguard/$PACKAGE_VERSION' you need to add the --all option, otherwise it will complain for 'error! invalid number of parameters passed.'

@AlexKLMan
Copy link

Does anyone know what causes this, so this won't happen again? I only installed PiVPN last month, and it gave me the interface bug today.

@hardwareadictos
Copy link

Same issue here...

@Flint4
Copy link

Flint4 commented Feb 1, 2021

According to my own experience most issues start with broken upgrades of kernel. This article here helped me most of the times:
https://github.com/pivpn/pivpn/wiki/WireGuard#how-to-i-fix-a-broken-wireguard-update
As long as raspberrypi-kernel and raspberrypi-kernel-headers are properly installed (stable version), it should be possible to re-build wireguard using dpkg-reconfigure wireguard-dkms.
Additionally I blacklisted raspberrypi-kernel, raspberrypi-kernel-headers and raspberrypi-bootloader in unattended upgrades config to avoid further issues. In future, if any kernel update is pending I will run that manually. Will see if that helps in long term.

@Mr-Technician
Copy link

Same issue here with a fresh install on Debian Buster (Google Cloud Instance). The fixes above aren't helping:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Broken Dependency Dependency has issues, issue is pending dependency to be fixed bug Great Thread issues/threads with great log reporting and great troubleshooting hints Status: In Progress
Projects
None yet
Development

No branches or pull requests