Ubuntu 18.04 cannot update as boot is full

1

I'm struggling to update my ubuntu18 installation as the boot is too full even though i've purged older kernels and done an 'autoremove'. there are some older versioned files hanging around but i can't seem to be able to delete these. please could someone point out where i've gone wrong ? :-)

david@david-W54-55SU1-SUW:~$ ls -l /boot 
total 80932
-rw-r--r-- 1 root root  1478976 Aug 28 17:08 abi-4.18.0-7-generic
-rw-r--r-- 1 root root  1479894 Sep 10 13:08 abi-4.18.0-8-generic
-rw-r--r-- 1 root root   216928 Aug 28 17:08 config-4.18.0-7-generic

-rw-r--r-- 1 root root   217064 Sep 10 13:08 config-4.18.0-8-generic

drwxr-xr-x 5 root root     1024 Oct 13 11:15 grub

-rw-r--r-- 1 root root 61336067 Oct 10 18:26 initrd.img-4.18.0-8-
generic

drwx------ 2 root root    12288 Nov 24  2014 lost+found

-rw-r--r-- 1 root root   182704 Jan 28  2016 memtest86+.bin

-rw-r--r-- 1 root root   184380 Jan 28  2016 memtest86+.elf

-rw-r--r-- 1 root root   184840 Jan 28  2016 memtest86+_multiboot.bin

-rw-r--r-- 1 root root       17 Aug 28 17:08 retpoline-4.18.0-7- 
generic

-rw-r--r-- 1 root root       17 Sep 10 13:08 retpoline-4.18.0-8- 
generic

-rw------- 1 root root  4350116 Aug 28 17:08 System.map-4.18.0-7-
generic

-rw------- 1 root root  4354064 Sep 10 13:08 System.map-4.18.0-8-
generic

-rw------- 1 root root  8535896 Sep 10 14:36 vmlinuz-4.18.0-8-generic

david@david-W54-55SU1-SUW:~$ rm abi-4.18.0.7-generic

rm: cannot remove 'abi-4.18.0.7-generic': No such file or directory

david@david-W54-55SU1-SUW:~$ rm /abi-4.18.0.7-generic

rm: cannot remove '/abi-4.18.0.7-generic': No such file or directory

david@david-W54-55SU1-SUW:~$ sudo apt-get purge abi-4.18.0-7-generic

Reading package lists... Done

Building dependency tree       

Reading state information... Done

E: Unable to locate package abi-4.18.0-7-generic

E: Couldn't find any package by glob 'abi-4.18.0-7-generic'

E: Couldn't find any package by regex 'abi-4.18.0-7-generic'

david@david-W54-55SU1-SUW:~$ sudo apt-get autoremove 

Reading package lists... Done

Building dependency tree       

Reading state information... Done

0 to upgrade, 0 to newly install, 0 to remove and 256 not to upgrade.

user1305541

Posted 2018-11-03T11:02:30.377

Reputation: 13

you probably want to "rm /boot/abi-4.18.0.7-generic" and that as root. But removing the package responsible would be even better. "dpkg -S /boot/abi-4.18.0.7-generic" doesn't help? – Gerard H. Pille – 2018-11-03T11:17:23.533

Given how easy it is to brick your system deleting kernels, it may be more useful to review other files to see what's using the most of the drive. I've used Disk Usage Analyzer , but here are some others : https://www.makeuseof.com/tag/how-to-analyze-your-disk-usage-pattern-in-linux/

– Christopher Hostage – 2018-11-04T00:35:40.087

Answers

1

You shouldn't "wildly" delete files.

A proper way would be:

!! Careful - this will remove ALL installed kernels except the latest!!

kv=`uname -r | awk -F '-' '{print $2}'` ; kv=$kv'-'
x=$(dpkg --list | grep -i linux-image | grep ^ii | grep -v $kv | awk '{ print $2}')
apt-get --purge remove $x
  • The first line will retrieve the build part (eg if you have 4.15.0-38-generic. the "38" will get extracted).
  • The second line will fetch the list of all installed linux-image packages except the version found in the first line.
  • The third line will remove the packages.

If it fails because of space, it might come through if you run it multiple times.

To purge deinstalled packages (all - not only kernel images) you can use:

dpkg --purge `dpkg --get-selections | grep deinstall | cut -f1`

And the rm failed as you have to either be in the directory where the file resides or use the full path.

Zina

Posted 2018-11-03T11:02:30.377

Reputation: 1 855