Following instructions to migrate from Wheezy to Jessie, I updated my sources, apt-get update;apt-get upgrade;apt-get dist-upgrade (not all at once, but enough to check that everything was fine), and rebooted my VPS.

I started working on switching from php5 to php7, removing php packages, and suddenly I get to the point where this starts happening, through every apt:

The following packages will be REMOVED:
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 104 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 33495 files and directories currently installed.)
Removing linux-image-2.6.32-5-amd64 (2.6.32-48squeeze6) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
update-initramfs: Deleting /boot/initrd.img-2.6.32-5-amd64
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
Searching for GRUB installation directory ... found: /boot/grub
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-2.6.32-5-amd64.postrm line 234, <STDIN> line 2.
dpkg: error processing package linux-image-2.6.32-5-amd64 (--remove):
 subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried holding it, in the hopes apt would just ignore it since I can't seem to do anything about it, and I got

E: Can't find a source to download version '2.6.32-48squeeze6' of 'linux-image-2.6.32-5-amd64:amd64'

As far as I can tell, the package in question isn't installed.


dpkg --purge --force-remove-reinstreq linux-image-2.6.32-5-amd64

This purges the package from the system. Cleared up the issue.

  • 2
    You need to add an explanation of the command to meet the quality standards of this site. – kasperd Dec 12 '15 at 22:23
  • it's true… but then I was very happy to find this answer after a long search… – MichaelC May 1 '19 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.