Kernel upgrade breaks WireGuard?

Hi guys,

Last time I upgraded my kernel and kernel headers, WireGuard was broken after I rebooted. I believe I couldn’t start wg-quick but I can’t remember exactly. I wasn’t able to fix it and had to completely reinstall dietpi to get everything working again.

I’m wondering if anyone has run into this problem before and fixed it?

I’m reading that it seems like I need to update the kernel, reboot, purge WireGuard dkms, then reinstall WireGuard dkms, but I’m not sure how this works with the way dietpi installs WireGuard.

Do I need to upgrade kernel, reboot, purge WireGuard dkms, then reinstall WireGuard through dietpi-software?

Thanks :slightly_smiling_face:

Hi,
many thanks for your report.

Yes indeed. There was a challenges in the past with WireGuard themselves if you updated the kernel. But this behavior changed by WireGuard and you should be able to update your kernel without issues now.

If it still did not work, your could run dpkg-reconfigure

sudo dpkg-reconfigure wireguard-dkms

Personally I tested it today on my RPi4B as I was running G_AGUP and G_AGUG to update to the new Kernel 4.19.93-v7l+

before kernel update

root@DietPi4:~# uname -a
Linux DietPi4 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
root@DietPi4:~#

after kernel update

root@DietPi4:~# uname -a
Linux DietPi4 4.19.93-v7l+ #1290 SMP Fri Jan 10 16:45:11 GMT 2020 armv7l GNU/Linux
root@DietPi4:~#

After reboot, WireGuard was still working. Even my already connected mobile devices survived the Kernel update + Reboot without issues. :sunglasses:

Sweet!! So in your instance, you didn’t have to do anything more than simply upgrade the kernel and restart? WireGuard just continued to work after rebooting?

correct. I just did G_AGUP + G_AGUG, enjoyed a coffee while waiting on the update to be completed and rebooted the RPi once done. At least this was my experience today.

Do you mind telling me what G_AGUP and G_AGUG are?

Sudo apt-get update and sudo apt-get upgrade?

Exactly, newest WireGuard DKMS should place a kernel-upgrade hook that rebuilds the WireGuard kernel module automatically whenever the kernel is upgraded. At least with newest RPi firmware and all kernel packages I know for other model, this is the case, otherwise manual rebuild via dpkg-reconfigure + reboot as above is the way.

Gotcha! Thanks for all your help!

yep, these are the same commands. G_AGUP + G_AGUG are used by DietPi scripts. And much more important, way less characters to type into console :rofl:

Gotcha! I guess I’m even lazier with my bash alias of suu for sudo apt-get update && sudo apt-get upgrade :joy:

G_AG* commands are most imporantly non-interactive, hence they will never ask you whether to install dependencies, keep or overwrite old config files (old are always kept, new ones installed with *-dpkg-new/dist suffix), purge depandants etc. On stable distro version and older (Buster, Stretch, Jessie, …) this is safe, on testing version (Bullseye) it could lead to unexpected package installs/uninstalls and new package versions are not assured to be compatible with old config files etc, hence I would use the interactive bare apt/apt-get commands there :wink:.

Thanks for the information :slightly_smiling_face: