5

As with many questions before, I am running into the error of "not enough free disk space" on /boot for an upgrade from 20.04 LTS to 22.04 via software upgrader. Text:

The upgrade has aborted. The upgrade needs a total of 311 M free space on disk '/boot'. Please free at least an additional 10.4 M of disk space on '/boot'. You can remove old kernels using 'sudo apt autoremove' and you could also set COMPRESS=xz in /etc/initramfs-tools/initramfs.conf to reduce the size of your initramfs.

However, I have done all I have found for clearing /boot, seem to have no old kernels or other things left to remove, and have been unable to resize partitions in gparted.

What I've tried:

  • sudo apt-get autoremove - 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded
  • How do I free up more space in /boot? - code results in: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded
  • http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/ - generally code seems to show I only have operating kernel installed right now
  • resizing in gparted - I'm not very familiar, but it isn't letting me resize any of the partitions to make more room for boot (which is says has 311 of 488Mb free?)
  • Set compress=xz as suggested in the error

What things look like:

dpkg -l linux-{image,headers}-"[0-9]*" 

[115 lines of linux headers - but are these in boot?]

$ dpkg -l linux-* | awk '/^ii/{ print $2 }'
linux-base
linux-firmware
linux-headers-5.4.0-99
linux-headers-5.4.0-99-generic
linux-image-5.4.0-99-generic
linux-libc-dev:amd64
linux-modules-5.4.0-99-generic
linux-modules-extra-5.4.0-99-generic
linux-sound-base

$ uname -r 5.4.0-99-generic

$ ls -l /boot total 154928 -rw-r--r-- 1 root root 237940 Feb 2 2022 config-5.4.0-99-generic drwx------ 3 root root 4096 Dec 31 1969 efi drwxr-xr-x 5 root root 1024 May 18 11:54 grub lrwxrwxrwx 1 root root 27 Feb 17 2022 initrd.img -> initrd.img-5.4.0-99-generic -rw-r--r-- 1 root root 138789943 Sep 1 22:06 initrd.img-5.4.0-99-generic lrwxrwxrwx 1 root root 27 Feb 17 2022 initrd.img.old -> initrd.img-5.4.0-99-generic drwx------ 2 root root 12288 Sep 1 2016 lost+found -rw-r--r-- 1 root root 182704 Aug 18 2020 memtest86+.bin -rw-r--r-- 1 root root 184380 Aug 18 2020 memtest86+.elf -rw-r--r-- 1 root root 184884 Aug 18 2020 memtest86+_multiboot.bin -rw------- 1 root root 4757200 Feb 2 2022 System.map-5.4.0-99-generic lrwxrwxrwx 1 root root 24 Feb 17 2022 vmlinuz -> vmlinuz-5.4.0-99-generic -rw------- 1 root root 13660416 Feb 2 2022 vmlinuz-5.4.0-99-generic lrwxrwxrwx 1 root root 24 Feb 17 2022 vmlinuz.old -> vmlinuz-5.4.0-99-generic

Update/resolution:

ubfan1 pointed out that I needed to run

sudo update-initramfs -u -k all  

to get the compression working as noted in the error suggestion.

After that I was able to get the update installed, but I'm still at 300+ MB with two kernels so I think I'll have to increase the size of boot. As rinzwind pointed out, this has to be done on a live boot of gparted but I haven't tried this yet.

nb137
  • 51
  • 1
    115 lines of headers! Expect 3 for the one kernel installed. You're right though, not a /boot problem but indicative of a package management problem. 138MB for initrd seems about twice too big. After adding the COMPRESS=xz , did you run sudo update-initramfs -u -k all ? – ubfan1 Sep 10 '22 at 21:16
  • you need to extend your boot partition. I couldn't extend it because I couldn't move free space near boot partition, so I ended up booting from live usb, shrinking my big data partition (to leave 1 gb free space), creating a new boot partition 1 GB, copying files from old boot partition, editing /etc/fstab. also I needed to update grub after upgrade, but IDK if it's relevant to the new partition – Cagri Sep 10 '22 at 22:52
  • one alternative is to make your home folder on another partition, even a USB stick (I think) would work. liveusb , mount your main root drive, edit etc/fstab , set /home partition to the new one and it's UUID= from blkid (that you have also copied your /home to) , update-grub. I recommend clonezilla to backup all partitions before doing this. – pierrely Sep 11 '22 at 06:53
  • @ubfan1 update-initramfs seemed to be the key here - then it turns out I had to point to the proper swap location for it to work. Now I've got the update working! But any suggestions on guides to getting the package management under control? My boot has now gone from 155 to 316 MB. – nb137 Sep 11 '22 at 18:45
  • In the dpkg -l output, lines starting with "rc" (or "un" if it's associated with a kernel you know you removed) may be purged (apt-get purge xxx)(only "ii" items are fully installed). Look in /lib/modules and any directories associated with removed kernels may be removed. Look in /boot for any initrd files with "old" in their name, those may be deleted. apt-get autoremove does not get everything. My boot with two kernels takes 199MB (using gzip on the initrd), so 100MB per kernel. – ubfan1 Sep 11 '22 at 21:57
  • What is your COMPESS= using? I have a 40MB initrd with a 4.4 kernel with gzip and a 66MB initrd /5.15 kernel with zstd. Some might be quicker, but take more room to create. – ubfan1 Sep 14 '22 at 05:50
  • See https://askubuntu.com/questions/1429216/very-high-boot-space-requirement-to-go-from-20-04-to-22-04-preventing-upgrade for other compress values which use less space. – ubfan1 Sep 14 '22 at 16:42

1 Answers1

1

resizing in gparted - I'm not very familiar, but it isn't letting me resize any of the partitions to make more room for boot (which is says has 311 of 488Mb free?)"

A mounted partition can not be resized. You need to use a live session gparted to boot from that and then you can increase /boot (by adding space from an adjecent partition).

If you resize: to err on the safe side 1GiB is a good size.

Rinzwind
  • 299,756