Summary: is there a way to get apt to build the kernel on a different partition and then copy it over the existing one?
My /boot partition is very small (88MB) and has only a single version of the kernel installed. The initrd file is 36MB, which is 4x as large as it used to be. I'm in a stuck state where apt can't run because a stuck package is trying to generate a new initrd file, but there's not enough space on /boot. :/
How can I get apt to generate a trimmed-down initrd file using /tmp, and then copy it over the original on /boot?
$ df -h / /boot
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 72G 58G 10G 86% /
/dev/sda1 88M 56M 26M 69% /boot
$ du -sh /boot/*
187K /boot/config-4.4.0-170-generic
6.7M /boot/grub
36M /boot/initrd.img-4.4.0-170-generic
179K /boot/memtest86+.bin
181K /boot/memtest86+.elf
181K /boot/memtest86+_multiboot.bin
3.8M /boot/System.map-4.4.0-170-generic
6.9M /boot/vmlinuz-4.4.0-170-generic
$ sudo apt -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.122ubuntu8.16) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-firmware (1.157.23) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-170-generic
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.4.0-170-generic with 1.
dpkg: error processing package linux-firmware (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for initramfs-tools (0.122ubuntu8.16) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-170-generic
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.4.0-170-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
linux-firmware
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)