1

I am having a tough time committing to some of the solutions for creating room on my boot partition ... I have read about, and understand autoremove -- I have read about, and understand apt-get -f install. But my issue is a little different than all the questions that have answers out there. Everyone says manually remove all but the last 3 kernels. Here is my reservation.

When I issue the command uname -r, I get:

4.4.0-78-generic

When I issue dpkg --list 'linux-image*', I get:

rc  linux-image-4.4.0-31-generic                  4.4.0-31.50                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-62-generic                  4.4.0-62.83                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-63-generic                  4.4.0-63.84                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-64-generic                  4.4.0-64.85                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-66-generic                  4.4.0-66.87                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-70-generic                  4.4.0-70.91                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-71-generic                  4.4.0-71.92                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-72-generic                  4.4.0-72.93                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-75-generic                  4.4.0-75.96                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-78-generic                  4.4.0-78.99                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-79-generic                  4.4.0-79.100                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-81-generic                  4.4.0-81.104                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-83-generic                  4.4.0-83.106                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-87-generic                  4.4.0-87.110                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-89-generic                  4.4.0-89.112                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-91-generic                  4.4.0-91.114                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-92-generic                  4.4.0-92.115                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-93-generic                  4.4.0-93.116                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-96-generic                  4.4.0-96.119                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-97-generic                  4.4.0-97.120                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
in  linux-image-4.4.0-98-generic                  <none>                      amd64                       (no description available)
rc  linux-image-extra-4.4.0-31-generic            4.4.0-31.50                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-62-generic            4.4.0-62.83                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-63-generic            4.4.0-63.84                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-64-generic            4.4.0-64.85                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-66-generic            4.4.0-66.87                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-70-generic            4.4.0-70.91                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-71-generic            4.4.0-71.92                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-72-generic            4.4.0-72.93                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-75-generic            4.4.0-75.96                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-78-generic            4.4.0-78.99                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-79-generic            4.4.0-79.100                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-81-generic            4.4.0-81.104                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-83-generic            4.4.0-83.106                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-87-generic            4.4.0-87.110                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-89-generic            4.4.0-89.112                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-91-generic            4.4.0-91.114                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-92-generic            4.4.0-92.115                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-extra-4.4.0-93-generic            4.4.0-93.116                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-extra-4.4.0-96-generic            4.4.0-96.119                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-extra-4.4.0-97-generic            4.4.0-97.120                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-extra-4.4.0-98-generic            4.4.0-98.121                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-generic                           4.4.0.98.103                amd64                       Generic Linux kernel image

I attempted apt-get autoremove, but got:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-98-generic : Depends: linux-image-4.4.0-98-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-98-generic but it is not installed
                       Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.

So then I try to resolve the dependencies via sudo apt-get -f install and get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-79 linux-headers-4.4.0-79-generic linux-headers-4.4.0-81 linux-headers-4.4.0-81-generic linux-headers-4.4.0-83 linux-headers-4.4.0-83-generic linux-headers-4.4.0-87
  linux-headers-4.4.0-87-generic linux-headers-4.4.0-89 linux-headers-4.4.0-89-generic linux-headers-4.4.0-91 linux-headers-4.4.0-91-generic linux-headers-4.4.0-92 linux-headers-4.4.0-92-generic
  linux-image-4.4.0-79-generic linux-image-4.4.0-81-generic linux-image-4.4.0-83-generic linux-image-4.4.0-87-generic linux-image-4.4.0-89-generic linux-image-4.4.0-91-generic linux-image-4.4.0-92-generic
  linux-image-extra-4.4.0-79-generic linux-image-extra-4.4.0-81-generic linux-image-extra-4.4.0-83-generic linux-image-extra-4.4.0-87-generic linux-image-extra-4.4.0-89-generic
  linux-image-extra-4.4.0-91-generic linux-image-extra-4.4.0-92-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-4.4.0-98-generic
Suggested packages:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
The following NEW packages will be installed:
  linux-image-4.4.0-98-generic
0 upgraded, 1 newly installed, 0 to remove and 99 not upgraded.
12 not fully installed or removed.
Need to get 0 B/21.9 MB of archives.
After this operation, 67.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 446621 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-98-generic_4.4.0-98.121_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-98-generic (4.4.0-98.121) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-98-generic_4.4.0-98.121_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-98-generic' to '/boot/vmlinuz-4.4.0-98-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-98-generic_4.4.0-98.121_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Here is where I am confused .. I am using version 4.4.0-78-generic according to uname -r. Yet literally all of the answers I have read so far say to remove all but the latest 3! That would mean removing the kernel I am currently utilizing right??

I even attempted: sudo apt-get remove linux-image-4.4.0-31-generic which is the oldest according to dpkg --list 'linux-image*' and I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'linux-image-4.4.0-31-generic' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-98-generic : Depends: linux-image-4.4.0-98-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-98-generic but it is not going to be installed
                       Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Not installed?! I am thoroughly confused. After seeing this debacle, what is my next course of action? Can someone explain why there are kernel versions HIGHER than the one I am currently using? And how do I get this straightened out and resolved on a production server?

THIS IS NOT A DUPLICATE OF My /boot partition hit 100% and now I can't upgrade. Can't remove old kernels to make room As:

1) This OP does not answer the conflicting kernels issue .. 2) does not address the safety of doing this in a production environment

Zak
  • 153
  • 9
  • 4
  • PLease read edit at bottom .. I have read that question and it does not address my conccerns – Zak Nov 01 '17 at 20:57
  • You are literally having that exact issue. – psusi Nov 01 '17 at 22:25
  • I am unsure what you mean by 'conflicting kernels', but the course that I would suggest to you would be to remove some of the kernels older than 4.4.0-78, your currently operating kernel, and get into a condition where you can run sudo apt install -f. You cannot use 'apt' because of existing problem, but you *could*sudo dpkg -r linux-image-4.4.0-31 generic` as mentioned here, and repeat to remove the oldest of the kernels. – Charles Green Nov 01 '17 at 22:49
  • 1
    If the dpkg fails, you can certainly resort to directly removing old kernel files as mentioned here. As to why you are booting to an older kernel: Please see this question - I would strongly encourage you to get sudo apt install -f to work first! And I am not good at editing grub - I would suggest grub-customizer – Charles Green Nov 01 '17 at 22:54
  • @Charles -- The answer below that I accepted allowed me to clear up just enough room to run the -f install and the subsequent autoremove. After that, it kept versions 78, 96 and 97. When I do my scheduled reboot in about 2 weeks, I'll boot into 97 and continue with the upgrade. Thanks for your input, your links are informational reads! – Zak Nov 02 '17 at 00:08
  • I'm glad it worked for you, but surprised that there was enough room on the disk to be able to do the install! – Charles Green Nov 02 '17 at 00:10

1 Answers1

3

First install the following package:

sudo apt install byobu

Then you can remove unused kernels with the following command:

sudo purge-old-kernels

This should help free up some space.

For information check this article.

Michael
  • 533
  • 4
  • 11