Results 1 to 9 of 9

Thread: Safe way to free up space in /boot?

  1. #1
    Join Date
    Aug 2021
    Beans
    1

    Safe way to free up space in /boot?

    I'm having trouble free up space in my /boot location. I've tried using the autoremove command but unfortunately that was unsuccessful. Would it cause issues if I rm initrd.img-4.15.0-155-generic in /boot? I'm currently on 4.15.0-148-generic according to uname -r. Any help would be greatly appreciated!

    currently in /boot:
    initrd.img-4.15.0-155-generic
    vmlinuz-4.15.0-155-generic
    System.map-4.15.0-155-generic
    config-4.15.0-155-generic
    System.map-4.15.0-154-generic
    config-4.15.0-154-generic
    vmlinuz-4.15.0-154-generic
    initrd.img-4.15.0-148-generic
    vmlinuz-4.15.0-148-generic
    System.map-4.15.0-148-generic
    config-4.15.0-148-generic

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Safe way to free up space in /boot?

    Exactly what do you want to do?

    When posting output, please use code tags Https://ubuntuforums.org/misc.php?do=bbcode#code and please show the exact command used.

    For space issues, the df and du commands are commonly used. There are lots and lots of threads in these forums about out of space on the /boot/ partition and addressing that. Have you seen those? Have you tried those?

  3. #3
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    6,030
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Safe way to free up space in /boot?

    Which Ubuntu release are you running? 18.04?

    And please show us the output of
    Code:
    dpkg --list | grep linux-
    (In code tags)
    That will show the currently installed kernels, header files and kernel metapackages, including flags for any errors.

    One can usually cleanly remove kernel packages with dpkg, even when apt no longer works.

  4. #4
    Join Date
    Oct 2005
    Location
    Lab, Slovakia
    Beans
    10,442

    Re: Safe way to free up space in /boot?

    Well, in principle all you need to do is to look in the grub files to see which kernel file is actually booted and then you can delete the others.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Safe way to free up space in /boot?

    Quote Originally Posted by HermanAB View Post
    Well, in principle all you need to do is to look in the grub files to see which kernel file is actually booted and then you can delete the others.
    Some installations don't make enough space for the /boot partition, so upgrades fail and we need to be very careful in keeping sufficient free space in /boot/ before attempting any kernel upgrade.

    OTOH, some installations don't create a separate /boot partition at all, so the problem can be completely different. If /boot is really on the / partition, we need to look for other root causes.

    Kernels have 3 parts. The kernel, the modules and the headers for that specific kernel. If installation fails along the way for any of those, some manual APT maintenance will be needed. This seldom happens. sudo apt autoremove --purge should handle any correctly installed, no longer used, packages. It is the partially installed packages that cause problems and eat storage.

  6. #6
    Join Date
    May 2010
    Beans
    1,697

    Re: Safe way to free up space in /boot?

    What is the output of
    Code:
    dpkg -l | grep linux-image
    Thanks

  7. #7
    Join Date
    Jun 2010
    Location
    London, England
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Safe way to free up space in /boot?

    Kernel 4.15.0-155-generic is the newest of the kernels on your machine. So, why do you want to remove 4.15.0-155 and not 4.15.0-148? As previously noted you would need to remove the four parts that make up the kernel. Which are initrd.img, vmlinuz, config and system.map.

    I do not think that the autoremove command will remove kernels that were manually installed by the user. I think that autoremove will remove kernels that are installed through the apt update/upgrade commands.

    Every time Software Updater installs a new kernel then the oldest kernel is removed. In this way there will always be two kernels in /boot.

    Regards
    It is a machine. It is more stupid than we are. It will not stop us from doing stupid things.
    Ubuntu user #33,200. Linux user #530,530


  8. #8
    Join Date
    Mar 2007
    Beans
    1,131

    Re: Safe way to free up space in /boot?

    As previously asked why don't you want the most recent kernel?
    Before you do anything else you should probably run
    Code:
    update-initramfs -u
    that should get you updated to the most recent kernel you have which is 4.15.0-155

    you can again try
    Code:
    apt autoremove
    It will normally remove all but the last two kernels and update initramfs.

    If that doesn't work you can try to remove the older kernels.
    Code:
    apt remove *4.15.0-148*
    If any of the other files related to 4.15.0-148 remain in /boot you can simply remove then
    then
    Code:
    update-initramfs -u
    This has worked for me when I had many old kernels, but be careful and make sure you type everything right.
    If that isn't enough space then the only other option I can think of is make /boot bigger.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Safe way to free up space in /boot?

    Quote Originally Posted by grahammechanical View Post
    Kernel 4.15.0-155-generic is the newest of the kernels on your machine. So, why do you want to remove 4.15.0-155 and not 4.15.0-148? As previously noted you would need to remove the four parts that make up the kernel. Which are initrd.img, vmlinuz, config and system.map.

    I do not think that the autoremove command will remove kernels that were manually installed by the user. I think that autoremove will remove kernels that are installed through the apt update/upgrade commands.

    Every time Software Updater installs a new kernel then the oldest kernel is removed. In this way there will always be two kernels in /boot.

    Regards
    My thought process around this was that the 2 newer kernels wouldn't boot, so only the oldest is currently booting. It was a guess. If that is true, then the newer kernels aren't properly installed ... which is almost always due to out of space issues on /boot/. Sometimes the files get left behind, using whatever space is left in /boot/ and the machine's upgrades are all stuck due to that.

    Anyway, that was my thinking. Could be wrong.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •