How to avoid update of package linux-firmware creating initrd.img files?

10,864

The initrd.img file is the initial ramdisk. It is a fundamental component of your OS and is needed to boot the system. Each kernel has it's own initrd.img file.

I would definately delete all your old kernels. First, find out which kernel you are currently running;

uname -r

Then, uninstall all the old kernels and old headers;

sudo apt-get remove linux-image-<kernel number>
sudo apt-get remove linux-headers-<kernel number>

For example;

sudo apt-get remove linux-image-3.13.0-106-generic

There is no use what-so-ever in keeping those older kernels, especially as you have ran out of disk space. I only ever keep my current kernel and the last one.

After deleting them, your future updates should work again as you will have freed a lot of space.

Share:
10,864

Related videos on Youtube

kgrittn
Author by

kgrittn

I've been making my living working with computers since 1972. In 1980 I founded a consulting company I ran until 2005; during that time I worked with a wide variety of applications, organizations, and technical environments. I'm now with VMware as a PostgreSQL engineer, and tech lead for use of PostgreSQL within their products. I'm a committer for the free, open source version of PostgreSQL, and an active member of that community. By far the largest patch I've worked on for PostgreSQL has been the Serializable Snapshot Isolation (SSI) implementation which went into PostgreSQL version 9.1. This was a joint project with Dan R.K. Ports of MIT, with helpful input and support from many in the PostgreSQL community. Our paper on that effort can be found here: http://vldb.org/pvldb/vol5/p1850_danrkports_vldb2012.pdf For the PostgreSQL docs on the feature, see: http://www.postgresql.org/docs/current/interactive/transaction-iso.html For a number of examples see: http://wiki.postgresql.org/wiki/SSI More recently I've added support for creating and refreshing materialized views to PostgreSQL, and am in the process of adding support for incremental maintenance based on the view's declaration.

Updated on September 18, 2022

Comments

  • kgrittn
    kgrittn over 1 year

    On Ubuntu 14.04 LTS, every attempt to update my linux-firmware package is filling my /boot/ mount point with files named like initrd.img-3.13.0-*-generic, preventing successful update.

    kgrittn@Kevin-Desktop:~$ sudo apt-get upgrade
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue? [Y/n] 
    Setting up linux-firmware (1.127.23) ...
    update-initramfs: Generating /boot/initrd.img-3.13.0-106-generic
    update-initramfs: Generating /boot/initrd.img-3.13.0-105-generic
    update-initramfs: Generating /boot/initrd.img-3.13.0-103-generic
    update-initramfs: Generating /boot/initrd.img-3.13.0-101-generic
    update-initramfs: Generating /boot/initrd.img-3.13.0-100-generic
    update-initramfs: Generating /boot/initrd.img-3.13.0-98-generic
    grep: /boot/config-3.13.0-98-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-96-generic
    grep: /boot/config-3.13.0-96-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-95-generic
    grep: /boot/config-3.13.0-95-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-93-generic
    grep: /boot/config-3.13.0-93-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-92-generic
    grep: /boot/config-3.13.0-92-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-91-generic
    grep: /boot/config-3.13.0-91-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-88-generic
    grep: /boot/config-3.13.0-88-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-87-generic
    grep: /boot/config-3.13.0-87-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-86-generic
    grep: /boot/config-3.13.0-86-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-85-generic
    grep: /boot/config-3.13.0-85-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-83-generic
    grep: /boot/config-3.13.0-83-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-79-generic
    grep: /boot/config-3.13.0-79-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-77-generic
    grep: /boot/config-3.13.0-77-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-76-generic
    grep: /boot/config-3.13.0-76-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-74-generic
    grep: /boot/config-3.13.0-74-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-73-generic
    grep: /boot/config-3.13.0-73-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-71-generic
    grep: /boot/config-3.13.0-71-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-70-generic
    grep: /boot/config-3.13.0-70-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-68-generic
    grep: /boot/config-3.13.0-68-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-67-generic
    grep: /boot/config-3.13.0-67-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-66-generic
    grep: /boot/config-3.13.0-66-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-65-generic
    grep: /boot/config-3.13.0-65-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-63-generic
    grep: /boot/config-3.13.0-63-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-62-generic
    grep: /boot/config-3.13.0-62-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-61-generic
    grep: /boot/config-3.13.0-61-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-59-generic
    grep: /boot/config-3.13.0-59-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-58-generic
    grep: /boot/config-3.13.0-58-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-57-generic
    grep: /boot/config-3.13.0-57-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-55-generic
    grep: /boot/config-3.13.0-55-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-53-generic
    grep: /boot/config-3.13.0-53-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-52-generic
    grep: /boot/config-3.13.0-52-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-51-generic
    grep: /boot/config-3.13.0-51-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-49-generic
    grep: /boot/config-3.13.0-49-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-48-generic
    grep: /boot/config-3.13.0-48-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-46-generic
    grep: /boot/config-3.13.0-46-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-45-generic
    grep: /boot/config-3.13.0-45-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-44-generic
    grep: /boot/config-3.13.0-44-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-43-generic
    grep: /boot/config-3.13.0-43-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-40-generic
    grep: /boot/config-3.13.0-40-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-39-generic
    grep: /boot/config-3.13.0-39-generic: No such file or directory
    update-initramfs: Generating /boot/initrd.img-3.13.0-37-generic
    grep: /boot/config-3.13.0-37-generic: No such file or directory
    
    gzip: stdout: No space left on device
    E: mkinitramfs failure cpio 141 gzip 1
    update-initramfs: failed for /boot/initrd.img-3.13.0-37-generic with 1.
    dpkg: error processing package linux-firmware (--configure):
     subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
     linux-firmware
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    The files are about 19MB each.

    Initially it only got to initrd.img-3.13.0-51-generic and failed, I removed some old kernel versions and it now gets to initrd.img-3.13.0-39-generic before failing. I'm uncomfortable removing any more versions without being sure that freeing some specific amount of space will allow success.


    NOTE: (I would put this as an answer, except that the question is locked in a way that prevents it.)

    Never delete old OS versions from the /boot/ directory directly, in spite of advice you may find elsewhere to do so. That may work for years (or decades) and then suddenly cause the problem described above. Each OS version, whether or not in use, has one or more related packages, and this may cause the problem described here (or other problems, too???).

    I have only seen it on an update of the linux-firmware package, but I have no way of knowing what other package maintenance operations might feel free to re-create boot files which you have deleted -- running you out of space. I suspect that creating incomplete boot images in such a situation is considered a "feature", although I think it is a bad design choice. A message mentioning a package name and the fact that files required by the package are missing would be great, and skipping generation of the initrd.img-* file for a version if there are no files for the version would also be excellent. (Ideally both, but either would have saved hours of frustration.)

    • AlexP
      AlexP over 7 years
      It makes one initrd.img for each kernel version that you have installed. Most people keep no more than 2 or 3 versions -- the current version, the one before that and maybe the one before. Why are you keeping so many kernel versions?
    • kgrittn
      kgrittn over 7 years
      It is creating these files for versions I deleted long ago. That is the problem.
    • kgrittn
      kgrittn over 7 years
      BTW, I usually keep more than two or three versions because I am a contributor to the PostgreSQL database engine, and it is not all that rare that new kernel versions degrade performance, and pinning that to a particular revision helps get the kernel fixed. Still, I typically only keep a handful installed at any one time. The problem turned out to be that I was getting rid of the old versions the wrong way -- through rm of the old files in the /boot/ directory. You must uninstall the related packages to avoid having the installer recreate files at surprising (to me) times.
    • hatterman
      hatterman over 7 years
      So my answer was correct ? Or at least reminded you how to uninstall the packages ?
    • kgrittn
      kgrittn over 7 years
      I didn't need to be reminded how to uninstall packages -- I needed some clue that previous advice to delete files from the directory that was running out was outdated. Search the web for boot directory running out of space and there are still a lot of pages recommending direct deletion. That seems to work until you run an update of linux-firmware, which is willing to create dozens of files you have previously deleted.
    • Elder Geek
      Elder Geek over 7 years
      @kgrittn I've voted to re-open your question, however even if it's not an exact duplicate of askubuntu.com/questions/89710/… it's closely related and you won't have a problem posting the answer there where IMHO it's likely to help the most people. My knee-jerk reaction to an answer in a question is to roll it back.
    • iamgoddey
      iamgoddey over 6 years
      I've had just this problem and seem to have been able to solve it by following help.ubuntu.com/community/…
    • iamgoddey
      iamgoddey over 6 years
      The above solution doesn't just remove the obsolete images but also removes the reason they are recreated (some stale dependencies information in the depth of apt or whatever)
  • kgrittn
    kgrittn over 7 years
    I had files for only five kernel versions in /boot/, leaving the mount point 20% full before attempting this update. The problem turned out to be that I had (many years ago) discovered that I could prevent out of space problems on boot by directly deleting old versions. That bytes you because there is a package for each that doesn't get cleaned up, and updating linux-firmware "recreates" files you've deleted.
  • hatterman
    hatterman over 7 years
    I have no idea what this comment means. Have you resolved your issue, if so would you care to give details how ?
  • kgrittn
    kgrittn over 7 years
    If you try to keep space free on the boot directory by directly deleting files, you will eventually run into problems when you update the linux-firmware package -- because it will create an initrd.img file for each package it thinks is installed, including re-creating files you have deleted. This is how, with five kernel versions present in the /boot/ directory, and 80% space free, I ran out of space on updating the one package.
  • Elder Geek
    Elder Geek over 7 years
    Good explanation!