apt-get: No space left on device (12.04)
Solution 1
I just encountered this same problem. I elsewhere came across a mention of inodes, and ran in my terminal to check inode usage :
df -i
This showed inode use at 99%. So, while my disk had plenty of space left, I wasn't able to create more files because of the limit in the number of inodes. Some disk cleanup was the solution to my problem.
Solution 2
I'm thinking your boot partition is full of old kernel images, leaving no room for the new one apt-get
is trying to install. You can type
dpkg -l linux-headers-\* linux-image-\* | grep ^ii
into a terminal window. When I do this, I get
ii linux-headers-3.8.0-18 3.8.0-18.28 all Header files related to Linux kernel version 3.8.0
ii linux-headers-3.8.0-18-generic 3.8.0-18.28 amd64 Linux kernel headers for version 3.8.0 on 64 bit x86 SMP
ii linux-headers-3.8.0-19 3.8.0-19.30 all Header files related to Linux kernel version 3.8.0
ii linux-headers-3.8.0-19-generic 3.8.0-19.30 amd64 Linux kernel headers for version 3.8.0 on 64 bit x86 SMP
ii linux-headers-3.8.0-21 3.8.0-21.32 all Header files related to Linux kernel version 3.8.0
ii linux-headers-3.8.0-21-generic 3.8.0-21.32 amd64 Linux kernel headers for version 3.8.0 on 64 bit x86 SMP
ii linux-headers-3.8.0-22 3.8.0-22.33 all Header files related to Linux kernel version 3.8.0
ii linux-headers-3.8.0-22-generic 3.8.0-22.33 amd64 Linux kernel headers for version 3.8.0 on 64 bit x86 SMP
ii linux-headers-3.8.0-23 3.8.0-23.34 all Header files related to Linux kernel version 3.8.0
ii linux-headers-3.8.0-23-generic 3.8.0-23.34 amd64 Linux kernel headers for version 3.8.0 on 64 bit x86 SMP
ii linux-headers-3.8.0-25 3.8.0-25.37 all Header files related to Linux kernel version 3.8.0
ii linux-headers-3.8.0-25-generic 3.8.0-25.37 amd64 Linux kernel headers for version 3.8.0 on 64 bit x86 SMP
ii linux-headers-generic 3.8.0.25.43 amd64 Generic Linux kernel headers
Since I have quite a few, I could delete some of the oldest with
sudo apt-get remove linux-headers-3.8.0-18
If apt-get
fails because it misses some package dependencies (which you can't install due to the lack of free inodes), you can resort to dpkg
directly instead:
sudo dpkg --remove linux-headers-3.8.0-18
Do that a couple of times to your oldest linux-headers-*
and you should have room.
Solution 3
I used sudo apt-get autoremove
and it removed a bunch of old kernel-headers packages. Good to go after that.
Solution 4
As far as I know the limit of the inodes in Linux ext* file systems is around 4 billion, but not less, which is huge amount of files. So your problem is that something is generating a lot of files. I can propose you to check first this: http://blog.scoutapp.com/articles/2014/10/08/understanding-disk-inodes So you will find what is filling the inodes of your FS. I can propose also to clean the apt cache:
sudo apt-get clean
and
sudo apt-get autoclean
Related videos on Youtube
Don A
Updated on September 18, 2022Comments
-
Don A over 1 year
I have read every thread I could find -- even the ones that say that the question has been answered elsewhere but none of them address the specific issue I am having. Update Manager ran and produced errors relating to unmet dependency and suggested using apt-get install -f which fails with this message:
Unpacking linux-headers-3.5.0-36 (from .../linux-headers-3.5.0-36_3.5.0-36.57~precise1_all.deb) ... dpkg: error processing /var/cache/apt/archives/linux-headers-3.5.0-36_3.5.0-36.57~precise1_all.deb (--unpack): unable to create `/usr/src/linux-headers-3.5.0-36/arch/arm/mach-iop32x/include/mach/glantank.h.dpkg-new' (while processing `./usr/src/linux-headers-3.5.0-36/arch/arm/mach-iop32x/include/mach/glantank.h'): No space left on device
I suspect that the last 5 words No space left on device are significant but df and du both show adequate space. So I am wondering, what device needs more space?
Ouput from
df -h
Filesystem Size Used Avail Use% Mounted on /dev/sda1 5.5G 4.4G 786M 86% / udev 996M 4.0K 996M 1% /dev tmpfs 402M 880K 401M 1% /run none 5.0M 0 5.0M 0% /run/lock none 1004M 156K 1004M 1% /run/shm /dev/sdb1 30G 1.4G 27G 5% /home /dev/sdc1 299G 31G 268G 11% /media/HD-PCTU2
-
don.joey almost 11 yearsDo you have space on the root partition?
-
January almost 11 yearsPlease paste (i) the output of
df -h
and (ii) the output ofmount
. dpkg will clean up the files after it finished working, so it might appear that you have enough space when in fact you don't. Consider runningapt-get clean
before you start dpkg. -
Emmanuel almost 11 yearsto monitor do
watch -n 1 df -h
in a terminal while doing theapt-get install
(it will slow down a bit you i/o but you will know which file system is too small) -
XavierStuvw over 7 yearsProblem occurring also with Ubuntu 14.04 and kernel version 3.13.0.108 in one computer out of three. I started off with askubuntu.com/questions/223143/… but the answers shown here are in the same line.
-
martinho over 3 years
-
-
Marc almost 11 yearsPerhaps a backup of your user files is in order, before you mess with your boot partition? I've never had trouble doing this, but if I did, I'd have everything I needed for a reinstall. Of course, I do a backup every day anyway.
-
Don A almost 11 yearsI was hoping I wouldn't need to mess with the boot partition and that there was a way to break out of the endless cycle of dependency. I see now that it's probably going to be easier to backup data and start over. Now that I know the importance of cleaning out older items I'll make it a habit. Thanks to all for their assistance.
-
Marc almost 11 yearsNot at all . . . backing up is always a good idea, and you're not really messing with the boot partition very much, just uninstalling some packages with apt-get. It should be a piece of cake. I just suggested backing up your data because I always suggest backing up data if you're having a problem (or even if you're not!) I actually ran those commands on my own system to test them. It took me three minutes to remove
linux-headers-3.8.0-18
. -
pabouk - Ukraine stay strong almost 10 yearsI had the same problem caused by kernel updates which do not remove old kernels automatically. Linux headers of every kernel update occupy a considerable number of inodes! --- My "safe" solution was to move two kernel headers directories to a different filesystem:
cd /usr/src ; cp -a linux-headers-3.2.0-3{2,3}* /home/tmp-hdr ; rm -r linux-headers-3.2.0-3{2,3}*
,apt-get-install -f
, remove some other headers the right way:apt-get purge linux-headers-...
, move the headers from the tmp back:cd /usr/src ; cp -a /home/tmp-hdr/* .
. Remove more of the old kernels usingapt-get purge
. -
pabouk - Ukraine stay strong almost 10 yearsPlease consider participating on the bug reports with low activity: Bug #1089195 linux-headers will eat your inodes on LTS., Bug #690911 Installation without formatting fails to remove old kernels
-
jarno over 7 years@pabouk I wonder, if you could have used
dpkg --purge linux-headers-3.2.0-3{2,3}*; apt-get -f install
so that no copying was needed? -
pabouk - Ukraine stay strong over 7 years@jarno It was a long time about but I think that all the commands using the dpkg or apt database were failing. I think it was because of broken dependencies and other inconsistencies caused by insufficient number of inodes during an automatic upgrade.
-
XavierStuvw over 7 yearsIn my case apt-get refused to do autoremove giving precedence to the fact that there was a broken package to sort out. Which broken package had been caused by the inode saturation. See also this AskUbuntu thread
-
jarno about 7 yearsThe required disk cleanup could be done by
sudo linux-purge --fix
once the script is published. -
user5193682 almost 7 yearsWell, this just saved me! After an update my x session was never entering, just asking to log in again and I oft got the no space left message. I thought I had to format my hd, but your trick just saved me :)
-
Sam over 6 yearsIf it fails again for
sudo dpkg --remove linux-headers-3.8.0-18
, removesudo dpkg --remove linux-headers-3.8.0-18-generic
and it will take the other header with it. -
chefarov almost 6 yearsyou can't use
dpkg
if no space is left -
chefarov almost 6 yearsHow do you remove packages since
dpkg
won't work because of no space left? I think only pabouk's solution (manuallymv
cp
etc) is possible -
Brian Leishman over 5 yearsLol I can't run this because I have too many files...
-
Yasin Okumuş about 4 yearsOther solutions all gave me unsufficient space error. Surprizingly after clean I can get some space. Thanks
-
Adrian Zaugg about 3 yearspabouk's solution does work:
dpkg --purge <pkg>
does remove straight away, even if there is no space left on the device.