I went to install bsnes
the other day and, for whatever reason, the installation failed. Now, I cannot update, install new packages, or do basically any apt-get commands as they all try to process this broken package and fail. Attempting to install a new package also just dooms it to the same fate.
The error I get is:
Setting up google-chrome-stable (33.0.1750.152-1) ...
/var/lib/dpkg/info/google-chrome-stable.postinst: 124: /var/lib/dpkg/info/google-chrome-stable.postinst: update-alternatives: not found
dpkg: error processing google-chrome-stable (--configure):
subprocess installed post-installation script returned error exit status 127
Setting up bsnes (0.088-7) ...
/var/lib/dpkg/info/bsnes.postinst: 5: /var/lib/dpkg/info/bsnes.postinst: update-alternatives: not found
dpkg: error processing bsnes (--configure):
subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
google-chrome-stable
bsnes
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have been searching on Google and here on Ask Ubuntu but have not found a working solution.
The commonly suggested fix is to run the following:
sudo apt-get clean && sudo apt-get autoremove
sudo apt-get -f install
sudo dpkg --configure -a
This however does not work. The apt-get commands all fail with the same error as above and the dpkg command just doesn't help. The other thing they often suggest to purge it via Synaptic or the command line, which also fails.
dpkg
doesn't always help. – Danatela Dec 24 '15 at 10:36/var/lib/dpkg/info/[package_name].prerm
but your post gave me the right direction. Definitely for advanced users though, this is risky! – sмurf Jan 06 '16 at 23:10.prerm
and.postrm
files fix the problem. – fuser May 27 '17 at 09:28.prerm
files etc finally an almost equivalent ofrpm -e --noscripts
:) – rogerdpack Nov 05 '19 at 18:50sudo apt-get update && sudo apt-get upgrade
. Then I commented everything in/var/lib/dpkg/info/dokku.prerm
and the problem is gone. – Arda Basoglu Sep 29 '22 at 19:23