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'm new to Ubuntu, it looks like it is better than Windows. Last day I tried to install Kget (the download manager) but during the process my computer suddenly stopped working. So I had to switch it off. After I logged into Ubuntu again I can't install any program. The Ubuntu Software Center says:

Items cannot be installed or removed until package catalog is repaired.
Do you want to repair it now?

After I clicked repair it says (after few seconds):

Package operation fails - The installation or removal of a software package failed

I've tried several times, but the same problem occurred. Can anyone tell me a solution for this problem?

share|improve this question

3 Answers 3

up vote 13 down vote accepted

Open a terminal and try this command

sudo apt-get install -f

It will fix all broken packages. after this you can install any s/w you want.

share|improve this answer

To fix broken packages in Ubuntu, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.

sudo dpkg --configure -a
sudo apt-get install -f

If the problem still exist, then edit dpkg status file

gksudo gedit /var/lib/dpkg/status   

Find the package in question, and remove everything that has anything to do with it >and save the file.1

1Source:Ubuntu fix

share|improve this answer
2  
Is editing the dpkg status file a pretty safe thing? Like, will I be running a large risk of screwing up my whole system? –  nicktrip Dec 6 '12 at 1:58
1  
If you delete the package in question, should be OK. –  Mitch Dec 6 '12 at 11:38

When upgrading from 13.10 to 14.04.1, I had a problem with broken packages, and when trying all the common things like apt-get -f install, I got an error, something like E: Sub-process /usr/bin/dpkg returned an error code (1).

Instead of reinstalling and spending hours setting things up, I got my hands dirty, and eventually fixed. Here's how:

  1. Synaptic uses apt-get underhood. Go use that apt-get at console. Figure out what commands are used by Synaptic, or which to use.

  2. apt-get uses dpkg internally. If it tells dpkg ended with an error, try to do the operation with dpkg directly, you'll see the actual error.

  3. dpkg stores it's metadata in /var/lib/dpkg/info/. In my case, it had problems with samba-libs, installing (corrupted archive) or removing (metadata missing -> saying it's not installed). So I deleted the metadata. Then ran dpkg --clear-avail. Then downloaded the library, put to the place instead of the corrupted file. Then apt-get update. Then `dpkg --install . And then it started working.

share|improve this answer

protected by Community Dec 5 '11 at 4:31

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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