AWS Lightsail Wireguard Unable to access interface: Protocol not supported easy fix

AWS Lightsail is a perfect Wireguard server VPS. If you install Wireguard in AWS Lightsail instance, you will most likely get an error Cannot find device "wg0" or Unable to access interface: Protocol not supported. This is a common issue when wireguard-dkms module didn’t match the kernel headers version and it can happen in other VPS also.

To make Wireguard work correctly you will need to re-install linux-headers-*** and wireguard-dkms. Most of time once you re-installed kernel headers, you don’t have to reinstall wireguard-dkms.

sudo apt install linux-headers-$(uname -r)

After that you can try bring up the wg0 interface. If you are using pivpn, the debug command pivpn -d have the options to re-enable Wireguard.

If issue still exist, you can reinstall wireguard-dkms

sudo apt install --reinstall wireguard-dkms
Syncthing In Toolbox on Fedora Silverblue with systemd Marking a directory as sources root equivalent in Visual Studio Code for Python