I have a VPS server running Ubuntu 18.04 LTS where I wanted to install a WireGuard VPN service. I have started with adding the repository and then installing the module which is running fine and without any error messages.

add-apt-repository ppa:wireguard/wireguard
apt-get update
apt-get install wireguard-dkms wireguard-tools

Then, I wanted to load the kernel module using

sudo modprobe wireguard

but, modprobe tells me, that it is unable to locate the kernel module.

modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.15.0/modules.builtin.bin'
modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.15.0

Rereading the console output, the installer told me that it had installed the module to /lib/modules/4.15.0-62-generic/updates/dkms, but modprobe seems to look only into /lib/modules/4.15.0/. I have already tried to create a symlink into the 4.15.0-directory, but modprobe still is not able to locate the module file.

The Ubuntu Server was 'out of box', since I was renewing it. Is anyone who can help?


Closely reading the output of sudo apt-get install wireguard showed the following lines for me:

Building for 4.15.0-70-generic 4.15.0-72-generic
Module build for kernel 4.15.0-70-generic was skipped since the
kernel headers for this kernel does not seem to be installed.

Installed missing kernel headers via sudo apt-get install linux-headers-$(uname -r).

Then retry package installation via sudo apt-get remove wireguard followed by apt-get install wireguard.

Now sudo modprobe wireguard doesn't complain, and lsmod | grep wireguard shows:

wireguard             212992  0
ip6_udp_tunnel         16384  1 wireguard
udp_tunnel             16384  1 wireguard