1

An old Ubuntu 10.04 server is complaining about unmet dependencies. When I run apt-get -f install I get back a "No space left on device" message:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-2.6.32-61-server linux-headers-2.6.32-56-server linux-headers-2.6.32-44-server
  linux-headers-2.6.32-65-server linux-headers-2.6.32-53-server linux-headers-2.6.32-48-server
  linux-headers-2.6.32-62-server linux-headers-2.6.32-57-server linux-headers-2.6.32-50-server
  linux-headers-2.6.32-45-server linux-headers-2.6.32-66-server linux-headers-2.6.32-54-server
  linux-headers-2.6.32-49-server linux-headers-2.6.32-43 linux-headers-2.6.32-44 linux-headers-2.6.32-50
  linux-headers-2.6.32-45 linux-headers-2.6.32-51 linux-headers-2.6.32-46 linux-headers-2.6.32-52 linux-headers-2.6.32-47
  linux-headers-2.6.32-53 linux-headers-2.6.32-48 linux-headers-2.6.32-54 linux-headers-2.6.32-49 linux-headers-2.6.32-60
  linux-headers-2.6.32-55 linux-headers-2.6.32-61 linux-headers-2.6.32-56 linux-headers-2.6.32-62 linux-headers-2.6.32-57
  linux-headers-2.6.32-58 linux-headers-2.6.32-64 linux-headers-2.6.32-65 linux-headers-2.6.32-66 linux-headers-2.6.32-67
  linux-headers-2.6.32-58-server linux-headers-2.6.32-51-server linux-headers-2.6.32-46-server
  linux-headers-2.6.32-67-server linux-headers-2.6.32-60-server linux-headers-2.6.32-55-server
  linux-headers-2.6.32-43-server linux-headers-2.6.32-64-server linux-headers-2.6.32-52-server
  linux-headers-2.6.32-47-server
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-headers-2.6.32-71 linux-headers-2.6.32-71-server
The following NEW packages will be installed:
  linux-headers-2.6.32-71 linux-headers-2.6.32-71-server
0 upgraded, 2 newly installed, 0 to remove and 43 not upgraded.
4 not fully installed or removed.
Need to get 0B/11.0MB of archives.
After this operation, 85.3MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 469386 files and directories currently installed.)
Unpacking linux-headers-2.6.32-71 (from .../linux-headers-2.6.32-71_2.6.32-71.138_all.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-headers-2.6.32-71_2.6.32-71.138_all.deb (--unpack):
 unable to create `/usr/src/linux-headers-2.6.32-71/arch/arm/include/asm/limits.h.dpkg-new' (while processing `./usr/src/linux-headers-2.6.32-71/arch/arm/include/asm/limits.h'): No space left on device
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: subprocess paste killed by signal (Broken pipe)
Unpacking linux-headers-2.6.32-71-server (from .../linux-headers-2.6.32-71-server_2.6.32-71.138_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-headers-2.6.32-71-server_2.6.32-71.138_amd64.deb (--unpack):
 unable to create `/usr/src/linux-headers-2.6.32-71-server/include/config/dummy/console.h.dpkg-new' (while processing `./usr/src/linux-headers-2.6.32-71-server/include/config/dummy/console.h'): No space left on device
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-headers-2.6.32-71_2.6.32-71.138_all.deb
 /var/cache/apt/archives/linux-headers-2.6.32-71-server_2.6.32-71.138_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

In fact the systems seems to have run out of Inodes:

$ df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda1             498736  493560    5176   99% /
none                   62559     587   61972    1% /dev
none                   63152       1   63151    1% /dev/shm
none                   63152      23   63129    1% /var/run
none                   63152       3   63149    1% /var/lock
none                   63152       1   63151    1% /lib/init/rw
none                  498736  493560    5176   99% /var/lib/ureadahead/debugfs

After some digging I found an excessive number of files in /usr/src:

$ sudo find /usr/src -type f | wc -l
317741

These are all contents of linux-headers-* packages:

$ ls -la /usr/src
total 192
drwxrwsr-x 48 root src  4096 2015-01-20 15:15 .
drwxr-xr-x 10 root root 4096 2011-03-02 17:11 ..
drwxr-xr-x 24 root root 4096 2012-09-26 11:33 linux-headers-2.6.32-43
drwxr-xr-x  7 root root 4096 2012-09-26 11:33 linux-headers-2.6.32-43-server
drwxr-xr-x 24 root root 4096 2012-10-12 06:38 linux-headers-2.6.32-44
drwxr-xr-x  7 root root 4096 2012-10-12 06:39 linux-headers-2.6.32-44-server
drwxr-xr-x 24 root root 4096 2013-02-22 06:51 linux-headers-2.6.32-45
drwxr-xr-x  7 root root 4096 2013-02-22 06:52 linux-headers-2.6.32-45-server
drwxr-xr-x 24 root root 4096 2013-04-19 06:30 linux-headers-2.6.32-46
drwxr-xr-x  7 root root 4096 2013-04-19 06:30 linux-headers-2.6.32-46-server
drwxr-xr-x 24 root root 4096 2013-05-15 06:42 linux-headers-2.6.32-47
drwxr-xr-x  7 root root 4096 2013-05-15 06:42 linux-headers-2.6.32-47-server
drwxr-xr-x 24 root root 4096 2013-06-14 06:34 linux-headers-2.6.32-48
drwxr-xr-x  7 root root 4096 2013-06-14 06:34 linux-headers-2.6.32-48-server
drwxr-xr-x 24 root root 4096 2013-07-04 06:39 linux-headers-2.6.32-49
drwxr-xr-x  7 root root 4096 2013-07-04 06:39 linux-headers-2.6.32-49-server
drwxr-xr-x 24 root root 4096 2013-07-30 06:29 linux-headers-2.6.32-50
drwxr-xr-x  7 root root 4096 2013-07-30 06:29 linux-headers-2.6.32-50-server
drwxr-xr-x 24 root root 4096 2013-09-07 06:28 linux-headers-2.6.32-51
drwxr-xr-x  7 root root 4096 2013-09-07 06:28 linux-headers-2.6.32-51-server
drwxr-xr-x 24 root root 4096 2013-09-30 06:41 linux-headers-2.6.32-52
drwxr-xr-x  7 root root 4096 2013-09-30 06:41 linux-headers-2.6.32-52-server
drwxr-xr-x 24 root root 4096 2013-11-08 06:46 linux-headers-2.6.32-53
drwxr-xr-x  7 root root 4096 2013-11-08 06:46 linux-headers-2.6.32-53-server
drwxr-xr-x 24 root root 4096 2013-12-03 06:47 linux-headers-2.6.32-54
drwxr-xr-x  7 root root 4096 2013-12-03 06:47 linux-headers-2.6.32-54-server
drwxr-xr-x 24 root root 4096 2014-01-03 06:47 linux-headers-2.6.32-55
drwxr-xr-x  7 root root 4096 2014-01-03 06:47 linux-headers-2.6.32-55-server
drwxr-xr-x 24 root root 4096 2014-02-19 06:40 linux-headers-2.6.32-56
drwxr-xr-x  7 root root 4096 2014-02-19 06:40 linux-headers-2.6.32-56-server
drwxr-xr-x 24 root root 4096 2014-03-05 06:34 linux-headers-2.6.32-57
drwxr-xr-x  7 root root 4096 2014-03-05 06:34 linux-headers-2.6.32-57-server
drwxr-xr-x 24 root root 4096 2014-05-06 06:45 linux-headers-2.6.32-58
drwxr-xr-x  7 root root 4096 2014-05-06 06:46 linux-headers-2.6.32-58-server
drwxr-xr-x 24 root root 4096 2014-05-27 06:54 linux-headers-2.6.32-60
drwxr-xr-x  7 root root 4096 2014-05-27 06:54 linux-headers-2.6.32-60-server
drwxr-xr-x 24 root root 4096 2014-06-06 06:47 linux-headers-2.6.32-61
drwxr-xr-x  7 root root 4096 2014-06-06 06:47 linux-headers-2.6.32-61-server
drwxr-xr-x 24 root root 4096 2014-07-06 06:28 linux-headers-2.6.32-62
drwxr-xr-x  7 root root 4096 2014-07-06 06:28 linux-headers-2.6.32-62-server
drwxr-xr-x 24 root root 4096 2014-07-18 06:29 linux-headers-2.6.32-64
drwxr-xr-x  7 root root 4096 2014-07-18 06:29 linux-headers-2.6.32-64-server
drwxr-xr-x 24 root root 4096 2014-08-29 06:49 linux-headers-2.6.32-65
drwxr-xr-x  7 root root 4096 2014-08-29 06:49 linux-headers-2.6.32-65-server
drwxr-xr-x 24 root root 4096 2014-09-23 06:40 linux-headers-2.6.32-66
drwxr-xr-x  7 root root 4096 2014-09-23 06:40 linux-headers-2.6.32-66-server
drwxr-xr-x 24 root root 4096 2014-10-09 06:48 linux-headers-2.6.32-67
drwxr-xr-x  7 root root 4096 2014-10-09 06:48 linux-headers-2.6.32-67-server

But If I request their removal:

$ sudo apt-get autoremove
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-virtual: Depends: linux-headers-2.6.32-71-server but it is not installed or
                                  linux-headers-2.6.32-71-generic-pae but it is not installable
E: Unmet dependencies. Try using -f.

Or removing a specific package:

$ sudo apt-get remove linux-headers-2.6.32-43
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-2.6.32-43-server: Depends: linux-headers-2.6.32-43 but it is not going to be installed
  linux-headers-virtual: Depends: linux-headers-2.6.32-71-server but it is not going to be installed or
                                  linux-headers-2.6.32-71-generic-pae but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Which brings me back to square one. How do I break this cycle? How can I remove these old files so that apt-get can do its job?

Update: psusi suggests the direct removal of these packages with dpkg. Here's the result:

$ sudo dpkg -r linux-headers-2.6.32-43
dpkg: dependency problems prevent removal of linux-headers-2.6.32-43:
 linux-headers-2.6.32-43-server depends on linux-headers-2.6.32-43.
dpkg: error processing linux-headers-2.6.32-43 (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 linux-headers-2.6.32-43
  • What happens when you remove that virtual package? – muru Jan 20 '15 at 15:03
  • try to remove linux-headers-virtual first using sudo apt-get remove linux-headers-virtual followed by sudo apt-get remove linux-headers-2.6.32-43-server followed by sudo apt-get remove linux-headers-2.6.32-43`. – g_p Jan 20 '15 at 16:55
3

apt-get insists on fixing any broken packages before doing anything else. Use dpkg -r pkgname to remove the packages directly instead. After clearing those out, the run apt-get install -f to fix the broken packages.

| improve this answer | |
  • I get a "dependency problems" error message. Please check the update to the question for details. – Luís de Sousa Jan 20 '15 at 15:55
  • 1
    @LuísdeSousa, add the package that depends on that one to the list to be removed, prior to that one. i.e. dpkg -r linux-headers-2.6.32-43-server linux-headers-2.6.32-43 – psusi Jan 20 '15 at 16:15
  • Indeed, this breaks the cycle and solves all the other issues. You might wish to expand your answer with your latest comment. – Luís de Sousa Jan 22 '15 at 7:56

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.