After installing mono-complete on my Ubuntu 11.10, something got corrupted in the package catalog. Whenever I try to install\remove anything I get an error and told to use apt-get -f install. I get the same thing from the GUI. When I try to do it, I get the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  mono-devel mono-xbuild
The following NEW packages will be installed:
  mono-devel mono-xbuild
0 upgraded, 2 newly installed, 0 to remove and 83 not upgraded.
2 not fully installed or removed.
Need to get 0 B/2,256 kB of archives.
After this operation, 9,048 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 269743 files and directories currently installed.)
Unpacking mono-xbuild (from .../mono-xbuild_2.10.5-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/mono-xbuild_2.10.5-1_all.deb (--unpack):
 unable to open '/usr/lib/mono/4.0/xbuild.exe.dpkg-new': No such file or directory
No apport report written because MaxReports is reached already
                                                              Unpacking mono-devel (from .../mono-devel_2.10.5-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/mono-devel_2.10.5-1_all.deb (--unpack):
 unable to open '/usr/lib/mono/2.0/al.exe.dpkg-new': No such file or directory
No apport report written because MaxReports is reached already
                                                              Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/mono-xbuild_2.10.5-1_all.deb
 /var/cache/apt/archives/mono-devel_2.10.5-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I understand that I'm missing some mono files\directories, but I can't reinstall mono because apt-get just tells me to run apt-get -f install - which doesn't work.

How can I fix this?

UPDATE
Running apt-get update gives me the following errors:

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/edgy/universe/source/Sources  404  Not Found [IP: 91.189.88.46 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/edgy/universe/binary-i386/Packages  404  Not Found [IP: 91.189.88.46 80]

W: Failed to fetch http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu/dists/oneiric/main/source/Sources  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu/dists/oneiric/main/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead
link|improve this question
hello ,have you tried sudo dpkg-reconfigure package_name if it doesnt work i would remove the config files and try over if not make sure that apt-get its workin correctly by installing sumtin else just to test , good luck – kosaidpo Nov 23 '11 at 11:49
dpkg-reconfigure doesn't work - it tells me the package is broken. Where are those config files that I need to remove? – Idan Arye Nov 23 '11 at 12:10
@Idan - why have you got "edgy" software-source? Comment those out. Also - the firefox PPA you have doesnt have an oneiric repo. Comment those out as well. – fossfreedom Nov 23 '11 at 12:12
Can you please pastebin your /etc/apt/sources.list ? – Paulo Arruda Nov 23 '11 at 12:17
I don't think you have exactly that same problem, but instead of repairing the package database, you might want to try to recover it from a backup as explained here. – jcollado Nov 23 '11 at 12:42
show 2 more comments
feedback

3 Answers

Try this:

sudo apt-get update

That will update your system software list.

And then,

sudo apt-get install -f

That should fix your packages.

If it doesn't, then you've got a broken package manager, and I'd recommend reinstalling - but only if you've tried everything else!!!

link|improve this answer
The update command give me errors(I updated them at the question), and the install fix command gives me the same errors. – Idan Arye Nov 23 '11 at 11:57
feedback

The two last lines of your /etc/apt/sources.list are wrong. Remove it from the file:

deb http://us.archive.ubuntu.com/ubuntu edgy universe
deb-src http://us.archive.ubuntu.com/ubuntu edgy universe

and then:

sudo apt-get update
sudo apt-get -f install

That should fix the problems. Let me know if it's solved!

Regards

link|improve this answer
That did not work - I still can't install mono-complete. – Idan Arye Nov 23 '11 at 17:58
Can you post the result of your attempt to install it after fixing your sources.list? – Paulo Arruda Nov 23 '11 at 18:53
Please, try this command: dpkg --configure -a – Paulo Arruda Nov 23 '11 at 18:56
I tried to install it(after fixing sources.list and recovering the apt status file from the backup) and than tried dpkg --configure -a. The package catalog still gets corrupted. Here are the results: pastebin.com/2rjqZUkM – Idan Arye Nov 23 '11 at 19:27
What happens if you try to purge (apt-get --purge remove mono-complete) and then autoremove unused packages (apt-get autoremove) and then try to install it again? – Paulo Arruda Nov 23 '11 at 20:16
show 7 more comments
feedback

I had a very similar problem with firefox.

I got away with it by Editing the status file. Just remove the entry of the software causing trouble.

sudo gedit /var/lib/dpkg/status

I still cannot install firefox but at least installing other software is now possible. If you find a way to install the said package, please inform me.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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