Skip to content

Instantly share code, notes, and snippets.

@mrlnc
Created February 8, 2021 12:45
Show Gist options
  • Save mrlnc/80cd76811b89c479a4fa94f859e298ed to your computer and use it in GitHub Desktop.
Save mrlnc/80cd76811b89c479a4fa94f859e298ed to your computer and use it in GitHub Desktop.
Wireguard on Linux 5.0.0-23-generic (for Free5GC)

So you're using free5gc (hence stuck on linux 5.0.0-23-generic) and want to use wireguard VPN.

tl;dr you need wireguard-linux-compat tag v1.0.20200520

git clone https://git.zx2c4.com/wireguard-linux-compat
cd wireguard-linux-compat
git checkout v1.0.20200520
cd ..
make -C wireguard-linux-compat/src -j$(nproc)
make -C wireguard-linux-compat/src -j$(nproc) install

SEO keywords

Wireguard DKMS fails:

free5gc@free5gc:~$ sudo apt install --reinstall wireguard-dkms
…
Setting up wireguard-dkms (1.0.20201112-1~18.04.1) ...
Loading new wireguard-1.0.20201112 DKMS files...
Building for 5.0.0-23-generic
Building initial module for 5.0.0-23-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/wireguard-dkms.0.crash'
Error! Bad return status for module build on kernel: 5.0.0-23-generic (x86_64)
Consult /var/lib/dkms/wireguard/1.0.20201112/build/make.log for more information.
…

Check the make.log and find something like this:

DKMS make.log for wireguard-1.0.20201112 for kernel 5.0.0-23-generic (x86_64)
Mon Feb  8 12:55:15 CET 2021
make: Entering directory '/usr/src/linux-headers-5.0.0-23-generic'
  CC [M]  /var/lib/dkms/wireguard/1.0.20201112/build/noise.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20201112/build/main.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20201112/build/device.o
In file included from /var/lib/dkms/wireguard/1.0.20201112/build/device.c:6:0:
/var/lib/dkms/wireguard/1.0.20201112/build/queueing.h: In function ‘wg_reset_packet’:
/var/lib/dkms/wireguard/1.0.20201112/build/queueing.h:100:2: error: implicit declaration of function ‘skb_reset_redirect’; did you mean ‘skb_do_redirect’? [-Werror=implicit-function-declaration]
  skb_reset_redirect(skb);
  ^~~~~~~~~~~~~~~~~~
  skb_do_redirect
In file included from /var/lib/dkms/wireguard/1.0.20201112/build/main.c:9:0:
/var/lib/dkms/wireguard/1.0.20201112/build/queueing.h: In function ‘wg_reset_packet’:
/var/lib/dkms/wireguard/1.0.20201112/build/queueing.h:100:2: error: implicit declaration of function ‘skb_reset_redirect’; did you mean ‘skb_do_redirect’? [-Werror=implicit-function-declaration]
  skb_reset_redirect(skb);
  ^~~~~~~~~~~~~~~~~~
  skb_do_redirect
In file included from /var/lib/dkms/wireguard/1.0.20201112/build/noise.c:10:0:
/var/lib/dkms/wireguard/1.0.20201112/build/queueing.h: In function ‘wg_reset_packet’:
/var/lib/dkms/wireguard/1.0.20201112/build/queueing.h:100:2: error: implicit declaration of function ‘skb_reset_redirect’; did you mean ‘skb_do_redirect’? [-Werror=implicit-function-declaration]
  skb_reset_redirect(skb);
  ^~~~~~~~~~~~~~~~~~
  skb_do_redirect
cc1: some warnings being treated as errors
scripts/Makefile.build:284: recipe for target '/var/lib/dkms/wireguard/1.0.20201112/build/main.o' failed
make[1]: *** [/var/lib/dkms/wireguard/1.0.20201112/build/main.o] Error 1
make[1]: *** Waiting for unfinished jobs....
cc1: some warnings being treated as errors
scripts/Makefile.build:284: recipe for target '/var/lib/dkms/wireguard/1.0.20201112/build/device.o' failed
make[1]: *** [/var/lib/dkms/wireguard/1.0.20201112/build/device.o] Error 1
cc1: some warnings being treated as errors
scripts/Makefile.build:284: recipe for target '/var/lib/dkms/wireguard/1.0.20201112/build/noise.o' failed
make[1]: *** [/var/lib/dkms/wireguard/1.0.20201112/build/noise.o] Error 1
Makefile:1606: recipe for target '_module_/var/lib/dkms/wireguard/1.0.20201112/build' failed
make: *** [_module_/var/lib/dkms/wireguard/1.0.20201112/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.0.0-23-generic'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment