pivpn: [Support] Wireguard connection suddenly don't work anymore[partly fixed, remaining error in debug]

  • I have read and understood the contributors guide.
  • [unsure how my issue came up so I don’t know] The issue I am reporting can be replicated.
  • [unsure] 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).

Issue

I used PiVPN with wireguard for several month without any issue. Today suddenly the VPN connection didn’t worked anymore. I logged on the raspberrypi and tried to find out what the problem is. pivpn -c --> Unable to access interface: Protocol not supported pivpn -d --> ::: Missing setup vars file!

I checked the folder /etc/pivpn/SetupVars.conf file exists. I checked the content of the SetupVars.conf file it is the same like in my backup of the raspberry pi sd card. I checked the content of /etc/wireguard/wg0.conf, seems also to be the same as before in my backup.

I found this reddit post : reddit and there was a guide linked --> guide I followed this guide: apt update apt upgrade apt install raspberrypi-kernel-headers --> output raspberrypi-kernel-headers is already installed (1.20201022-1) reboot now apt reinstall wireguard-dkms

Then pivpn -c showed again my client list. But I still get pivpn -d --> ::: Missing setup vars file!. I checked the folder /etc/pivpn/SetupVars.conf file exists. According to FAQ there should be a sub-folder wireguard --> /etc/pivpn/wireguard/setupVars.conf I now manually copied the setupVars.conf file to /etc/pivpn/wireguard/setupVars.confand run again pivpn -d:

And got the again complete debug output. But at the top I got the following error:

::::		Latest commit		 ::::
fatal: Kein Git-Repository: '/usr/local/src/pivpn/.git'

Have you searched for similar issues and solutions?

(yes/no / which issues?)

Yes, see explanation above.

Console output of curl -L install.pivpn.dev | bash

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    17  100    17    0     0     57      0 --:--:-- --:--:-- --:--:--    57
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (35) error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error

Console output of pivpn debug

::::		PiVPN debug		 ::::
=============================================
::::		Latest commit		 ::::
fatal: Kein Git-Repository: '/usr/local/src/pivpn/.git'
=============================================
::::	    Installation settings    	 ::::
PLAT=Raspbian
OSCN=buster
USING_UFW=0
IPv4dev=eth0
dhcpReserv=1
IPv4addr=xxx
IPv4gw=xxx
install_user=xxx
install_home=/home/xxx
VPN=wireguard
pivpnPORT=xxx
pivpnDNS1=xxx
pivpnDNS2=
pivpnHOST=REDACTED
INPUT_CHAIN_EDITED=0
FORWARD_CHAIN_EDITED=0
pivpnPROTO=udp
pivpnDEV=wg0
pivpnNET=xxx
subnetClass=xxx
UNATTUPG=1
INSTALLED_PACKAGES=(raspberrypi-kernel-headers wireguard wireguard-tools wireguard-dkms qrencode)
=============================================
::::  Server configuration shown below   ::::
[Interface]
PrivateKey = server_priv
Address = xxxx
ListenPort = xxx
# begin xxx
[Peer]
PublicKey = xxx_pub
PresharedKey = psk
AllowedIPs = xxx
# end xxx
# begin xxx
[Peer]
PublicKey = xxx_pub
PresharedKey = psk
AllowedIPs = xxx
# end xxx
# begin xxx_work
[Peer]
PublicKey = xxx_pub
PresharedKey = psk
AllowedIPs = xxx
# end xxx
# begin xxx
[Peer]
PublicKey = xxx_pub
PresharedKey = psk
AllowedIPs = xxx
# end xxx
=============================================
::::  Client configuration shown below   ::::
[Interface]
PrivateKey = xxx
Address = xxx
DNS = xxx

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

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

/etc/wireguard/keys:
xxx_priv  xxx_priv  m_smartphone_priv  xxx_priv  psk	   server_pub
xxx_pub   xxx_pub   xxx_pub   xxx_pub   server_priv
=============================================
::::		Self check		 ::::
:: [OK] IP forwarding is enabled
:: [OK] Iptables MASQUERADE rule set
:: [OK] WireGuard is running
:: [OK] WireGuard is enabled (it will automatically start on reboot)
:: [OK] WireGuard is listening on port xxx/udp
=============================================
:::: Having trouble connecting? Take a look at the FAQ:
:::: https://github.com/pivpn/pivpn/wiki/FAQ
=============================================
:::: 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		 ::::

Have you taken any steps towards solving your issue?

Some steps from reddit, see explanation at the top.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

You are right! I tried to find a script but found nothing matching to this issue. So I tried with trail and error to extract the status with help of some script pieces I found online. Here my first try:

status="$(systemctl status wg-quick@wg0.service --no-page)"
status_text=$(echo "${status}" | grep -o 'active')
if [ "${status_text}" == "active" ]
then
    echo "Wireguard active, do nothing"
else
    echo "Wireguard not active, starting dpkg-reconfigure"
    dpkg-reconfigure wireguard-dkms
    systemctl restart wg-quick@wg0
fi

make the script executable with: sudo chmod +x /path/to/script.sh

Add to /etc/apt/apt.conf.d/ a configuration file with any name with following content: Dpkg::Post-Invoke {"\pathto\above\script.sh";};

Any thoughts and comments are welcome 😃

Okay thanks for answer. Ok that means that happens also from time to time on your pi?

Yes. I’m thinking to add dpkg-reconfigure to the pivpn self check to easen the fix.

I thought probably I have apt package source from testing branch activated…because I see during apt update everything that my pi pulls also from bullseye repo…

The PiVPN installer adds the bullseye repo because wireguard is not in the default buster or stretch repo.