3

So I'm manually deleting old kernels and did a dpkg --list 'linux-image-*' and I get:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  linux-image-4. 4.10.0-42.46 amd64        Linux kernel image for version 4.
ii  linux-image-4. 4.13.0-31.34 amd64        Linux kernel image for version 4.
ii  linux-image-4. 4.15.0-38.41 amd64        Signed kernel image generic
ii  linux-image-4. 4.15.0-39.42 amd64        Signed kernel image generic
ii  linux-image-4. 4.15.0-42.45 amd64        Signed kernel image generic
ii  linux-image-4. 4.4.0-128.15 amd64        Linux kernel image for version 4.
ii  linux-image-4. 4.4.0-140.16 amd64        Linux kernel image for version 4.
ii  linux-image-ex 4.4.0-128.15 amd64        Linux kernel extra modules for ve
ii  linux-image-ex 4.4.0-140.16 amd64        Linux kernel extra modules for ve
ii  linux-image-ge 4.4.0.140.14 amd64        Generic Linux kernel image
ii  linux-image-ge 4.15.0.42.63 amd64        Generic Linux kernel image
un  linux-image-un <none>       <none>       (no description available)
un  linux-image-un <none>       <none>       (no description available)
un  linux-image-un <none>       <none>       (no description available)
so the last 3 packages are in a Desired=Unknown and Status=Not state.

So I dug a little deeper and found that dpkg-query --show 'linux-image-*' doesn't help me much:

linux-image-4.10.0-42-generic   4.10.0-42.46~16.04.1
linux-image-4.13.0-31-generic   4.13.0-31.34~16.04.1
linux-image-4.15.0-38-generic   4.15.0-38.41~16.04.1
linux-image-4.15.0-39-generic   4.15.0-39.42~16.04.1
linux-image-4.15.0-42-generic   4.15.0-42.45~16.04.1
linux-image-4.4.0-128-generic   4.4.0-128.154
linux-image-4.4.0-140-generic   4.4.0-140.166
linux-image-extra-4.4.0-128-generic 4.4.0-128.154
linux-image-extra-4.4.0-140-generic 4.4.0-140.166
linux-image-generic             4.4.0.140.146
linux-image-generic-hwe-16.04   4.15.0.42.63
linux-image-unsigned-4.15.0-38-generic
linux-image-unsigned-4.15.0-39-generic
linux-image-unsigned-4.15.0-42-generic

So where are those 3 coming from and how do I get rid of those 3??


Additional info:

dpkg --list 'linux-image-*' > /tmp/N0rbert.txt is here.

uname -r and ls /boot are here

Fabby
  • 34,259
  • Output of dpkg -l looks truncated. Please redirect its output to text file with dpkg --list 'linux-image-*' > d.txt and add contents of d.txt to the question. – N0rbert Dec 08 '18 at 09:30
  • Q edited as per your request. ;-) – Fabby Dec 08 '18 at 09:34

1 Answers1

7

Before proceeding, compare the output of uname -r (your current running kernel version) with these versions. If you see the same number, then those are not old kernels, but unsigned new kernels so don't delete them!


Otherwise you can delete them using simply:

sudo apt-get purge linux-image-unsigned-4.15.0-38-generic \
linux-image-unsigned-4.15.0-39-generic linux-image-unsigned-4.15.0-42-generic

These kernels came from the official repositories:


My personal methods of removing kernels is one of the following:

  • use apt-get autoremove

    sudo apt-get autoremove
    
  • use purge-old-kernels from byobu package:

    sudo purge-old-kernels
    
  • remove non-installed kernels manually (if previous methods fail):

    sudo apt-get purge $(dpkg -l | grep 'linux-image-' | grep -v "^ii" | awk '{print $2}')
    

Note: dpkg --list may truncate its output when the terminal is narrow, so consider to use a redirect to file with dpkg --list 'linux-image-*' > d.txt and then less d.txt

Fabby
  • 34,259
N0rbert
  • 99,918