Score:0

Cannot rebuild initramfs images, due to lack of space

tr flag

I am running out of space on the disk '/boot'. When trying to use the software updater, a message appears suggesting to remove old kernels using sudo apt autoremove, and to set COMPRESS=xz in initramfs.conf. Similarly to this question, sudo apt autoremove did not make a difference. Then, I tried with the second alternative. However, after setting COMPRESS=xz, I need to rebuild the initramfs.conf image. For this I use sudo update-initramfs -u -k all (as suggested in the answer of the above post/question), but it does not work due to lack of space. The output is the folllowing:

I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/vgubuntu-swap_1)
I: Set the RESUME variable to override this.
xz: (stdout): Write error: No space left on device
E: mkinitramfs failure xz --check=crc32 --threads=0 1
update-initramfs: failed for /boot/initrd.img-5.15.0-67-generic with 1.
Artur Meinild avatar
vn flag
You should probably reconfigure your device to have plenty of space in the `/boot` partition.
Miguel avatar
tr flag
How can I reconfigure the device to have more space in the `\boot` partition??
Artur Meinild avatar
vn flag
Does this answer your question? [How to resize partitions?](https://askubuntu.com/questions/126153/how-to-resize-partitions)
user10489 avatar
in flag
The obvious answer to "what do I do when I'm out of space" is "delete something". Autoremove sometimes helps. `apt purge` sometimes helps, but probably neither of those if /boot is separate. Maybe look and see if there are files in /boot that belong to kernels that are not "installed" that should have been deleted. Or (carefully!!) delete the oldest one that isn't in use... Ultimately, you probably need to resize the partition.
Miguel avatar
tr flag
@ArturMeinild Yes, I can try to do that. Thank you!
user10489 avatar
in flag
Good luck...and careful what you delete or you might leave the system unbootable.
Miguel avatar
tr flag
@user10489 I see that there is an old image `/boot/initrd.img-5.14.0-1055-oem` that I think is not in use, since when I run `uname -a`, the output is a more recent image `5.14.0-1057-oem`. Does this mean that I can safely delete the `5.14.0-1055-oem` image? Or do I need to check something else before?
Artur Meinild avatar
vn flag
Another possible duplicate: https://askubuntu.com/questions/89710/how-do-i-free-up-more-space-in-boot
user10489 avatar
in flag
Artur's suggested answer looks like it has good answers for this at a glance. If the kernel you found is older than the current one, it's probably ok to remove. I'd remove one or two large files and then use `dpkg -l | grep ` followed by `apt remove` to clean up the rest.
Miguel avatar
tr flag
I followed the instructions to delete only the unused packages. I checked several times, and made sure I was not doing any mistake. Indeed, I checked based on the answer given in the post shared by @ArturMeinild, but I also checked on other webpages, blogs and other similar questions. When I was sure, I removed the old kernels, and PC never rebooted again :/ The problem seems to be related to having removed the image `linux-image-x.x.x-x-generic`. I made sure I removed the one that had a version number, not the Generic Linux kernel image (`hwe-20.04`)
Randall Whitman avatar
fr flag
The ones with no version are symbolic links pointing to a file with actual content. All those files with actual content have a version number, and it is necessary to keep/preserve/retain the one with version number matching `uname -r`. Regarding the machine not booting because all kernel images were removed, I'd try booting to rescue mode from grub boot menu, and in rescue mode attempt to install a kernel.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.