10

It seems /usr/src (apparently old kernels) used up all my inodes:

Filesystem             Inodes  IUsed     IFree IUse% Mounted on
/dev/sda4              489600   489600       0  100% /
devtmpfs               219658      539  219119    1% /dev
none                   219844      474  219370    1% /run
none                   219844        3  219841    1% /run/lock
none                   219844        8  219836    1% /run/shm
/dev/sda6             5963776     8361 5955415    1% /home

I tried everything to remove/purge, etc. the old kernels, without success. dpkg is not working anymore. I tried a few manual commands, but 12.04 gives me nothing. apt-get, etc. is not possible due to lack of space on the hard drive, which is not the problem obviously. However I cannot install or remove anything! I read a lot about users with the same problem, but their solutions are not working for me.

Please help. Thanks a lot!

  • Boot from a live cd/usb and run some filesystem checks. 'df -i' gives you inode usage. You can remove manually (or move to safe location) some files that are in the offending folders to free inodes. Then try again as per my answer to clean up. – hmayag Oct 21 '13 at 0:05
  • Try booting in single-user mode, that might give you more control. – labarna Oct 21 '13 at 13:30
  • @klingone - you appear to have multiple accounts. Please register one of these accounts. Then click the contact-us link at the bottom of this page to request that your other accounts are merged. Once done, you'll be able to re-edit your question with further details. Thanks. – fossfreedom Oct 21 '13 at 19:18
6

Try this.

Open a terminal and enter:

~$ cd /usr/src
/usr/src$ ls

You will see something like this:

total 16K
drwxr-xr-x 24 root root 4,0K Σεπ  29 22:35 linux-headers-3.2.0-54/
drwxr-xr-x  7 root root 4,0K Σεπ  29 22:35 linux-headers-3.2.0-54-generic/
drwxr-xr-x  3 root root 4,0K Σεπ  29 22:56 nvidia-319-319.32/

The output may (and will) differ according to your set up.

Take a close look at the folders named linux-headers-*. These are the headers from all your linux images that you have installed. If you have too many of them, they will take up A LOT of space and inodes. You only need to keep the latest one you boot from.

Let's say you have an older kernel, eg. 3.2.0-53. To remove it, type:

sudo apt-get remove --purge linux-image-3.2.0-53-generic linux-headers-3.2.0-53 linux-headers-3.2.0-53-generic

for each one of them.

If all of the above fail, then try to delete the OLDER KERNEL headers' folders manually:

sudo rm -rf /usr/src/linux-headers-3.2.0-53{,-generic}
2

You can try Ubuntu Tweak to clean old kernels. First install it using these commands

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak

Run the program and then:

  1. Select the "Janitor" tab
  2. Select the "Old Kernel" checkbox
  3. Select kernel versions to remove (keep 2 at leats - just in case)
  4. Press "Clean"

enter image description here

  • Hi there and thanks for the info. Used the command(s) above but failed to install, saying there is no space left on device. Also software center is damaged and wants to be repaired but is also unable to do that. Apt-get autoclean is not working and it is suggested to use command sudo dpkg --configure -a to solve the problem which leads me back to where I started since there is no more space on the device left.. What else could I try? I'm pretty sure it's the inodes in /usr/src due to almost 300.000 files from former kernels installed...thanks again for help. – klingone Oct 20 '13 at 22:12
0

Since the case involves a system with 100% HD usage, so, installing any application will not work. The only safe option is to delete unnecessary files first.

First in row would be temporary files

sudo rm -rf /tmp/*

Second, delete the cached applications. These are the binaries of applications and upgrades downloaded through the lifespan of the system. Normally this would be no less than 500 MB in an average Ubuntu system with one year of operation, and would give you a breather to install another apps.

sudo rm /var/cache/apt/archives/*deb

Then I would recommend deleting old log files

sudo rm /var/log/*gz

By this you would have at least free space of around 700 MB. This will allow you to work with utilities and install new ones.

Then I would install ncdu, which is a fast utility to scan the whole harddisk, and order directories by size. It is really fast, and works like a charm.

sudo apt-get install ncdu

then run it with the command

sudo ncdu /

The slash after ncdu is to scan from the root directory.

All the above works in ubuntu server as well as Desktop. Now, after doing all the above, and you are running on a Desktop environment, then , you can go for GUI utilities such as ubuntu-tweak (which is excellent by the way) and delete the old kernels. I usually keep the latest kernel, and the one before the latest, in case of upgrade failures.

Hope that this would help.

  • 100% usage of inodes does not mean the hard-drive is full of files. – woohoo Dec 1 '14 at 3:21
0

Another way is to search for the folders which are eating up your inode count. See here: Broken package after update: linux-headers, error: BrokenCount >0

This is the most important part:

In a terminal, cd to root to start:

# cd /

Then search for the folders eating up most inodes:

# for i in `ls -1A`; do echo "`find $i | sort -u | wc -l` $i"; done | sort -rn | head -20

And so on, you will be able to find the folders which heed removed or packages, kernel headers, images that need uninstalled.

0

I just had the same issue

On Ubuntu Linux 16.04.1 it seems that sudo apt autoremove will clean up all the unnecessary /usr/src/linux-headers- files and free the corresponding inodes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.