Modules=DEP; a remedy for update-initramfs' "No space left on device"

11 Oct 2021 2-minute read

The fix? Add MODULES=dep to /etc/initramfs-tools/conf.d/modules, followed up by update-initramfs.

My most recent Debian install created a /boot partition of 237 M.

Starting with Debian's linux-image-5.10.0-4-amd, somewhere in March this year, update-initramfs began reporting problems installing a new kernel next to the current one.

Errors look like this:

Setting up grub-efi-amd64 (2.04-16) ...
Installing for x86_64-efi platform.
grub-install: error: cannot copy `/usr/share/locale/ast/LC_MESSAGES/grub.mo' to `/boot/grub/locale/ast.mo': No space left on device.
Failed: grub-install --target=x86_64-efi  
WARNING: Bootloader is not properly installed, system may not be bootable

or this

processing triggers for initramfs-tools (0.139) ...
update-initramfs: Generating /boot/initrd.img-5.10.0-4-amd64
cat: write error: No space left on device
update-initramfs: failed for /boot/initrd.img-5.10.0-4-amd64 with 1.
ESC[1mdpkg:ESC[0m error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
initramfs-tools

or this:

update-initramfs: Generating /boot/initrd.img-5.14.0-1-amd64

gzip: stdout: No space left on device
E: mkinitramfs failure gzip 1
update-initramfs: failed for /boot/initrd.img-5.14.0-1-amd64 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1

The fix - conveniently mentioned at very top of this post - I found (with encouragement of the Dutch Debian mailing list) in Debian Bug report logs - #929424: initramfs-tools: update-initramfs should not store temporary files on /boot, which I found after reading Debian Bug report logs - #972396: initramfs-tools: Installation fails (no space left on device).

As root, create a file entitled modules in /etc/initramfs-tools/conf.d/modules with just this one line:

MODULES=dep

And then redo, as root,

update-initramfs -u

or

update-initramfs -k all -u

The result (with currently just a single kernel installed):

FilesystemSizeUsedAvailUse%Mounted on
before/dev/nvme0n1p2237M101M124M45%/boot
after/dev/nvme0n1p2237M42M183M19%/boot

And that should leave you with enough space for a second kernel.