apt & dpkg estão quebrados, correções comuns não funcionam

3

Quando tento usar o comando apt , ele gera erros.

Por exemplo, executando:

sudo apt-get autoremove

resulta nesta parede de mensagens de erro:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.4.0-45-generic linux-image-extra-4.4.0-45-generic linux-image-extra-4.4.0-51-generic
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 379 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 384651 files and directories currently installed.)
Removing linux-image-extra-4.4.0-45-generic (4.4.0-45.66) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-45-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-45-generic
WARNING: missing /lib/modules/4.4.0-45-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-45-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_vrF46u/lib/modules/4.4.0-45-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_vrF46u/lib/modules/4.4.0-45-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-51-generic
Found initrd image: /boot/initrd.img-4.4.0-51-generic
Found linux image: /boot/vmlinuz-4.4.0-47-generic
Found initrd image: /boot/initrd.img-4.4.0-47-generic
usage: paste [-h]
paste: error: unrecognized arguments: -s -d  
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2
dpkg: error processing package linux-image-extra-4.4.0-45-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.4.0-45-generic (4.4.0-45.66) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-45-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-51-generic
Found initrd image: /boot/initrd.img-4.4.0-51-generic
Found linux image: /boot/vmlinuz-4.4.0-47-generic
Found initrd image: /boot/initrd.img-4.4.0-47-generic
usage: paste [-h]
paste: error: unrecognized arguments: -s -d  
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-45-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-45-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-51-generic (4.4.0-51.72) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-51-generic
Found initrd image: /boot/initrd.img-4.4.0-51-generic
Found linux image: /boot/vmlinuz-4.4.0-47-generic
Found initrd image: /boot/initrd.img-4.4.0-47-generic
usage: paste [-h]
paste: error: unrecognized arguments: -s -d  
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2
dpkg: error processing package linux-image-extra-4.4.0-51-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.4.0-45-generic
 linux-image-4.4.0-45-generic
 linux-image-extra-4.4.0-51-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Eu tentei rodar

  • sudo apt-get -f install
  • sudo dpkg --configure -a
  • sudo apt autoremove
  • sudo apt full-upgrade

e eu tenho um erro semelhante ou igual para todos eles. O único que tem um erro diferente é o comando sudo dpkg --configure -a , que resulta em

Setting up linux-image-4.4.0-51-generic (4.4.0-51.72) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
initrd.img(/boot/initrd.img-4.4.0-51-generic
) points to /boot/initrd.img-4.4.0-51-generic
 (/boot/initrd.img-4.4.0-51-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-4.4.0-51-generic.postinst line 491.
vmlinuz(/boot/vmlinuz-4.4.0-51-generic
) points to /boot/vmlinuz-4.4.0-51-generic
 (/boot/vmlinuz-4.4.0-51-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-4.4.0-51-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-51-generic /boot/vmlinuz-4.4.0-51-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-51-generic
Found initrd image: /boot/initrd.img-4.4.0-51-generic
Found linux image: /boot/vmlinuz-4.4.0-47-generic
Found initrd image: /boot/initrd.img-4.4.0-47-generic
usage: paste [-h]
paste: error: unrecognized arguments: -s -d  
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-4.4.0-51-generic.postinst line 1052.
dpkg: error processing package linux-image-4.4.0-51-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-signed-image-4.4.0-51-generic:
 linux-signed-image-4.4.0-51-generic depends on linux-image-4.4.0-51-generic (= 4.4.0-51.72); however:
  Package linux-image-4.4.0-51-generic is not configured yet.

dpkg: error processing package linux-signed-image-4.4.0-51-generic (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-4.4.0-51-generic
 linux-signed-image-4.4.0-51-generic

Para fins de referência, a saída de uname -a é:

Linux ubuntu 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Existe alguma maneira de salvar o sistema de pacotes?

    
por yeedle 02.12.2016 / 19:56

0 respostas