5

I'm trying to update but it can't and tells me that I need to clear up space in the boot directory but I can't remove anything from it and the sudo command does nothing. Below is the actual message I get.

The upgrade needs a total of 26.0 M free space on disk '/boot'. Please free at least an additional 5,055 k of disk space on '/boot'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.

Please help, oh BTW, yes I'm fairly new to Linux so please bear with me.

Cory Chamberlain
  • 51
  • 1
  • 1
  • 2

2 Answers2

9

It's probably because you have too many kernel packages installed (you can only run one at a time).

Check which kernel packages are installed:

dpkg -l 'linux-image*' | grep '^ii'

Check what your current kernel is:

uname -r

And just remove the older versions. For instance on my machine my /boot directory contents looks like this:

% ls -al /boot
drwxr-xr-x  4 root root     1024 May  2 13:00 .
drwxr-xr-x 27 root root     4096 Apr 18 01:09 ..
-rw-------  1 root root  3018381 Mar 11 22:39 System.map-3.5.0-26-generic
-rw-------  1 root root  3020028 Mar 26 19:54 System.map-3.5.0-27-generic
-rw-------  1 root root  3020830 Apr 24 23:04 System.map-3.5.0-28-generic
-rw-r--r--  1 root root   850088 Mar 11 22:39 abi-3.5.0-26-generic
-rw-r--r--  1 root root   852365 Mar 26 19:54 abi-3.5.0-27-generic
-rw-r--r--  1 root root   852490 Apr 24 23:04 abi-3.5.0-28-generic
-rw-r--r--  1 root root   147953 Mar 11 22:39 config-3.5.0-26-generic
-rw-r--r--  1 root root   148105 Mar 26 19:54 config-3.5.0-27-generic
-rw-r--r--  1 root root   148105 Apr 24 23:04 config-3.5.0-28-generic
drwxr-xr-x  3 root root     5120 May  2 13:01 grub
-rw-------  1 root root 23540031 Mar 28 18:31 initrd.img-3.5.0-26-generic
-rw-------  1 root root 23574269 Apr  9 08:26 initrd.img-3.5.0-27-generic
-rw-------  1 root root 23578154 May  2 13:00 initrd.img-3.5.0-28-generic
drwxr-xr-x  2 root root    12288 Oct  5  2012 lost+found
-rw-r--r--  1 root root   176764 Nov 27  2011 memtest86+.bin
-rw-r--r--  1 root root   178944 Nov 27  2011 memtest86+_multiboot.bin
-rw-------  1 root root  5180064 Mar 11 22:39 vmlinuz-3.5.0-26-generic
-rw-------  1 root root  5180864 Mar 26 19:54 vmlinuz-3.5.0-27-generic
-rw-------  1 root root  5183296 Apr 24 23:04 vmlinuz-3.5.0-28-generic

I have the following kernel image packages installed:

% dpkg -l 'linux-image*' | grep '^ii'
ii  linux-image-3.5.0-26-generic                      3.5.0-26.42~precise1                                Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-3.5.0-27-generic                      3.5.0-27.46~precise1                                Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-3.5.0-28-generic                      3.5.0-28.48~precise1                                Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-generic-lts-quantal                   3.5.0.28.35                                         Generic Linux kernel image

And my currently running kernel is:

% uname -r
3.5.0-27-generic

Thus, in my case I could free up space in /boot by removing:

linux-image-3.5.0-26-generic
linux-image-3.5.0-28-generic

by running apt-get remove <package_name>

  • Thank you so much, that work great. It's been a few years since I've worked with Linux but so far I'm liking what I see. A lot better than it was 15 years ago when I first started. But been about half that since I last worked with it. Thanks again for your prompt help. I then followed the link in the next comment from bkd.online and synaptic worked great. I owe you both a huge thanks – Cory Chamberlain May 03 '13 at 04:14
  • Not at all, glad we could help! And welcome to askubuntu by the way PS. Please consider upvoting answers that you've found helpful and good luck! :) – Marcin Kaminski May 03 '13 at 13:23
2

You can remove ALL the old kernels, and keep just the latest one. This will free up space on /boot. This is doable via multiple methods.

Refer this link. User mikewhatever has provided an answer which can do this removal from one single command from command line.

Update: listing the command here itself, from the said link:

sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')

Bhavin Doshi
  • 2,466