How to fix a ruined package catalog?

19,102

Solution 1

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

Solution 2

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!!!

Share:
19,102
Idan Arye
Author by

Idan Arye

Updated on September 18, 2022

Comments

  • Idan Arye
    Idan Arye over 1 year

    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
    
    • kosaidpo
      kosaidpo over 12 years
      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
    • Idan Arye
      Idan Arye over 12 years
      dpkg-reconfigure doesn't work - it tells me the package is broken. Where are those config files that I need to remove?
    • nilsonneto
      nilsonneto over 12 years
      @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.
    • Paulo Arruda
      Paulo Arruda over 12 years
      Can you please pastebin your /etc/apt/sources.list ?
    • jcollado
      jcollado over 12 years
      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.
    • Idan Arye
      Idan Arye over 12 years
      @PauloArruda: <pastebin.com/477x4PSD>
  • Idan Arye
    Idan Arye over 12 years
    The update command give me errors(I updated them at the question), and the install fix command gives me the same errors.
  • Idan Arye
    Idan Arye over 12 years
    That did not work - I still can't install mono-complete.
  • Idan Arye
    Idan Arye over 12 years
    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
  • Paulo Arruda
    Paulo Arruda over 12 years
    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?
  • Idan Arye
    Idan Arye over 12 years
    I can't even remove it - pastebin.com/vV952WjA The only way to remove it is to recover the status file from a backup.
  • Paulo Arruda
    Paulo Arruda over 12 years
    Good, now remove monodoc-browser (sudo apt-get --purge remove monodoc-browser) and then clean (sudo apt-get clean) and try installing mono-complete again (without mono-browser)
  • Paulo Arruda
    Paulo Arruda over 12 years
    Sorry i think i wasnt clear. According to your last pastebin, you did remove the package mono-complete, but apt was still trying to install mono-browser. Just follow the steps i wrote in the comment above.
  • Idan Arye
    Idan Arye over 12 years
    When I try to remove monodoc-browser I get told I need to do apt-get -f install. The only way for me to remove monodoc-browser is to recover from a backup. When I try to install just monodoc-browser, I get the corruption errors. I don't suppose there is a way to install mono-complete without mono-browser? Is there another package that'll give me everything I need to develop in mono?
  • Paulo Arruda
    Paulo Arruda over 12 years
    First, we need to solve this problem, or else you wont be able to install new packages in the right way. Try to remove those packages with "dpkg --purge mono-browser" and "dpkg --purge mono-complete". After that, try "dpkg --configure -a" and let me now how it goes.
  • Idan Arye
    Idan Arye over 12 years
    I can't remove monodoc-browser - this is what I get - pastebin.com/4sLUdjPR . But that does not mean I can't recover from a backup. After I recover from a backup everything works as it should - as long as I don't try to install monodoc-browser or mono-complete. So, there is no point to keep trying to remove monodoc-browser with the package manager, since we already tried that and in doesn't work, and we can reach the same state by recovering from a backup. I just need to know what to do after I recover from a backup to get the full mono SDK.
  • Paulo Arruda
    Paulo Arruda over 12 years