Ubuntu 16.04 pacotes quebrados do kernel não me permitem instalar ou remover nada com o apt-get

9

Sempre que tento fazer alguma coisa com o apt-get, seja instalando, removendo, limpando, atualizando, atualizo, eu sempre sou atingido com o mesmo erro.

ses@ses-VirtualBox:~/Downloads$ sudo apt-get install ssh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-45 linux-headers-4.4.0-45-generic linux-image-4.4.0-45-generic linux-image-extra-4.4.0-45-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  ncurses-term openssh-server openssh-sftp-server ssh-import-id
Suggested packages:
  ssh-askpass rssh molly-guard monkeysphere
The following packages will be REMOVED:
  linux-image-extra-4.4.0-38-generic linux-image-extra-4.4.0-42-generic
The following NEW packages will be installed:
  ncurses-term openssh-server openssh-sftp-server ssh ssh-import-id
0 upgraded, 5 newly installed, 2 to remove and 0 not upgraded.
10 not fully installed or removed.
Need to get 0 B/643 kB of archives.
After this operation, 320 MB disk space will be freed.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 308434 files and directories currently installed.)
Removing linux-image-extra-4.4.0-38-generic (4.4.0-38.57) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/vboxadd 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: failed to exec /etc/kernel/postinst.d/vboxadd: Exec format error
run-parts: /etc/kernel/postinst.d/vboxadd exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-38-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-42-generic (4.4.0-42.62) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/vboxadd 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: failed to exec /etc/kernel/postinst.d/vboxadd: Exec format error
run-parts: /etc/kernel/postinst.d/vboxadd exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-42-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.4.0-38-generic
 linux-image-extra-4.4.0-42-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Eu tentei seguir essa pergunta, mas sem sorte: O Apt não consegue remover parcialmente instalado kernel e não pode instalar nenhum outro pacote

checando o arquivo de status do dpkg eu vejo que ambos os pacotes estão meio instalados

Package: linux-image-extra-4.4.0-38-generic
Status: deinstall ok half-installed
Priority: optional
Section: kernel
Installed-Size: 158607
Maintainer: Ubuntu Kernel Team <[email protected]>
Architecture: amd64
Source: linux
Version: 4.4.0-38.57
Depends: linux-image-4.4.0-38-generic, crda | wireless-crda
Description: Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 This package contains the Linux kernel extra modules for version 4.4.0 on
 64 bit x86 SMP.
 .
 Also includes the corresponding System.map file, the modules built by the
 packager, and scripts that try to ensure that the system is not left in an
 unbootable state after an update.
 .
 Supports Generic processors.
 .
 Geared toward desktop and server systems.
 .
 You likely do not want to install this package directly. Instead, install
 the linux-generic meta-package, which will ensure that upgrades work
 correctly, and that supporting packages are also installed.

** Edições

após remover os pacotes do kernel manualmente por instruções do user.dz paste.ubuntu.com/23487716

enquanto isso durante o sudo apt-get install -f O Ubuntu me alertou sobre um erro no sistema

    
por dses 16.11.2016 / 14:33

1 resposta

9

Nota: Como o ChaiT.Rex comentou abaixo, apenas os passos 4 & amp; 5 são necessários para corrigir o problema.

Deixo os passos 1,2 e 3 documentados para qualquer pessoa que possa precisar remover manualmente alguns pacotes. Mas tente primeiro este link que parece mais fácil.

  1. Remova-os manualmente, tenha cuidado se estiver redigitando os comandos abaixo rm -rf é um comando perigoso quando é executado como root.

    sudo rm -rf /lib/modules/4.4.0-38-generic /lib/modules/4.4.0-42-generic
    sudo rm -rf /usr/share/doc/linux-image-extra-4.4.0-38-generic /usr/share/doc/linux-image-extra-4.4.0-42-generic
    sudo rm /var/lib/dpkg/info/linux-image-extra-4.4.0-38-generic* /var/lib/dpkg/info/linux-image-extra-4.4.0-42-generic*
    
  2. Altere seu status no arquivo de status do dpkg.

    Faça backup apenas no caso

    sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.backup0
    

    Encontre as entradas relacionadas (comando com saída esperada, o número da linha será diferente):

    ~$ grep -n -e "linux-image-extra-4.4.0-38-generic" -e "linux-image-extra-4.4.0-42-generic" /var/lib/dpkg/status
    18488:Package: linux-image-extra-4.4.0-42-generic
    77123:Package: linux-image-extra-4.4.0-38-generic
    

    Abra o arquivo de status para edição e altere o status do pacote:

    sudo nano +18488 /var/lib/dpkg/status
    

    de:

    Package: linux-image-extra-4.4.0-38-generic
    Status: install ok installed
    

    para:

    Package: linux-image-extra-4.4.0-38-generic
    Status: deinstall ok config-files
    

    Ctrl + o para salvar. Ctrl + x para sair.

    Faça as mesmas alterações no linux-image-extra-4.4.0-42-generic.

  3. Remova manualmente o linux-image-4.4.0-38-generic & amp; linux-image-4.4.0-42-generic também

    sudo rm -f *4.4.0-38-generic *4.4.0-42-generic
    sudo rm -rf /usr/share/doc/linux-image-4.4.0-38-generic /usr/share/doc/linux-image-4.4.0-42-generic
    

    O mesmo que antes, edite seu status para deinstall ok config-files

    $ grep -n -e "Package: linux-image-4.4.0-38-generic" -e "Package: linux-image-4.4.0-42-generic" /var/lib/dpkg/status
    61217:Package: linux-image-4.4.0-38-generic
    98051:Package: linux-image-4.4.0-42-generic
    
  4. Remover esse arquivo problembox virtualbox

    sudo rm /etc/kernel/postinst.d/vboxadd
    
  5. Atualize o status do dpkg & amp; menu grub

    sudo dpkg --audit
    sudo apt-get install -f
    sudo update-grub
    
por user.dz 16.11.2016 / 15:43