apt-get incapaz de autoremove pacotes preenchendo Inodes

1

Um antigo servidor Ubuntu 10.04 está reclamando sobre dependências não atendidas. Quando executo o apt-get -f install , recebo uma mensagem "Não há espaço disponível no dispositivo":

$ 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)

Na verdade, os sistemas parecem ter ficado sem 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

Depois de algumas pesquisas, encontrei um número excessivo de arquivos em /usr/src :

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

Estes são todos os conteúdos de 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

Mas se eu solicitar a remoção deles:

$ 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.

Ou removendo um pacote específico:

$ 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).

O que me traz de volta à estaca zero. Como eu quebro esse ciclo? Como posso remover esses arquivos antigos para que apt-get possa fazer seu trabalho?

Atualização : psusi sugere a remoção direta desses pacotes com dpkg . Aqui está o resultado:

$ 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
    
por Luís de Sousa 20.01.2015 / 15:56

1 resposta

3

apt-get insiste em corrigir qualquer pacote corrompido antes de fazer qualquer outra coisa. Use dpkg -r pkgname para remover os pacotes diretamente. Depois de limpá-los, execute apt-get install -f para corrigir os pacotes quebrados.

    
por psusi 20.01.2015 / 16:14