wireguard vpn is failing with error: Cannot find device "wg0"

Hello I am very new to ubuntu, I installed wireguard almost 6 months ago, and it was working fine, untill yesterday when my ubuntu was updated, the wirguard does not want to come up, and gives the below status:

May 31 08:41:03 lenovo systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
May 31 08:41:03 lenovo wg-quick[5463]: [#] ip link add wg0 type wireguard
May 31 08:41:03 lenovo wg-quick[5463]: Error: Unknown device type.
May 31 08:41:03 lenovo wg-quick[5463]: Unable to access interface: Protocol not supported
May 31 08:41:03 lenovo wg-quick[5463]: [#] ip link delete dev wg0
May 31 08:41:03 lenovo wg-quick[5463]: Cannot find device "wg0"
May 31 08:41:03 lenovo systemd[1]: [email protected]: Main process exited, code=exited, 
status=1/FAILURE
May 31 08:41:03 lenovo systemd[1]: [email protected]: Failed with result 'exit-code'.
May 31 08:41:03 lenovo systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.

here is my ubuntu version: Ubuntu 18.04.4 LTS


Solution 1:

Try reinstalling package wireguard-dkms (remove and install again). Probably afterwards a reboot will be needed.

Solution 2:

Run the Following commands :

sudo apt-get update
sudo apt-get upgrade
sudo systemctl enable --now systemd-resolved

and reboot the system

its work on my case , hope it will helpful for you