Reinstall latest kernel?

I did something silly with a build/modprobe/make while running on my latest installed kernel. Now that kernel will not boot. I am currently running on a previous kernel.

How can I clean this up? I would like to just get back to the "stock" latest kernel that is in the apt repo.

Edit: I should note.... I was trying to install flashcache (https://github.com/facebook/flashcache/)

I tried to do

sudo apt-get install --reinstall linux-image-generic linux-image

That didn't fix it; so I tried the "recovery mode" option and see a kernel panic around the loading of the flashcache module.... I must need to delete something, somewhere...

enter image description here


Solution 1:

I do not know if you have network access but if you have then do:

sudo apt-get install --reinstall linux-image-generic linux-image

Solution 2:

Simply boot to a previous kernel version and type the following, just replace ## with the kernel version you are trying to boot into.

sudo update-initramfs -u -k 3.2.0-##-generic-pae 

Just replace ## with the kernel version you are trying to boot into.

Follow that with a hello to Grub, and reboot.

sudo update-grub
sudo reboot now

Now you should no longer see a kernel panic when booting into the new kernel.

Solution 3:

I have a problem with VGA drivers, and thouse solution is not fix my problem.

The main solution which help, its to remove manulaly and install from the outset

// remove modules
sudo rm -rf /lib/modules/4.13.0-3*

remove headers
sudo rm -rf /usr/src/linux-headers-4.13.0-3*

// clear boot
sudo rm -rf /boot/initrd.img-4.13.0-3*
sudo rm -rf /boot/vmlinuz-4.13.0-3*
sudo rm -rf /boot/System.map-4.13.0-3*
sudo rm -rf /boot/config-4.13.0-3*

// refresh grub. I reboot after update grub, but maybe is not important
sudo update-grub

//check the lastes version of linux images
sudo apt-cache search linux-image |grep 4.14

# linux-image-4.14.0-1003-azure-edge - Linux kernel image for version 4.14.0 on 64 bit x86 SMP
# linux-image-extra-4.14.0-1003-azure-edge - Linux kernel extra modules for version 4.14.0 on 64 bit x86 SMP
# linux-image-4.14.0-1004-azure-edge - Linux kernel image for version 4.14.0 on 64 bit x86 SMP
# linux-image-extra-4.14.0-1004-azure-edge - Linux kernel extra modules for version 4.14.0 on 64 bit x86 SMP

// install the lastes verion
sudo apt-get install linux-image-4.14.0-1004-azure-edge linux-headers-4.14.0-1004-azure-edge linux-image-extra-4.14.0-1004-azure-edge 

// restart pc
sudo reboot now