Score:0

Not enough free disk space on /boot

in flag

Not able to install updates for Ubuntu, or even remove older packages from /boot

Many answers suggested good solutions, but again I am not able to even remove older packages from /boot.

Not enough free disk space when upgrading

Unable to update ubuntu applications because there is not enough space on /boot

I am stuck in a loop here, my /boot size is 256M

df -h output:

Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  2.2M  1.6G   1% /run
/dev/nvme0n1p5   82G   39G   39G  50% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/nvme0n1p6  256M  186M   50M  79% /boot
/dev/nvme0n1p1   96M   31M   66M  32% /boot/efi
tmpfs           1.6G  120K  1.6G   1% /run/user/1000
/dev/sda2        67G   32K   64G   1% /media/nmt/3bf914c7-c1b2-47f0-9820-42dd7eb06059

dpkg -l | grep linux-image output:

rc  linux-image-5.19.0-21-generic              5.19.0-21.21                             amd64        Signed kernel image generic
rc  linux-image-5.19.0-23-generic              5.19.0-23.24                             amd64        Signed kernel image generic
rc  linux-image-5.19.0-26-generic              5.19.0-26.27                             amd64        Signed kernel image generic
rc  linux-image-5.19.0-28-generic              5.19.0-28.29                             amd64        Signed kernel image generic
rc  linux-image-5.19.0-29-generic              5.19.0-29.30                             amd64        Signed kernel image generic
rc  linux-image-5.19.0-31-generic              5.19.0-31.32                             amd64        Signed kernel image generic
rc  linux-image-5.19.0-35-generic              5.19.0-35.36                             amd64        Signed kernel image generic
rc  linux-image-5.19.0-38-generic              5.19.0-38.39                             amd64        Signed kernel image generic
rc  linux-image-5.19.0-40-generic              5.19.0-40.41                             amd64        Signed kernel image generic
ii  linux-image-5.19.0-41-generic              5.19.0-41.42                             amd64        Signed kernel image generic
iF  linux-image-5.19.0-42-generic              5.19.0-42.43                             amd64        Signed kernel image generic
ii  linux-image-generic-hwe-22.04              5.19.0.42.38                             amd64        Generic Linux kernel image

uname -r output:

5.19.0-42-generic

sudo apt-get remove --purge linux-image-5.19.0-21-generic output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'linux-image-5.19.0-21-generic' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 165 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-5.19.0-42-generic (5.19.0-42.43) ...
Processing triggers for linux-image-5.19.0-42-generic (5.19.0-42.43) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.19.0-42-generic
zstd: error 25 : Write error : No space left on device (cannot write compressed block) 
E: mkinitramfs failure zstd -q -1 -T0 25
update-initramfs: failed for /boot/initrd.img-5.19.0-42-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.19.0-42-generic (--configure):
 installed linux-image-5.19.0-42-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-5.19.0-42-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Update:

ls -lah /boot output:

total 178M
drwxr-xr-x  5 root root 4.0K Jun  3 11:37 .
drwxr-xr-x 20 root root 4.0K Nov 15  2022 ..
-rw-------  1 root root 6.2M Mar 23 23:36 System.map-5.19.0-40-generic
-rw-------  1 root root 6.2M Apr 17 17:56 System.map-5.19.0-41-generic
-rw-------  1 root root 6.2M Apr 18 20:50 System.map-5.19.0-42-generic
-rw-r--r--  1 root root 264K Mar 23 23:36 config-5.19.0-40-generic
-rw-r--r--  1 root root 264K Apr 17 17:56 config-5.19.0-41-generic
-rw-r--r--  1 root root 264K Apr 18 20:50 config-5.19.0-42-generic
drwx------  4 root root 1.0K Jan  1  1970 efi
drwxr-xr-x  5 root root 4.0K May 18 06:58 grub
lrwxrwxrwx  1 root root   28 May 18 06:57 initrd.img -> initrd.img-5.19.0-42-generic
-rw-r--r--  1 root root  68M May  5 06:47 initrd.img-5.19.0-41-generic
-rw-r--r--  1 root root  68M May 18 06:58 initrd.img-5.19.0-42-generic
lrwxrwxrwx  1 root root   28 May 17 08:04 initrd.img.old -> initrd.img-5.19.0-41-generic
drwx------  2 root root  16K Nov 15  2022 lost+found
-rw-r--r--  1 root root 179K Feb  6  2022 memtest86+.bin
-rw-r--r--  1 root root 181K Feb  6  2022 memtest86+.elf
-rw-r--r--  1 root root 181K Feb  6  2022 memtest86+_multiboot.bin
lrwxrwxrwx  1 root root   25 May 17 08:04 vmlinuz -> vmlinuz-5.19.0-42-generic
-rw-------  1 root root  12M Apr 17 20:55 vmlinuz-5.19.0-41-generic
-rw-------  1 root root  12M Apr 18 20:55 vmlinuz-5.19.0-42-generic
lrwxrwxrwx  1 root root   25 May 17 08:04 vmlinuz.old -> vmlinuz-5.19.0-41-generic
user535733 avatar
cn flag
"*I am not able to even remove older packages from /boot*" Correct: `rc` means that kernel has *already* been removed. That's merely of index of known packages, not a list what's actually on your system. Please edit your question to show the complete output of `ls -lah /boot`. Check that output for old, orphaned files that can be safely removed.
notify_my_threads avatar
in flag
@user535733 I updated my question.
mook765 avatar
cn flag
Your boot-partition is way too small.
mpboden avatar
do flag
Please update your question to include output of `lsblk`.
notify_my_threads avatar
in flag
I struggled with fixing the issue since I found that I did more damage than I expected, and reinstalled ubuntu leaving more space for swap and boot this time, I was not aware of this configuration when I first installed it. thanks for the answers. the question can be closed.
user535733 avatar
cn flag
That's not how AskUbuntu works. You can flag you own question, if you wish. But it's better if you answer your own question to help future users with a similar problem.
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.