Ubuntu – Errors encountered (by APT/dpkg) while processing linux-image-* packages

aptdpkgpackage-management

sudo apt-get upgrade returns:

Errors were encountered while processing:
 linux-image-4.8.0-39-generic
 linux-image-4.8.0-41-generic
 linux-image-generic
 linux-firmware
 linux-signed-image-4.8.0-39-generic
 linux-image-extra-4.8.0-39-generic
 linux-image-4.8.0-37-generic
 linux-image-extra-4.8.0-37-generic
 linux-signed-image-4.8.0-41-generic
 linux-signed-image-4.8.0-37-generic
 linux-signed-image-generic
 linux-image-extra-4.8.0-41-generic
 linux-generic
 linux-signed-generic
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

I saw the related questions but their errors were a little different. I don't know if that's significant.

Best Answer

  • For me these two lines helped! Just remove all the linux-extra and linux-extra-image files, which are problematic and old.

    For each package:

    sudo mv /var/lib/dpkg/info/<PACKAGE-NAME>.* /tmp/
    

    Then:

    sudo apt-get autoremove && sudo apt-get autoclean
    

    Then install/update the latest linux image file

    sudo apt-get install linux-generic