Suddenly i got lots of different kernels i not know i have installed and can't remove

I recently discovered i had a bunch of weird kernels installed on my Ubuntu 22.04.2 LTS that somehow got installed and for some reason can’t remove.

ii  linux-image-5.15.0-1028-nvidia                         5.15.0-1028.28                          amd64        Signed kernel image nvidia
ii  linux-image-5.15.0-1031-intel-iotg                     5.15.0-1031.36                          amd64        Signed kernel image intel-iotg
ii  linux-image-5.15.0-1038-oracle                         5.15.0-1038.44                          amd64        Signed kernel image oracle
ii  linux-image-5.15.0-25-generic                          5.15.0-25.25                            amd64        Signed kernel image generic
ii  linux-image-5.15.0-76-lowlatency                       5.15.0-76.83                            amd64        Signed kernel image lowlatency
ii  linux-image-5.17.0-1033-oem                            5.17.0-1033.34                          amd64        Signed kernel image oem
ii  linux-image-5.19.0-1026-oracle                         5.19.0-1026.29~22.04.1                  amd64        Signed kernel image oracle
ii  linux-image-5.19.0-46-generic                          5.19.0-46.47~22.04.1                    amd64        Signed kernel image generic
ii  linux-image-generic-hwe-22.04                          5.19.0.46.47~22.04.21                   amd64        Generic Linux kernel image
ii  linux-image-unsigned-5.19.0-1028-lowlatency            5.19.0-1028.29~22.04.1                  amd64        Linux kernel image for version 5.19.0 on 64 bit x86 SMP

If i try to remove one of them the OS also wants to re-install it with an unsigned version

johan@linux1:~$ sudo apt-get purge linux-image-5.15.0-1028-nvidia
[sudo] password for johan: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  linux-image-unsigned-5.15.0-1028-nvidia
Suggested packages:
  fdutils linux-doc | linux-nvidia-source-5.15.0 linux-nvidia-tools linux-headers-5.15.0-1028-nvidia linux-modules-extra-5.15.0-1028-nvidia
The following packages will be REMOVED:
  linux-image-5.15.0-1028-nvidia*
The following NEW packages will be installed:
  linux-image-unsigned-5.15.0-1028-nvidia
0 upgraded, 1 newly installed, 1 to remove and 1 not upgraded.
Need to get 12,2 MB of archives.
After this operation, 559 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
johan@linux1:~$ sudo apt-get purge linux-image-5.15.0-1031-intel-iotg
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  linux-image-unsigned-5.15.0-1031-intel-iotg
Suggested packages:
  fdutils linux-doc | linux-intel-iotg-source-5.15.0 linux-intel-iotg-tools linux-headers-5.15.0-1031-intel-iotg linux-modules-extra-5.15.0-1031-intel-iotg
The following packages will be REMOVED:
  linux-image-5.15.0-1031-intel-iotg*
The following NEW packages will be installed:
  linux-image-unsigned-5.15.0-1031-intel-iotg
0 upgraded, 1 newly installed, 1 to remove and 1 not upgraded.
Need to get 11,7 MB of archives.
After this operation, 522 kB of additional disk space will be used.
Do you want to continue? [Y/n] 

So, the questions are….how did they get installed and how do i get rid of them ?
GRUB thinks /boot/vmlinuz-5.19.0-1028-lowlatency should be my default kernel 🙁

Asked By: Johan Andersson

||

There are many other packages which depend upon the image package, and seem to be forcing the installation of the "conflicts" unsigned package when you delete the image package. Just delete the whole group, they have pretty distinct names with the version numbers.
Take a look at the packages

apt-cache pkgnames |grep 5.17.0-1033

If the list looks good, you can purge the entire list on the next command with (back tics and exclamation points ):

sudo apt purge `!!`

Don’t do this with the running kernel, (check with uname -a)
If the …generic is the one you want, leave it and the running kernel, then reboot and select the generic, then you can delete the last unwanted one.

Answered By: ubfan1
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.