Score:1

apt autoremove does not free up space on boot

sn flag

For the past few months I have been receiving alerts occasionally that there is low disk space on my boot partition on ubuntu 20.04. Usually doing a sudo apt autoremove would free up space until the next update.

But for the past few weeks the command is not freeing up any space and I have consistantly only 26mb on by boot partition, which throws errors when it comes time to update.

Below is my output for apt autoremove

nocnoc@nocnoc-ThinkPad-T470p:~$ sudo apt autoremove
[sudo] password for nocnoc: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-41-generic
W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/glk_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/cml_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/icl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/ehl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/ehl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.5.0.bin for module i91
5
W: Possible missing firmware /lib/firmware/i915/tgl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.5.0.bin for module i91
5
W: Possible missing firmware /lib/firmware/i915/tgl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/dg1_dmc_ver2_02.bin for module i
915
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.
Error 24 : Write error : cannot write compressed block 
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.11.0-41-generic with 1.
dpkg: 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
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any ideas would be greatly appreciated, thanks!

Edit:

My laptop has 20gb available on the main partition, the problem is that the /boot partition in ubuntu is too small and filled up. So I would like to know how I can have apt either trim the fat or increase the size of /boot

Here is my output for sudo apt -f install

nocnoc@nocnoc-ThinkPad-T470p:~$ sudo apt -f install
[sudo] password for nocnoc: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-41-generic
W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/glk_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/cml_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/icl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/ehl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/ehl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.5.0.bin for module i91
5
W: Possible missing firmware /lib/firmware/i915/tgl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.5.0.bin for module i91
5
W: Possible missing firmware /lib/firmware/i915/tgl_guc_49.0.1.bin for module i9
15
W: Possible missing firmware /lib/firmware/i915/dg1_dmc_ver2_02.bin for module i
915
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.
Error 24 : Write error : cannot write compressed block 
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.11.0-41-generic with 1.
dpkg: 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
E: Sub-process /usr/bin/dpkg returned an error code (1)

Edit 2:

Here is my output for lsblk:

nocnoc@nocnoc-ThinkPad-T470p:~$ lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0           7:0    0  61.3M  1 loop  /snap/authy/6
loop1           7:1    0  61.5M  1 loop  /snap/authy/7
loop2           7:2    0     4K  1 loop  /snap/bare/5
loop3           7:3    0     9M  1 loop  /snap/canonical-livepatch/126
loop4           7:4    0  64.5M  1 loop  /snap/caprine/48
loop5           7:5    0  94.5M  1 loop  /snap/go/8779
loop6           7:6    0  64.5M  1 loop  /snap/caprine/47
loop7           7:7    0 147.9M  1 loop  /snap/chromium/1854
loop8           7:8    0 147.9M  1 loop  /snap/chromium/1845
loop9           7:9    0  99.4M  1 loop  /snap/core/11993
loop10          7:10   0 183.9M  1 loop  /snap/inkscape/9256
loop11          7:11   0  99.3M  1 loop  /snap/core/11743
loop12          7:12   0 467.5M  1 loop  /snap/goland/156
loop13          7:13   0  64.6M  1 loop  /snap/sublime-text/109
loop14          7:14   0  65.2M  1 loop  /snap/gtk-common-themes/1519
loop15          7:15   0     9M  1 loop  /snap/canonical-livepatch/119
loop16          7:16   0   219M  1 loop  /snap/gnome-3-34-1804/72
loop17          7:17   0 175.4M  1 loop  /snap/postman/132
loop18          7:18   0   3.3M  1 loop  /snap/shellcheck/1654
loop19          7:19   0 323.6M  1 loop  /snap/telegram-desktop/3455
loop20          7:20   0  60.3M  1 loop  /snap/pocket-casts/9
loop21          7:21   0 100.4M  1 loop  /snap/drawio/134
loop22          7:22   0 602.1M  1 loop  /snap/goland/163
loop23          7:23   0 242.4M  1 loop  /snap/gnome-3-38-2004/76
loop24          7:24   0 162.1M  1 loop  /snap/spotify/53
loop25          7:25   0  82.9M  1 loop  /snap/discord/130
loop26          7:26   0  66.5M  1 loop  /snap/citra-emu/144
loop27          7:27   0 176.9M  1 loop  /snap/krita/64
loop28          7:28   0 260.7M  1 loop  /snap/kde-frameworks-5-core18/32
loop29          7:29   0 162.9M  1 loop  /snap/gnome-3-28-1804/145
loop30          7:30   0 167.3M  1 loop  /snap/spotify/56
loop31          7:31   0 217.5M  1 loop  /snap/code/84
loop32          7:32   0    87M  1 loop  /snap/teams-for-linux/195
loop33          7:33   0 247.9M  1 loop  /snap/gnome-3-38-2004/87
loop34          7:34   0   3.2M  1 loop  /snap/shellcheck/1462
loop35          7:35   0  94.5M  1 loop  /snap/go/8839
loop36          7:36   0  64.7M  1 loop  /snap/sublime-text/110
loop37          7:37   0  54.2M  1 loop  /snap/snap-store/558
loop38          7:38   0   535M  1 loop  /snap/pycharm-professional/260
loop39          7:39   0 100.4M  1 loop  /snap/drawio/135
loop40          7:40   0 175.4M  1 loop  /snap/postman/133
loop41          7:41   0    51M  1 loop  /snap/snap-store/547
loop42          7:42   0  60.3M  1 loop  /snap/pocket-casts/10
loop43          7:43   0 517.7M  1 loop  /snap/nightmayr-kf5-qt-5-15-2-core20/20
loop44          7:44   0  77.2M  1 loop  /snap/discord/128
loop45          7:45   0 116.6M  1 loop  /snap/docker/1125
loop46          7:46   0 164.8M  1 loop  /snap/gnome-3-28-1804/161
loop47          7:47   0  55.5M  1 loop  /snap/core18/2253
loop48          7:48   0 122.4M  1 loop  /snap/fromscratch/4
loop49          7:49   0   362M  1 loop  /snap/obs-studio/1273
loop50          7:50   0 518.3M  1 loop  /snap/nightmayr-kf5-qt-5-15-2-core20/26
loop51          7:51   0    87M  1 loop  /snap/teams-for-linux/205
loop52          7:52   0  42.2M  1 loop  /snap/snapd/14066
loop53          7:53   0   4.2M  1 loop  /snap/tree/18
loop54          7:54   0  61.9M  1 loop  /snap/core20/1242
loop55          7:55   0 276.7M  1 loop  /snap/gimp/372
loop56          7:56   0 362.2M  1 loop  /snap/obs-studio/1276
loop57          7:57   0 131.6M  1 loop  /snap/docker/796
loop58          7:58   0   219M  1 loop  /snap/gnome-3-34-1804/77
loop59          7:59   0  43.3M  1 loop  /snap/snapd/14295
loop60          7:60   0  55.5M  1 loop  /snap/core18/2246
loop61          7:61   0 213.8M  1 loop  /snap/code/83
loop62          7:62   0  61.9M  1 loop  /snap/core20/1270
loop63          7:63   0   277M  1 loop  /snap/gimp/380
loop64          7:64   0 313.2M  1 loop  /snap/telegram-desktop/3343
loop65          7:65   0 184.8M  1 loop  /snap/inkscape/9090
loop66          7:66   0 264.8M  1 loop  /snap/citra-emu/143
loop67          7:67   0  65.1M  1 loop  /snap/gtk-common-themes/1515
loop68          7:68   0   8.1M  1 loop  /snap/pick-colour-picker/238
loop69          7:69   0 295.7M  1 loop  /snap/vlc/2344
loop70          7:70   0 669.7M  1 loop  /snap/pycharm-professional/265
nvme0n1       259:0    0 238.5G  0 disk  
├─nvme0n1p1   259:1    0   512M  0 part  /boot/efi
├─nvme0n1p2   259:2    0   732M  0 part  /boot
└─nvme0n1p3   259:3    0 237.3G  0 part  
  └─nvme0n1p3_crypt
              253:0    0 237.2G  0 crypt 
    ├─vgubuntu-root
    │         253:1    0 236.3G  0 lvm   /run/timeshift/backup
    └─vgubuntu-swap_1
              253:2    0   976M  0 lvm   [SWAP]

And here is my output for ls /boot/

nocnoc@nocnoc-ThinkPad-T470p:~$ ls /boot
config-5.11.0-38-generic      memtest86+.bin
config-5.11.0-40-generic      memtest86+.elf
config-5.11.0-41-generic      memtest86+_multiboot.bin
config-5.4.0-91-generic       System.map-5.11.0-38-generic
efi                           System.map-5.11.0-40-generic
grub                          System.map-5.11.0-41-generic
initrd.img                    System.map-5.4.0-91-generic
initrd.img-5.11.0-38-generic  vmlinuz
initrd.img-5.11.0-40-generic  vmlinuz-5.11.0-38-generic
initrd.img-5.11.0-41-generic  vmlinuz-5.11.0-40-generic
initrd.img-5.4.0-91-generic   vmlinuz-5.11.0-41-generic
initrd.img.old                vmlinuz-5.4.0-91-generic
lost+found                    vmlinuz.old
Someone avatar
my flag
Please [edit] your question and add the output of `sudo apt -f install`. Thanks
Nmath avatar
ng flag
Running out of disk space can cause catastrophic problems. At 26 MB left, is it possible that your system has not already run out of space at some point? Even autoremove needs working space to "breathe", for lack of a better word. Sometimes all it takes to kill a system is for one critical write to fail due to lack of space. This can cause compounding problems that generally require a reinstall when the file system is allowed to run out of space. This may be the best path forward. Allocate more room to Ubuntu so it doesn't happen again. 25 GB is the *minimum* suggested for Ubuntu Desktop
Artur Meinild avatar
vn flag
`sudo apt autoremove` does not "magically" give you more space. It will only remove something if you have uninstalled packages, and there are leftover packages that are no longer dependencies. As Nmath says, the problem with low disk space is critical, and should be resolved with other means than autoremoval of packages.
nocnoc avatar
sn flag
@someone Updated the question with the output
Someone avatar
my flag
ok !.........................
Nmath avatar
ng flag
Saw your update. Seeing that `11 not upgraded` - If you still only have 26MB of space, you're not going to be able to solve this problem without a reinstall. You need enough space so that updates can be downloaded, unpacked, and installed. Reinstall the OS. It's your only option at this point.
PonJar avatar
in flag
Would be useful to see the output of `lsblk`. You may be able to avoid a reinstall by resizing partitions. Can you uninstall anything, even if just temporarily, to get things going again? Have you pruned your logs?
nocnoc avatar
sn flag
@PonJar I added the output for lsblk and ls /boot/. Hope that helps. I would rather not reinstall due to this machine being my workmachine and having a lot of configuration needed for work
PonJar avatar
in flag
I’d look at your EFI partition if I were you. You probably have enough MB unused in EFI to avoid this in future. If you use GParted to resize EFI (reduce) and boot (increase) you should be able to update without issues. Make sure you have backups of any data you cannot afford to lose before trying this.
Score:0
sn flag

The answer was to go into boot and manually delete the old kernels rather than rely on apt autoremove. The problem is essentially that apt can't complete the installation of the newest kernel (5.11.0-41) because there isn't enough space, and autoremove won't remove the older kernel (5.11.0-38) until the newest one is installed. In my case.

sudo apt remove 'linux*5.4.0-91*'

sudo apt remove 'linux*5.11.0-38*'

I'm using wildcards (*) in the above command because the kernel is made up of 5 packages (headers, image, modules).

This command may additionally remove linux-generic, linux-headers-generic and linux-image-generic. That's normal and nothing to worry about, since you do have the HWE versions of those packages (same package names but with -hwe-20.04 appended, those are the packages that provide the 5.11 kernel that you're using).

After all that you may need to run sudo apt -f install to complete the installation of 5.11.0-41.

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.