ECEn Help Wiki

Log In
Home Sitemap Recent Changes Media Manager

Trace: how_to_clear_a_full_boot_partition

wiki:student:how_to_clear_a_full_boot_partition

How to Clear a Full Boot Partition

​​​Ubuntu usually creates a separate /boot partition for storing Linux kernels. This isolates the kernels from the rest of the operating system, which helps make the system more stable. However, as it is usually a small partition (> 200 MB), it can fill up with old kernels. While keeping a couple old kernels around can be advisable, so as to be able to roll back to old kernels if a new one proves unstable (an unusual occurrence), it is not necessary to keep more than one or two.

A user will usually notice they are out of space in /boot only after it is causing problems. If a new kernel tries to install without enough space, the installation will fail. If the system is then rebooted and it tries to use the new kernel, it will have a kernel panic. Sometimes it will be more graceful and simply cause dependency problems, which cripples the functionality of apt-get.

​Here are some tricks to solve this problem:

  1. ​​ If you've run into a kernel panic at boot time, select the Advanced Boot option from the Grub menu and select an older kernel version to boot from (do not use recovery mode). You may have to try a few before you find one that works.
  2. When you have a functioning terminal to use, check the Linux kernel version you are currently running. DO NOT REMOVE THIS KERNEL.
    • uname -r
  3. Check which old kernels you have
    • ls /boot
  4. Force the removal of one or two old kernels (update with the version of the kernel you wish to remove)
    • sudo dpkg --force-all -P linux-image-3.13.0-32-generic
    • ​You will probably need to use the same command to delete the linux-image-extra version of the corresponding kernels to fix dependency problems.
  5. ​Once you are certain you have enough free space fix any existing dependency problems.
    • sudo apt-get install -f
    • Make sure this command does not try to reinstall the kernels you just removed. If it does, you need to remove the linux-image-extra packages for those kernels (there may be other such dependencies, check online).
  6. Once you've got any dependency issues resolved, run sudo apt-get autoremove to remove the other old kernels.
    • As an alternative to autoremove, you try the following command, though using a low-level utility such as dpkg is not necessarily recommended. It will remove all kernels except the one currently running.
      • sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//)")
  7. Odds are, there's a new kernel waiting to be installed. Once you've done all this to clear out your /boot partition, run apt-get update and apt-get upgrade to update your system (including any new kernels).
wiki/student/how_to_clear_a_full_boot_partition.txt · Last modified: 2019/03/21 14:56 by mchamber