Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

Thanks for the help

share|improve this question
add comment

3 Answers 3

Other than those which you have already posted, there are few other commands which can be helpful.

  • Autoclean clears out the local repository of retrieved package files.

    sudo apt-get autoclean
    
  • Force installation/removal of packages. ☠Use with caution

    sudo apt-get --force-yes install <pkgname>
    

    and

    sudo apt-get --force-yes remove <pkgname>
    

Also as always, you can use dpkg to install, remove and purge packages.

  • Install

    sudo dpkg -i <pkgname>
    
  • Remove

    sudo dpkg -r <pkgname>
    
  • Purge

    sudo dpkg -P <pkgname>
    
share|improve this answer
    
Both dpkg and the apt-get --force-yes commands return the same error as I was getting before. Autoclean doesn't return an error but also doesn't seem to do anything with the two broken packages. –  Bijak Mar 24 at 4:22
    
@Bijak You must have surely tried purging bsnes .Have you? –  Registered User Mar 24 at 4:26
    
Yep, with dpkg -P, apt-get purge, and with Synaptic –  Bijak Mar 24 at 12:39
    
Post the output of dpkg -l |grep bsnes –  Registered User Mar 24 at 12:51
    
rF bsnes 0.088-7 amd64 Accurate SNES/SuperFamicom emulator –  Bijak Mar 24 at 13:09
show 5 more comments
up vote 1 down vote accepted

So, after more googling and really carefully reading through the error messages again it seems that dpkg needed to be reinstalled.

sudo apt-get install --reinstall dpkg

What tipped off that this was the problem (if anyone searches and sees this) is that update-alternatives: not found was in the error message. As soon as dpkg was reinstalled, the other packages proceeded to install normally automatically.

share|improve this answer
add comment

If all else fails, you can manually remove the package through dpkg. Running sudo dpkg -P bsnes should purge bsnes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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