angristan / wireguard-install

WireGuard VPN installer for Linux servers
https://stanislas.blog/2019/01/how-to-setup-vpn-server-wireguard-nat-ipv6/
MIT License
7.96k stars 1.3k forks source link

Installation fails on Raspbian #263

Closed andreipampukha closed 2 years ago

andreipampukha commented 3 years ago

In the beginning of the script, Raspbian is considered to be a flavor of Debian, which is correct: https://github.com/angristan/wireguard-install/blob/master/wireguard-install.sh#L38

But later, when the packages are being installed, we only check for Debian: https://github.com/angristan/wireguard-install/blob/574cc06b31c73cb3b57ffb51b0b025052be69886/wireguard-install.sh#L126

I would propose to set OS to Debian after the conditional statement on lines 39-42. I've tested the change successfully on Raspbian 11.

angristan commented 3 years ago

Related: https://github.com/angristan/wireguard-install/issues/73

angristan commented 3 years ago

I would love a PR to fix that!

andreipampukha commented 3 years ago

I would be more than happy to make one, but I can't create branches in the repo :(

notjulian commented 3 years ago

I would be more than happy to make one, but I can't create branches in the repo :(

I'm also intrested in this fix ... first fork the repo ... that you can send a PR ;-) thanks for your fix :-)

nueh commented 2 years ago

I've tested the change successfully on Raspbian 11.

Which is not yet released.

Your pull request #271 does not work on Raspbian 10.

andreipampukha commented 2 years ago

Oh, sorry that you had to experience this! I won't have an access to a machine with Raspbian 10 for some days, would you mind sharing the output of the script so I can try to figure out what went wrong?

nueh commented 2 years ago

Since the repos of Raspbian 10 include Wireguard it should be treated as Ubuntu and Debian 11 (> 10) in installWireGuard(), I think.

Maybe by testing explicitly for || [[ ${OS} == 'raspbian' ]] in line 126 and not setting OS to Debian in checkOS()?

Anyway, here’s the output of the script:

[...]
Okay, that was all I needed. We are ready to setup your WireGuard server now.
You will be able to generate a client at the end of the installation.
Press any key to continue...
Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Get:3 http://deb.debian.org/debian buster-backports InRelease [46.7 kB]
Err:3 http://deb.debian.org/debian buster-backports InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9
Reading package lists... Done
W: GPG error: http://deb.debian.org/debian buster-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9
E: The repository 'http://deb.debian.org/debian buster-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Reading package lists... Done
[...]
E: The value 'buster-backports' is invalid for APT::Default-Release as such a release is not available in the sources
./wireguard-install.sh: line 160: wg: command not found
./wireguard-install.sh: line 161: wg: command not found
* Applying /etc/sysctl.d/98-rpi.conf ...
[...]
* Applying /etc/sysctl.conf ...
Failed to start wg-quick@wg0.service: Unit wg-quick@wg0.service not found.
Failed to enable unit: Unit file wg-quick@wg0.service does not exist.

Tell me a name for the client.
The name must consist of alphanumeric character. It may also include an underscore or a dash and can't exceed 15 chars.
Client name: foo
Client's WireGuard IPv4: 10.66.66.2
Client's WireGuard IPv6: fd42:42:42::2
./wireguard-install.sh: line 273: wg: command not found
./wireguard-install.sh: line 274: wg: command not found
./wireguard-install.sh: line 275: wg: command not found
./wireguard-install.sh: line 313: wg: command not found
./wireguard-install.sh: line 313: wg-quick: command not found

Here is your client config file as a QR Code:
[...]
It is also available in /home/pi/wg0-client-foo.conf
If you want to add more clients, you simply need to run this script another time!

WARNING: WireGuard does not seem to be running.
You can check if WireGuard is running with: systemctl status wg-quick@wg0
If you get something like "Cannot find device wg0", please reboot!