A instalação de um pacote funciona, mas depois tenho que esperar 10 minutos por vários erros “dpkg: error processing linux-headers…”

2

Sempre que eu tento o apt-get instalar algo ou uso o Gerenciador de Pacotes Synaptic para instalar / desinstalar algo, eu tenho que esperar por > 10 minutos e o seguinte relatório é gerado:

(Reading database ... 146959 files and directories currently installed.)
Removing multitail ...
Processing triggers for man-db ...

Setting up linux-image-2.6.32-41-generic (2.6.32-41.94) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-41-generic
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-45-generic
Found initrd image: /boot/initrd.img-2.6.32-45-generic
Found linux image: /boot/vmlinuz-2.6.32-43-generic
Found initrd image: /boot/initrd.img-2.6.32-43-generic
Found linux image: /boot/vmlinuz-2.6.32-42-generic
Found initrd image: /boot/initrd.img-2.6.32-42-generic
Found linux image: /boot/vmlinuz-2.6.32-41-generic
Found initrd image: /boot/initrd.img-2.6.32-41-generic
Found linux image: /boot/vmlinuz-2.6.32-21-generic
Found initrd image: /boot/initrd.img-2.6.32-21-generic
Found memtest86+ image: /boot/memtest86+.bin
done
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 2.6.32-41-generic /boot/vmlinuz-2.6.32-41-generic
run-parts: failed to exec /etc/kernel/postinst.d/dkms: Exec format error
run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-41-generic.postinst line 1003.
dpkg: error processing linux-image-2.6.32-41-generic (--configure):
 subprocess installed post-installation script returned error exit status 2

Setting up linux-image-2.6.32-42-generic (2.6.32-42.96) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-42-generic
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-45-generic
Found initrd image: /boot/initrd.img-2.6.32-45-generic
Found linux image: /boot/vmlinuz-2.6.32-43-generic
Found initrd image: /boot/initrd.img-2.6.32-43-generic
Found linux image: /boot/vmlinuz-2.6.32-42-generic
Found initrd image: /boot/initrd.img-2.6.32-42-generic
Found linux image: /boot/vmlinuz-2.6.32-41-generic
Found initrd image: /boot/initrd.img-2.6.32-41-generic
Found linux image: /boot/vmlinuz-2.6.32-21-generic
Found initrd image: /boot/initrd.img-2.6.32-21-generic
Found memtest86+ image: /boot/memtest86+.bin
done
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 2.6.32-42-generic /boot/vmlinuz-2.6.32-42-generic
run-parts: failed to exec /etc/kernel/postinst.d/dkms: Exec format error
run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-42-generic.postinst line 1003.
dpkg: error processing linux-image-2.6.32-42-generic (--configure):
 subprocess installed post-installation script returned error exit status 2

Setting up linux-image-2.6.32-43-generic (2.6.32-43.97) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-43-generic
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-45-generic
Found initrd image: /boot/initrd.img-2.6.32-45-generic
Found linux image: /boot/vmlinuz-2.6.32-43-generic
Found initrd image: /boot/initrd.img-2.6.32-43-generic
Found linux image: /boot/vmlinuz-2.6.32-42-generic
Found initrd image: /boot/initrd.img-2.6.32-42-generic
Found linux image: /boot/vmlinuz-2.6.32-41-generic
Found initrd image: /boot/initrd.img-2.6.32-41-generic
Found linux image: /boot/vmlinuz-2.6.32-21-generic
Found initrd image: /boot/initrd.img-2.6.32-21-generic
Found memtest86+ image: /boot/memtest86+.bin
done
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 2.6.32-43-generic /boot/vmlinuz-2.6.32-43-generic
run-parts: failed to exec /etc/kernel/postinst.d/dkms: Exec format error
run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-43-generic.postinst line 1003.
dpkg: error processing linux-image-2.6.32-43-generic (--configure):
 subprocess installed post-installation script returned error exit status 2

Setting up linux-image-2.6.32-45-generic (2.6.32-45.102) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-45-generic

Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-45-generic
Found initrd image: /boot/initrd.img-2.6.32-45-generic
Found linux image: /boot/vmlinuz-2.6.32-43-generic
Found initrd image: /boot/initrd.img-2.6.32-43-generic
Found linux image: /boot/vmlinuz-2.6.32-42-generic
Found initrd image: /boot/initrd.img-2.6.32-42-generic
Found linux image: /boot/vmlinuz-2.6.32-41-generic
Found initrd image: /boot/initrd.img-2.6.32-41-generic
Found linux image: /boot/vmlinuz-2.6.32-21-generic
Found initrd image: /boot/initrd.img-2.6.32-21-generic
Found memtest86+ image: /boot/memtest86+.bin
done
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 2.6.32-45-generic /boot/vmlinuz-2.6.32-45-generic
run-parts: failed to exec /etc/kernel/postinst.d/dkms: Exec format error
run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-45-generic.postinst line 1003.
dpkg: error processing linux-image-2.6.32-45-generic (--configure):
 subprocess installed post-installation script returned error exit status 2

dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-2.6.32-45-generic; however:
  Package linux-image-2.6.32-45-generic is not configured yet.
dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 2.6.32.45.52); however:
  Package linux-image-generic is not configured yet.
dpkg: error processing linux-generic (--configure):
 dependency problems - leaving unconfigured
Setting up linux-headers-2.6.32-45-generic (2.6.32-45.102) ...

No apport report written because MaxReports has already been reached
No apport report written because MaxReports has already been reached
No apport report written because MaxReports has already been reached

Examining /etc/kernel/header_postinst.d.

run-parts: executing /etc/kernel/header_postinst.d/dkms 2.6.32-45-generic /boot/vmlinuz-2.6.32-45-generic
run-parts: failed to exec /etc/kernel/header_postinst.d/dkms: Exec format error
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 1

Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-2.6.32-45-generic.postinst line 110.

dpkg: error processing linux-headers-2.6.32-45-generic (--configure):
 subprocess installed post-installation script returned error exit status 2

dpkg: dependency problems prevent configuration of linux-headers-generic:
 linux-headers-generic depends on linux-headers-2.6.32-45-generic; however:
  Package linux-headers-2.6.32-45-generic is not configured yet.

dpkg: error processing linux-headers-generic (--configure):
 dependency problems - leaving unconfigured

No apport report written because MaxReports has already been reached
No apport report written because MaxReports has already been reached

Errors were encountered while processing:
 linux-image-2.6.32-41-generic
 linux-image-2.6.32-42-generic
 linux-image-2.6.32-43-generic
 linux-image-2.6.32-45-generic
 linux-image-generic
 linux-generic
 linux-headers-2.6.32-45-generic
 linux-headers-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Há um grande atraso sempre que essa linha é exibida:

update-initramfs: Generating /boot/initrd.img-2.6.32-XXX-generic

... onde XXX no meu caso leva valores de 41 a 45.

Meus relatórios uname -srv :

Linux 2.6.32-45-generic #102-Ubuntu SMP Wed Jan 2 21:53:06 UTC 2013

Eu tentei sudo apt-get install -f , mas isso não resolveu meu problema.

Não sei se isso ajuda, mas a caixa de diálogo final que o gerenciador de pacotes Synaptic mostra sempre que um pacote é removido ou adicionado é:

E: linux-image-2.6.32-41-generic: subprocess installed post-installation script     returned error exit status 2
E: linux-image-2.6.32-42-generic: subprocess installed post-installation script     returned error exit status 2
E: linux-image-2.6.32-43-generic: subprocess installed post-installation script returned error exit status 2
E: linux-image-2.6.32-45-generic: subprocess installed post-installation script returned error exit status 2
E: linux-image-generic: dependency problems - leaving unconfigured
E: linux-generic: dependency problems - leaving unconfigured
E: linux-headers-2.6.32-45-generic: subprocess installed post-installation script     returned error exit status 2
E: linux-headers-generic: dependency problems - leaving unconfigured

Ah, e estou no Ubuntu 10.04LTS.

@Wolfer: O comando gera o seguinte:

> dpkg -l | grep linux-header
ii  linux-headers-2.6.32-45              2.6.32-45.102                                       Header files related to Linux kernel version
iF  linux-headers-2.6.32-45-generic      2.6.32-45.102                                   Linux kernel headers for version 2.6.32 on x
iU  linux-headers-generic                2.6.32.45.52                                    Generic Linux kernel headers

Eu não sou um usuário avançado (ainda? :)) Esta VM me foi dada do trabalho e eu estava simplesmente tentando "arrumar" / personalizar. Não tem idéia de quando isso foi criado (ano atrás? Talvez mais?).

dpkg -l | grep linux-image informa o seguinte:

> dpkg -l | grep linux-image
pi  linux-image-2.6.32-21-generic        2.6.32-21.32       Linux kernel image for version 2.6.32 on x86
iF  linux-image-2.6.32-41-generic        2.6.32-41.94       Linux kernel image for version 2.6.32 on x86
iF  linux-image-2.6.32-42-generic        2.6.32-42.96       Linux kernel image for version 2.6.32 on x86
iF  linux-image-2.6.32-43-generic        2.6.32-43.97       Linux kernel image for version 2.6.32 on x86
iF  linux-image-2.6.32-45-generic        2.6.32-45.102      Linux kernel image for version 2.6.32 on x86
iU  linux-image-generic                  2.6.32.45.52       Generic Linux kernel image

@Wolfer: apt-get install linux-generic me dá:

[sudo] password for ubuntu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.
8 not fully installed or removed.
After this operation, 0B of additional disk space will be used.

... e depois a mesma coisa novamente, começa com:

Setting up linux-image-2.6.32-41-generic (2.6.32-41.94) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-41-generic
... and on and on ...
    
por Angelos 28.01.2013 / 18:44

2 respostas

1

O linux-image-generic não está configurado corretamente no seu sistema. Isso significa que o apt não poderá instalar / atualizar / configurar outros kernels também. Isso resulta no erro que você está recebendo. Existem algumas maneiras de lidar com isso; o mais fácil seria executar apt-get install linux-image-generic e ver o que acontece. Se isso funcionar (acho que deveria), siga-o executando apt-get install -f .

Se você receber mais erros no processo, poste-os aqui.

Ok, parece que o caminho mais fácil não funcionará. Tente executar dpkg --unpack linux-image-generic . Se você receber um erro sobre isso, não existe esse pacote (o que é provável) executado

wget http://ubuntu.secsup.org//pool/main/l/linux-meta/linux-image-generic_2.6.32.45.52_i386.deb e, em seguida, dpkg -i <path to the package you downloaded> . Se houver algum erro, poste aqui.

Você se deparou com um problema de cadeia de dependência. Você pode resolver isso baixando manualmente e tentando instalar todos os pacotes mencionados nos erros que você recebe. Eventualmente você deve encontrar a raiz do problema e isso deve fazer com que todos os outros pacotes sejam corrigidos também.

    
por Wolfer 29.01.2013 / 18:26
0

A mensagem de erro

Failed to process /etc/kernel/postinst.d at
/var/lib/dpkg/info/linux-image-2.6.32-41-generic.postinst line 1003.

parece sugerir que o problema é um dos scripts no diretório /etc/kernel/postinst.d . O código que tenta executar os scripts nesse diretório lê algo ao longo das linhas (no arquivo /var/lib/dpkg/info/linux-image-2.6.32-41-generic.postinst ):

if (-d "/etc/kernel/postinst.d") {
  print STDERR "Examining /etc/kernel/postinst.d.\n";
  system ("run-parts --verbose --exit-on-error --arg=$version " .
          "--arg=$realimageloc$kimage-$version " .
          "/etc/kernel/postinst.d") &&
            die "Failed to process /etc/kernel/postinst.d";
}

Vendo algumas das linhas antes da mensagem de erro acima, você pode descobrir que o culpado é o pacote dkms :

Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 2.6.32-41-generic /boot/vmlinuz-2.6.32-41-generic
run-parts: failed to exec /etc/kernel/postinst.d/dkms: Exec format error
run-parts: /etc/kernel/postinst.d/dkms exited with return code 1

O Exec format error sugere que o arquivo /etc/kernel/postinst.d/dkms está tentando executar um binário compilado para um arco de CPU incorreto (por exemplo, você tem um host de 32 bits e está tentando executar um arquivo binário de 64 bits). O erro Exec format error significa que o kernel não é capaz de descobrir como um executável (qualquer arquivo com o conjunto de bits executável) deve ser executado.

Na minha experiência, se dkms estiver causando problemas, a correção correta será sudo apt-get purge dkms && sudo apt-get install dkms . Ou seja, remover totalmente dkms do sistema e reinstalá-lo novamente.

    
por Mikko Rantalainen 10.06.2015 / 15:28