Wireguard: Attempting to Install and Configure Wireguard Fails with “Unknown device type” and “FATAL: Module wireguard not found in directory”

After installing a new kernel on Ubuntu the interface could not be brought up because it did not exist anymore.

ip link add dev wg0 type wireguard
Error: Unknown device type.

After doing a modprobe it states the following error:

# modprobe wireguard
modprobe: FATAL: Module wireguard not found in directory /lib/modules/5.0.4-2004

Checking dkms states it the wireguard module is active

# dkms status
wireguard, 1.0.20200520, 5.3.0-1022-azure, x86_64: built

To fix this issue rebuild and install the module into the new kernel.
Make sure you install the linux-headers for your kernel!

# apt install linux-headers

Rebuilding the module (make sure to note the applicable wireguard version! This is returned by dkms status) In the example verison 1.0.20200520 is used:

# dkms status
# dkms build wireguard/1.0.20200520
# dims install wireguard/1.0.20200520
# modprobe wireguard
# wg-quick up wg0

Thats it!

Leave a Reply

Your email address will not be published.