Purge and Reinstall Kernel and Wireguard

Ask Ubuntu Asked by databoy2k on January 5, 2022

I posted about this at but haven’t gotten views.

I was running kernel 5.3.0-1026.28~18.04.1. I had a problem with wireguard and uninstalled it. On reboot, I was unable to get network access. I had to boot back into 4.15.0-106-generic, which is where I’m up and running now.

If I try to reinstall 5.3.0, I get the following:

server@srv: ~$ sudo update-initramfs -u -k 3.2.0-5.3.0-1026.28~18.04.1-generic-pae
update-initramfs: Generating /boot/initrd.img-3.2.0-5.3.0-1026.28~18.04.1-generic-pae
WARNING: missing /lib/modules/3.2.0-5.3.0-1026.28~18.04.1-generic-pae
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/3.2.0-5.3.0-1026.28~18.04.1-generic-pae: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
E: amd64-microcode: unsupported kernel version!
E: intel-microcode: unsupported kernel version!
depmod: WARNING: could not open /var/tmp/mkinitramfs_ftspFi/lib/modules/3.2.0-5.3.0-1026.28~18.04.1-generic-pae/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_ftspFi/lib/modules/3.2.0-5.3.0-1026.28~18.04.1-generic-pae/modules.builtin: No such file or directory
  • How do I go about purging 5.3 entirely and reinstalling it?
  • Will that allow me to purge and reinstall Wireguard as well?

3 Answers

Like @databoy2k it looks like there is some bug in how DKMS gets called to compile the wireguard module. I haven't gotten locked out of any systems, though. Remediation that works for me on Ubuntu 16.04:

(Consider rebooting first.)

apt-get remove linux-headers-$(uname -r)
apt-get remove wireguard
apt autoremove -y
apt-get install linux-headers-$(uname -r)
apt-get install wireguard

When the headers install, I see the wireguard module get compiled.

Answered by dannyman on January 5, 2022

I believe I'm seeing the same issue. It seems that the dependencies somehow got broken in the kernel/wireguard packages when ubuntu started shipping the wireguard module with the kernel (maybe?). I was able to get wireguard installed using (from here

sudo apt install wireguard-tools --no-install-recommends

You can check that dkms and all that isn't needed by checking if your current kernel has wireguard:

sudo modprobe wireguard
lsmod | grep wireguard

For me installing the wireguard package partially installed the gke 5.3 kernel but didn't install the headers or some modules so my network driver wasn't present. I also tried switching to HWE but that didn't help and was a pain to revert.

Answered by Sandy Patterson on January 5, 2022

Boot into older kernel.

sudo apt remove linux-image-5.3.0-1026

sudo apt autoremove

sudo apt install wireguard

Answered by databoy2k on January 5, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP