4

Installed wireguard in Xubuntu (Ubuntu 18.04.4 LTS) via PPA. The kernel module failed.

# modprobe wireguard
modprobe: FATAL: Module wireguard not found in directory /lib/modules/5.3.0-51-generic

I've searched a lot about this issue, but mostly found the poster either did not have kernel headers or they were mismatched. I checked and those on my system were fine.

When I checked

# dkms status 
wireguard, 1.0.20200506: added

Trying dkms build wireguard/1.0.20200506 Produced an error reported in the following log:

> DKMS make.log for wireguard-1.0.20200506 for kernel 5.3.0-51-generic (x86_64)
Tue May 26 19:11:14 PDT 2020
make: Entering directory '/usr/src/linux-headers-5.3.0-51-generic'
  CC [M]  /var/lib/dkms/wireguard/1.0.20200506/build/main.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200506/build/noise.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200506/build/device.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200506/build/peer.o
In file included from /var/lib/dkms/wireguard/1.0.20200506/build/main.c:9:0:
/var/lib/dkms/wireguard/1.0.20200506/build/queueing.h: In function ‘wg_reset_packet’:
/var/lib/dkms/wireguard/1.0.20200506/build/queueing.h:107: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.20200506/build/noise.c:10:0:
/var/lib/dkms/wireguard/1.0.20200506/build/queueing.h: In function ‘wg_reset_packet’:
/var/lib/dkms/wireguard/1.0.20200506/build/queueing.h:107: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.20200506/build/device.c:6:0:
/var/lib/dkms/wireguard/1.0.20200506/build/queueing.h: In function ‘wg_reset_packet’:
In file included from /var/lib/dkms/wireguard/1.0.20200506/build/peer.c:8:0:
/var/lib/dkms/wireguard/1.0.20200506/build/queueing.h: In function ‘wg_reset_packet’:
/var/lib/dkms/wireguard/1.0.20200506/build/queueing.h:107: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
/var/lib/dkms/wireguard/1.0.20200506/build/queueing.h:107: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:288: recipe for target '/var/lib/dkms/wireguard/1.0.20200506/build/main.o' failed
make[1]: *** [/var/lib/dkms/wireguard/1.0.20200506/build/main.o] Error 1
make[1]: *** Waiting for unfinished jobs....
cc1: some warnings being treated as errors
scripts/Makefile.build:288: recipe for target '/var/lib/dkms/wireguard/1.0.20200506/build/peer.o' failed
make[1]: *** [/var/lib/dkms/wireguard/1.0.20200506/build/peer.o] Error 1
cc1: some warnings being treated as errors
scripts/Makefile.build:288: recipe for target '/var/lib/dkms/wireguard/1.0.20200506/build/device.o' failed
make[1]: *** [/var/lib/dkms/wireguard/1.0.20200506/build/device.o] Error 1
cc1: some warnings being treated as errors
scripts/Makefile.build:288: recipe for target '/var/lib/dkms/wireguard/1.0.20200506/build/noise.o' failed
make[1]: *** [/var/lib/dkms/wireguard/1.0.20200506/build/noise.o] Error 1
Makefile:1656: recipe for target '_module_/var/lib/dkms/wireguard/1.0.20200506/build' failed
make: *** [_module_/var/lib/dkms/wireguard/1.0.20200506/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.3.0-51-generic'

I don't know how to read this log or get further. Wireguard is installed on my router and our iPhones and works correctly there. But I need it on my laptop with Xubuntu-- any help greatly appreciated!

FedKad
  • 10,515
feffer
  • 41
  • Why not use the wireguard provided in the standard repositories? The compile error is from the "-Werror=implicit-function-declaration" option turning a warning into an error, so that seems like a PPA to avoid if they can' set up a proper build. – ubfan1 May 28 '20 at 15:15
  • Wireguard is in the latest repos, but not in Ubuntu 18.04--one must go the PPA route for that. However, I cannot use the latest Ubuntu as it will not suspend/resume in my 2010 MacBook Pro converted to linux use. Still there should be a way to create/install the correct kernel module here. Searched, but have not found it. – feffer May 30 '20 at 02:14
  • In your 18.04, have you turned on the "backports" repository? That might bring it in. – ubfan1 May 30 '20 at 04:48
  • Yes, backports are on, but the problem is not downloading wireguard, and it's dependancies. It's getting the dmks module to build properly. So something to do with the kernel. I was hoping to get a response from someone who's resolved this issue. – feffer May 31 '20 at 18:06
  • The error tells you the exact file and line which had the error. A type declaration was left off, and the default "int" was used -- just a warning, but then your makefile explicitly says to turn that specific warning into an error. Alternatively, remove the "-Werror=implicit-function-declaration", probably in the compiler flags, and the compile should succeed. – ubfan1 May 31 '20 at 21:18
  • OK, that sounds hopeful. When the wg items install, wireguard-dkms tries to build the module and fails. I don't know how to intervene in this process. I'm not manually building it. – feffer May 31 '20 at 23:29
  • I'm running into this on my laptop, too. I left a bug report about it on the wireguard package. https://bugs.launchpad.net/ubuntu/+source/wireguard/+bug/1886759 – Alex Coventry Jul 08 '20 at 19:01

2 Answers2

0

I had this precise problem yesterday on an AWS instance running Ubuntu Eoan. I believe the problem was that the system was still running an old kernel (5.3.0-1016-aws), which didn't have matching headers. After I rebooted, the system was running the 5.3.0-1019-aws kernel and was able to build the Wireguard module.

For diagnostic purposes, I ran apt list --installed | grep linux to see what kernel packages were installed, which is when I realized I was not running the kernel from the most recent package. (Run uname -a to see what kernel you are currently running.)

For what it's worth, this system is one of a pair, which is very convenient for experiments like this; obviously that doesn't help when you're dealing with your laptop -- and I am also having this problem on my laptop! I'll check the kernels on that machine and report back here... and this was not the solution for my laptop, running bionic aka Ubuntu 18.04. It is running the latest installed kernel, 5.3.0-7648-generic, and I'm still seeing the error /var/lib/dkms/wireguard/1.0.20200520/build/queueing.h:115:2: error: implicit declaration of function ‘skb_reset_redirect’; did you mean ‘skb_do_redirect’? [-Werror=implicit-function-declaration] in /var/lib/dkms/wireguard/1.0.20200520/build/make.log. I'll keep digging.

In response to the comment by ubfan1 about not using the PPA, I believe it is still necessary for Ubuntu ≤ 19.04 -- see https://www.wireguard.com/install/

Finally (?), I solved the problem on my laptop by running sudo do-release-upgrade -d and upgrading to Focal aka Ubuntu 20.04. This installed the 5.4.0-7629-generic kernel and now Wireguard is working again. This solution takes a little time and may be too disruptive for you, but seems fine.

bens
  • 1
  • 1
  • Again, I cannot upgrade to Ubuntu 20.04 on this machine. As for matching the kernel to the headers, mine DO match, but still dkms does not properly build the module. I've search and the two answers provided are commonly found, but do not work here. That's why I posted. No real solution yet! – feffer May 30 '20 at 02:17
0

The issue has "solved itself" -- the newest kernels in Xubuntu (Ubuntu 18.04.4 LTS), 5.3.0-59-generic seem to have WG support built in. Purging and re-installing WG (still from the PPA) now works. No kernel module is built, so the kernel support must be "built-in." Probably the WG devs did this. In any case, WG is now functional on this distro as well as Peppermint_10 which had a similar problem.

There is one remaining glitch. When the new kernel was brought in through the normal apt update process, it also installed another kernel, "5.3xxxxx-gke." This kernel became the GRUB default kernel. However, booting it, broke keyboard support in the login screen and beyond (at least on my MacBook converted to linux). A work-around: in the GRUB menu, choose Advanced and then select the 5.3.0-59-generic kernel. It will boot normally, have normal keyboard support and WG works fine.

feffer
  • 41