6

I was trying to update my packages today:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-headers-3.16.0-44-generic : Depends: linux-headers-3.16.0-44 but it is not installed
E: Unmet dependencies. Try using -f.

So, I went ahead and tried apt-get -f install:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-headers-3.16.0-44
The following NEW packages will be installed:
  linux-headers-3.16.0-44
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
3 not fully installed or removed.
Need to get 0 B/9,101 kB of archives.
After this operation, 64.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 688666 files and directories currently installed.)
Preparing to unpack .../linux-headers-3.16.0-44_3.16.0-44.59_all.deb ...
Unpacking linux-headers-3.16.0-44 (3.16.0-44.59) ...
dpkg: error processing archive /var/cache/apt/archives/linux-headers-3.16.0-44_3.16.0-44.59_all.deb (--unpack):
 unable to create `/usr/src/linux-headers-3.16.0-44/scripts/genksyms/Makefile.dpkg-new' (while processing `./usr/src/linux-headers-3.16.0-44/scripts/genksyms/Makefile'): No space left on device
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-headers-3.16.0-44_3.16.0-44.59_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

It's complaining saying No space left on device. df -Th tells me that there's sufficient space:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda6       3.3G  2.5G  571M  82% /
udev            2.0G     0  2.0G   0% /dev
tmpfs           395M   11M  384M   3% /run
tmpfs           2.0G   28M  1.9G   2% /dev/shm
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs           100M   72K  100M   1% /run/user
tmpfs           5.0M  8.0K  5.0M   1% /run/lock
/dev/sda7       9.3G  7.6G  1.3G  87% /usr
/dev/sda8       188G  176G  3.0G  99% /home
/dev/sda1       945M  394M  487M  45% /boot
/dev/sda9       256G  9.6G  233G   4% /var

However, df -i tells me /usr has used up all the inodes.

These are the dirs and their inode usage:

/usr/bin = 2846
/usr/etc = 1
/usr/games = 8
/usr/include = 3204
/usr/lib = 42317
/usr/local = 105
/usr/lost+found = 1
/usr/sbin = 306
/usr/share = 228141
/usr/src = 348704

So, if I can clear out /usr/src (which contains the current and old kernels), I can probably resolve the issue. But, I keep running into the first error:

$ sudo apt-get purge linux-image-3.8.0-35-generic 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-headers-3.16.0-44-generic : Depends: linux-headers-3.16.0-44 but it is not going to be installed
 linux-image-extra-3.8.0-35-generic : Depends: linux-image-3.8.0-35-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Any suggestions on how I can remove my old kernels? Thanks!

3
  • Do you have /usr on a separate partition? Could you please post the output of df -h? The reason I ask is that most of the times your issue happens is when /boot is full. See here for that.
    – NZD
    Jul 26, 2015 at 5:57
  • @NZD, I have 487mb in /boot. I just added the output of df -h to my post. I don't think /boot is the issue.
    – Housni
    Jul 26, 2015 at 11:54
  • There seems to be enough space on /usr. One way of freeing up inodes is to copy a number of directories to another partition (/var seems to have a lot GBs left), rename the copied directories on /usr, then create links on /usr to the copied directories on /var to restore your system. After that you can delete the renamed directories from /usr. I've done that before with /var and that worked fine.
    – NZD
    Jul 26, 2015 at 19:35

1 Answer 1

6

I was running out of options and time so I tried this and it worked:

I figured out what kernel I was using:

$ uname -r
3.16.0-44-generic

I decided to move the really old kernels to my external storage:

sudo mv linux-headers-3.8* /media/housni/linux-headers

df -i then showed that a significant amount of inodes have been freed so I quickly uninstalled the headers I knew I wouldn't need:

sudo apt-get purge linux-headers-3.8*

After which, I updated grub and rebooted

sudo update-grub2 && sudo shutdown now -r

I then did some extra clean up like cleaning up my cache (sudo apt-get clean) and running autoremove (sudo apt-get autoremove) just to be safe and now everything seems to be back to normal :)

2
  • Any alternate way than external storage? Got a server image that is full - no physical access. Would it be possible to manually delete the oldest image to free up some inodes?
    – thomthom
    Apr 11, 2017 at 13:15
  • If they are not in use, you can delete them. Delete as few as possible, fix the issue and then clean out the rest. Maybe move it to /var/ or /tmp where you probably have a bit of free space.
    – Housni
    Apr 11, 2017 at 17:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .