2

So i was following this guide: https://sigmdel.ca/michel/ha/wireguard/wireguard_02_en.html#requisites It should be pretty simple but when installing wireguard my pi says:

Building initial module for 4.19.97-v7l+
Error! Bad return status for module build on kernel: 4.19.97-v7l+ (armv7l)
Consult /var/lib/dkms/wireguard/0.0.20200215/build/make.log for more information.
dpkg: error processing package wireguard-dkms (--configure):
 installed wireguard-dkms package post-installation script subprocess returned error exit status 10
Setting up wireguard-tools (1.0.20200206-2) ...
dpkg: dependency problems prevent configuration of wireguard:
 wireguard depends on wireguard-dkms (>= 0.0.20200121-2) | wireguard-modules (>= 0.0.20191219); however:
  Package wireguard-dkms is not configured yet.
  Package wireguard-modules is not installed.

dpkg: error processing package wireguard (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.8.5-2) ...
Errors were encountered while processing:
 wireguard-dkms
 wireguard
E: Sub-process /usr/bin/dpkg returned an error code (1)

The log file:

DKMS make.log for wireguard-0.0.20200215 for kernel 4.19.97-v7l+ (armv7l)
Thu 19 Mar 11:18:02 GMT 2020
make: Entering directory '/usr/src/linux-headers-4.19.97-v7l+'
  CC [M]  /var/lib/dkms/wireguard/0.0.20200215/build/main.o
  CC [M]  /var/lib/dkms/wireguard/0.0.20200215/build/noise.o
  CC [M]  /var/lib/dkms/wireguard/0.0.20200215/build/device.o
  CC [M]  /var/lib/dkms/wireguard/0.0.20200215/build/peer.o
In file included from ./include/linux/cache.h:5,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:58,
                 from <command-line>:
./include/uapi/linux/kernel.h:1:1: warning: null character(s) ignored

 ^
In file included from ./include/linux/cache.h:5,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:58,
                 from <command-line>:
./include/uapi/linux/kernel.h:1:1: warning: null character(s) ignored

 ^
In file included from ./include/linux/cache.h:5,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:58,
                 from <command-line>:
./include/uapi/linux/kernel.h:1:1: warning: null character(s) ignored

 ^
In file included from ./include/linux/cache.h:5,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:58,
                 from <command-line>:
./include/uapi/linux/kernel.h:1:1: warning: null character(s) ignored

 ^
In file included from ./include/linux/kernel.h:17,
                 from ./include/linux/list.h:9,
                 from ./include/linux/preempt.h:11,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/ktime.h:24,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:406,
                 from <command-line>:
./include/uapi/linux/kernel.h:1:1: warning: null character(s) ignored

 ^
In file included from ./include/linux/kernel.h:17,
                 from ./include/linux/list.h:9,
                 from ./include/linux/preempt.h:11,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/ktime.h:24,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:406,
                 from <command-line>:
./include/uapi/linux/kernel.h:1:1: warning: null character(s) ignored

 ^
In file included from ./include/linux/kernel.h:17,
                 from ./include/linux/list.h:9,
                 from ./include/linux/preempt.h:11,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/ktime.h:24,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:406,
                 from <command-line>:
./include/uapi/linux/kernel.h:1:1: warning: null character(s) ignored

 ^
In file included from ./include/linux/kernel.h:17,
                 from ./include/linux/list.h:9,
                 from ./include/linux/preempt.h:11,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/ktime.h:24,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:406,
                 from <command-line>:
./include/uapi/linux/kernel.h:1:1: warning: null character(s) ignored

 ^
In file included from ./include/linux/list.h:9,
                 from ./include/linux/preempt.h:11,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/ktime.h:24,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:406,
                 from <command-line>:
./include/linux/bitmap.h: In function ‘bitmap_zero’:
In file included from ./include/linux/list.h:9,
                 from ./include/linux/preempt.h:11,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/ktime.h:24,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:406,
                 from <command-line>:
./include/linux/bitmap.h: In function ‘bitmap_zero’:
In file included from ./include/linux/list.h:9,
                 from ./include/linux/preempt.h:11,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/ktime.h:24,
                 from /var/lib/dkms/wireguard/0.0.20200215/build/compat/compat.h:406,
                 from <command-line>:
./include/linux/bitmap.h: In function ‘bitmap_zero’:
./include/linux/kernel.h:116:22: error: implicit declaration of function ‘__KERNEL_DIV_ROUND_UP’; did you mean ‘DIV_ROUND_UP’? [-Werror=implicit-function-declaration]
 #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
                      ^~~~~~~~~~~~~~~~~~~~~
./include/linux/bitops.h:8:27: note: in expansion of macro ‘DIV_ROUND_UP’
 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
                           ^~~~~~~~~~~~
./include/linux/bitmap.h:220:22: note: in expansion of macro ‘BITS_TO_LONGS’
   unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
                      ^~~~~~~~~~~~~
./include/linux/kernel.h:116:22: error: implicit declaration of function ‘__KERNEL_DIV_ROUND_UP’; did you mean ‘DIV_ROUND_UP’? [-Werror=implicit-function-declaration]
 #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
                      ^~~~~~~~~~~~~~~~~~~~~
./include/linux/bitops.h:8:27: note: in expansion of macro ‘DIV_ROUND_UP’
 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
                           ^~~~~~~~~~~~
./include/linux/bitmap.h:220:22: note: in expansion of macro ‘BITS_TO_LONGS’
   unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
                      ^~~~~~~~~~~~~
./include/linux/kernel.h:116:22: error: implicit declaration of function ‘__KERNEL_DIV_ROUND_UP’; did you mean ‘DIV_ROUND_UP’? [-Werror=implicit-function-declaration]
 #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
                      ^~~~~~~~~~~~~~~~~~~~~
./include/linux/bitops.h:8:27: note: in expansion of macro ‘DIV_ROUND_UP’
 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
                           ^~~~~~~~~~~~
./include/linux/bitmap.h:220:22: note: in expansion of macro ‘BITS_TO_LONGS’
   unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
                      ^~~~~~~~~~~~~

(and so on...)

cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:303: /var/lib/dkms/wireguard/0.0.20200215/build/noise.o] Error 1
/var/lib/dkms/wireguard/0.0.20200215/build/device.c:278:15: error: ‘IFF_POINTOPOINT’ undeclared (first use in this function); did you mean ‘IFF_BONDING’?
  dev->flags = IFF_POINTOPOINT | IFF_NOARP;
               ^~~~~~~~~~~~~~~
               IFF_BONDING
/var/lib/dkms/wireguard/0.0.20200215/build/device.c:278:33: error: ‘IFF_NOARP’ undeclared (first use in this function); did you mean ‘IFF_TEAM’?
  dev->flags = IFF_POINTOPOINT | IFF_NOARP;
                                 ^~~~~~~~~
                                 IFF_TEAM
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:303: /var/lib/dkms/wireguard/0.0.20200215/build/device.o] Error 1
make: *** [Makefile:1522: _module_/var/lib/dkms/wireguard/0.0.20200215/build] Error 2
make: Leaving directory '/usr/src/linux-headers-4.19.97-v7l+'

I already tried update, upgrade, force install.

I'm trying this on my Raspberry 3:

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"

I can't really figure this out. It would be great if someone could help me with this :)

1
5

I do not follow the link you have given, tl;dr. But it seems that it uses the method to download WireGuard from the Raspbian testing version Bullseye and install it on the current Raspbian stable version Buster.

Doing this, it is needed to compile the kernel modules for WireGuard so it fit to the Buster kernel. Because you ran into problems, it seems that the tutorial you used is somewhat outdated or error prone. Fortunately WireGuard for Buster is available from Debian Backports now.

Because the modules are compiled on installation it is also compatible with the Raspberry Pi OS, but we need to install its own kernel headers as noted in the answer of @starbeamrainbowlabs. Thanks to her for the correction. So we can install it as follows:

# Get signing keys to verify the new packages, otherwise they will not install
rpi ~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC 648ACFD622F3D138

# Add the Buster backport repository to apt sources.list
rpi ~$ echo 'deb http://httpredir.debian.org/debian buster-backports main contrib non-free' | sudo tee -a /etc/apt/sources.list.d/debian-backports.list

rpi ~$ sudo apt update
rpi ~$ sudo apt install raspberrypi-kernel-headers
rpi ~$ sudo apt install wireguard

It takes some time to compile the modules but then wireguard should be successfully installed. For an example using it with Raspberry Pi you may have a look at How to bridge an access point with a remote network by Wireguard? (with the use of systemd-networkd).

3

@Ingo has the correct answer - it seems better than other solutions around the Internet at the moment advising to add the Debian-unstable repository.

I encountered a few issues while running through those steps though - and enough went wrong that I thought I'd document them with another answer, to make it easier to read than a comment - and also so I can update it in the future should things change.


First, make sure you install the raspberry pi kernel headers before installing WireGuard. Otherwise, you'll see a message like this when installing:

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

Note that when this error shows up, it does not throw an error - and the installation completes 'successfully'. Check the log output from installation carefully.

Fix this like so:

sudo apt install raspberrypi-kernel-headers

If you've already installed WireGuard, reconfigure the dkms package like this:

sudo dpkg-reconfigure wireguard-dkms

This will take a while, as will the installation of the raspberry pi kernel headers.

1
  • 1
    Thanks for pointing this out :-) – Ingo Apr 15 '20 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.