Barry Newberger composed on 2025-03-24 08:05 (UTC-0500):
...
> update-initramfs: Generating /boot/initrd.img-6.1.0-32-amd64
> cpio: write error: No space left on device
> E: mkinitramfs failure cpio 2
> update-initramfs: failed for /boot/initrd.img-6.1.0-32-amd64 with 1.
> run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
> dpkg: error processing package linux-image-6.1.0-32-amd64 (--configure):
>  installed linux-image-6.1.0-32-amd64 package post-installation script
> subprocess returned error exit status 1
> Setting up linux-image-6.1.0-31-amd64 (6.1.128-1) ...
> /etc/kernel/postinst.d/dkms:
> dkms: running auto installation service for kernel 6.1.0-31-amd64.
> dkms: autoinstall for kernel: 6.1.0-31-amd64.
> /etc/kernel/postinst.d/initramfs-tools:
> update-initramfs: Generating /boot/initrd.img-6.1.0-31-amd64
> cpio: write error: No space left on device
...

It's not uncommon that one discovers he has let freespace get too low by
encountering a failure to install that leaves the new package's contents on disk
taking up valuable space without completing associated setup tasks. One then
logically tries to free some space by removing no longer needed packages. 
However,
apt* blocks the process of removal by refusing to remove without first 
completing
the installation task that cannot be completed due to lack of space. It's a
circular problem. Thus space must be freed by other means.

When this happens, first check the package cache: /var/cache/apt/archives/. If 
it
contains .deb that is yet to be installed, consider leaving it there, but 
removing
all other .debs. Removing all .debs stands a chance of biting back if something
somehow goes wrong that causes networking to be lost. If there is much there, 
this
is likely a total solution that will allow completion of the failing command 
repeated.

Presuming in your case the cache is not the space waster, you can free lots of
space by manually removing some some of those antique vmlinuz* and initrd.img*
files from /boot/, then trying again the command that failed due to lack of 
space.
Just don't remove the current running kernel's vmlinuz or initrd.img in the
process. Do save the two immediately older pairs too, just in case something 
blows
up before you finish you should be able to boot one of them. Optionally try this
command immediately after manual file removals, before repeating the command 
that
failed. It may eliminate the need:

        sudo apt-get --fix-broken install

The question remains why you allowed so many old kernels to accumulate.

FWIW, Ubuntu and Mint users have a high risk of this particular space problem by
Ubuntu's packing (apparently) every firmware ever produced in one linux-firmware
.deb currently 509,030,592 in size, many times the size of one kernel's .debs.
-- 
Evolution as taught in public schools is, like religion,
        based on faith, not based on science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata

Reply via email to