/boot Too Full to do-release-upgrade

As one of our rare dives into the land of 'nux, I recently was being prompted to perform a sudo do-release-upgrade on one of my web servers running Ubuntu 14.04.2

However, when I actually tried running the command, I was being screamed at by the box that my /boot mount was simply too full.

Not enough free disk space 
The upgrade has aborted. The upgrade needs a total of 51.6 M free 
space on disk '/boot'. Please free at least an additional 51.6 M of 
disk space on '/boot'. Empty your trash and remove temporary packages 
of former installations using 'sudo apt-get clean'. 
Restoring original system state
Aborting

Oh, bother. Sure enough, df -h shows me that I'm woefully short on space.
$ df /boot
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/sda1         233191 231498         0 100% /boot

So, since this is the /boot partition, perhaps there are simply too many old kernel releases currently loaded up and are killing my free space.

Let's find out our current release...
~$ uname -r
3.2.0-75-generic
Okay, well that's all well and good. But, what else is on that drive? RHEL/CentOS/Fedora folks would utilize rpm -qa kernel to find this out. However, since I'm running Ubuntu (This works for Debian, as well), I need to:
 dpkg --list | grep linux-image

This provides an output of
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                                       Description
+++-=============================================-=============================================-==========================================================================================================
un  linux-image                                                                          (no description available)
un  linux-image-3.0                                                                      (no description available)
un  linux-image-3.2.0-29-generic                                                          (no description available)
un  linux-image-3.2.0-31-generic                                                          (no description available)
un  linux-image-3.2.0-32-generic                                                          (no description available)
un  linux-image-3.2.0-33-generic                                                          (no description available)
un  linux-image-3.2.0-34-generic                                                          (no description available)
un  linux-image-3.2.0-35-generic                                                          (no description available)
un  linux-image-3.2.0-36-generic                                                          (no description available)
un  linux-image-3.2.0-37-generic                                                          (no description available)
un  linux-image-3.2.0-38-generic                                                          (no description available)
un  linux-image-3.2.0-39-generic                                                          (no description available)
rc  linux-image-3.2.0-40-generic                  3.2.0-40.64                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-41-generic                  3.2.0-41.66                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-43-generic                  3.2.0-43.68                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-44-generic                  3.2.0-44.69                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-45-generic                  3.2.0-45.70                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-48-generic                  3.2.0-48.74                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-51-generic                  3.2.0-51.77                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-52-generic                  3.2.0-52.78                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-53-generic                  3.2.0-53.81                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
un  linux-image-3.2.0-54-generic                                                          (no description available)
rc  linux-image-3.2.0-55-generic                  3.2.0-55.85                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
un  linux-image-3.2.0-56-generic                                                          (no description available)
un  linux-image-3.2.0-57-generic                                                          (no description available)
un  linux-image-3.2.0-58-generic                                                          (no description available)
un  linux-image-3.2.0-59-generic                                                          (no description available)
un  linux-image-3.2.0-60-generic                                                          (no description available)
un  linux-image-3.2.0-61-generic                                                          (no description available)
un  linux-image-3.2.0-63-generic                                                          (no description available)
ii  linux-image-3.2.0-64-generic                  3.2.0-64.97                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-65-generic                  3.2.0-65.99                                   Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-67-generic                  3.2.0-67.101                                  Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-68-generic                  3.2.0-68.102                                  Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-69-generic                  3.2.0-69.103                                  Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-70-generic                  3.2.0-70.105                                  Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-72-generic                  3.2.0-72.107                                  Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-74-generic                  3.2.0-74.109                                  Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-75-generic                  3.2.0-75.110                                  Linux kernel image for version 3.2.0 on 64 bit x86 SMP
iF  linux-image-3.2.0-76-generic                  3.2.0-76.111                                  Linux kernel image for version 3.2.0 on 64 bit x86 SMP
in  linux-image-3.2.0-77-generic                                                          (no description available)
in  linux-image-3.2.0-79-generic                                                          (no description available)
in  linux-image-3.2.0-80-generic                                                          (no description available)
iU  linux-image-server                            3.2.0.76.90                                   Linux kernel image on Server Equipment.
Whoa! Yeah... There's my problem!

The lines that have ii at the beginning of the line have packages on my /boot partition and are eating up about 194M of space. EACH!

Now, to actually install these we need to call apt-get

In all, I'm going to run all of the commands below to clean up my /boot mount.
sudo apt-get remove linux-image-3.2.0-64-generic
sudo apt-get remove linux-image-3.2.0-65-generic
sudo apt-get remove linux-image-3.2.0-67-generic
sudo apt-get remove linux-image-3.2.0-68-generic
sudo apt-get remove linux-image-3.2.0-69-generic
sudo apt-get remove linux-image-3.2.0-70-generic
sudo apt-get remove linux-image-3.2.0-72-generic
sudo apt-get remove linux-image-3.2.0-74-generic

NOTE: I will NOT run  sudo apt-get remove linux-image-3.2.0-75-generic because uname -r reported that that is the kernel that is currently running! It would let us do it if we needed to, but we need this thing to come back online in the case we ever reboot it!

Alrighty, now that we've removed the extra kernel images, how does our /boot look now?
 df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       228M   38M  179M  18% /boot
Much better! Now I can sudo do-release-upgrade without issue!

Credit: A huge thanks to Vivek Gite and his post List or Check Installed Linux Kernels for helping me get through this! 

Comments

Popular Posts