No space left on device under Ubuntu Linux

Today I had problems (“No space left on device” errors) during a system upgrade of Ubuntu Linux.

There where error messages telling me the boot Partition is full:

update-initramfs: Generating /boot/initrd.img-4.4.0-47-generic

gzip: stdout: No space left on device

No space left on device under Ubuntu Linux

That’s why I had to find out, whats in this boot folder.

$> ls -al /boot
-rw-r--r--  1 root root 1,2M Aug 11 21:58 abi-4.4.0-36-generic
-rw-r--r--  1 root root 1,2M Sep  6 20:52 abi-4.4.0-38-generic
-rw-r--r--  1 root root 1,2M Okt 19 18:34 abi-4.4.0-45-generic
-rw-r--r--  1 root root 1,2M Okt 27 00:27 abi-4.4.0-47-generic
-rw-r--r--  1 root root 1,2M Nov 24 22:12 abi-4.4.0-51-generic
-rw-r--r--  1 root root 1,2M Dez  2 20:11 abi-4.4.0-53-generic
-rw-r--r--  1 root root 186K Aug 11 21:58 config-4.4.0-36-generic
-rw-r--r--  1 root root 186K Sep  6 20:52 config-4.4.0-38-generic
-rw-r--r--  1 root root 186K Okt 19 18:34 config-4.4.0-45-generic
-rw-r--r--  1 root root 186K Okt 27 00:27 config-4.4.0-47-generic
-rw-r--r--  1 root root 186K Nov 24 22:12 config-4.4.0-51-generic
-rw-r--r--  1 root root 186K Dez  2 20:11 config-4.4.0-53-generic
drwxr-xr-x  5 root root 1,0K Nov 17 09:58 grub
-rw-r--r--  1 root root  37M Sep  5 10:55 initrd.img-4.4.0-36-generic
-rw-r--r--  1 root root  38M Okt 17 16:53 initrd.img-4.4.0-38-generic
-rw-r--r--  1 root root  39M Nov 10 09:59 initrd.img-4.4.0-45-generic
-rw-r--r--  1 root root  39M Nov 17 09:58 initrd.img-4.4.0-47-generic
drwx------  2 root root  12K Apr 25  2016 lost+found
-rw-r--r--  1 root root 179K Jan 28  2016 memtest86+.bin
-rw-r--r--  1 root root 181K Jan 28  2016 memtest86+.elf
-rw-r--r--  1 root root 181K Jan 28  2016 memtest86+_multiboot.bin
-rw-------  1 root root 3,7M Aug 11 21:58 System.map-4.4.0-36-generic
-rw-------  1 root root 3,7M Sep  6 20:52 System.map-4.4.0-38-generic
-rw-------  1 root root 3,7M Okt 19 18:34 System.map-4.4.0-45-generic
-rw-------  1 root root 3,7M Okt 27 00:27 System.map-4.4.0-47-generic
-rw-------  1 root root 3,7M Nov 24 22:12 System.map-4.4.0-51-generic
-rw-------  1 root root 3,7M Dez  2 20:11 System.map-4.4.0-53-generic
-rw-------  1 root root 6,8M Aug 11 21:58 vmlinuz-4.4.0-36-generic
-rw-------  1 root root 6,8M Sep  6 20:52 vmlinuz-4.4.0-38-generic
-rw-------  1 root root 6,8M Okt 19 18:34 vmlinuz-4.4.0-45-generic
-rw-------  1 root root 6,8M Okt 27 00:27 vmlinuz-4.4.0-47-generic
-rw-------  1 root root 6,8M Nov 24 22:12 vmlinuz-4.4.0-51-generic
-rw-------  1 root root 6,8M Dez  2 20:11 vmlinuz-4.4.0-53-generic

As you can see this folder contains all required stuff to boot the Lunix OS (for further information about boot directory, use the link below).

You could see, that the biggest files are matching these patterns:

  • abi-*-generic
  • config-*-generic
  • initrd.img-*-generic
  • System.map-*-generic

The system keeps multiple versions of it. Most of these files belong to old Kernel versions  and therefore are not required anymore.

How to remove old Kernel versions (solves”No space left on device” errors)

Now one could simply remove the unnecessary versions of theses files. I personally kept the last zwo versions of each file and solved the problem that way.

But the most safe way to remove these old Kernel versions is to run the following command (under Ubuntu):

$> sudo apt-get autoremove

Result

That will remove all outdated Kernel versions and packages from the system. After this, your boot folder should only contain the last three versions of the mentioned files. And that will resolve the “No space left on device” error during the upgrade too.

Further information corresponding to “No space left on device” error

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.