3

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.)

8
  • 1
    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?
    – AlexP
    Dec 28, 2016 at 21:36
  • 3
    It is creating these files for versions I deleted long ago. That is the problem.
    – kgrittn
    Dec 29, 2016 at 6:28
  • 1
    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.
    – kgrittn
    Dec 29, 2016 at 8:28
  • 2
    @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.
    – Elder Geek
    Jan 2, 2017 at 15:11
  • 2
    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)
    – artm
    Jan 3, 2018 at 9:19

1 Answer 1

5

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.

4
  • 1
    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.
    – kgrittn
    Dec 29, 2016 at 8:22
  • 1
    I have no idea what this comment means. Have you resolved your issue, if so would you care to give details how ?
    – hatterman
    Dec 29, 2016 at 18:05
  • 5
    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.
    – kgrittn
    Jan 2, 2017 at 13:52
  • Good explanation!
    – Elder Geek
    Jan 2, 2017 at 15:19

Not the answer you're looking for? Browse other questions tagged .