I am facing a problem which seems to be unsolvable. I am trying to resolve the issue but to my disappointment nothing seems to work. The problem I'm facing are as follows

  1. Whenever I try to run sudo apt-get install or sudo apt-get update, I get the following error :

    apt-get: error while loading shared libraries: libapt-pkg.so.4.12: cannot open shared object file: No such file or directory
  2. To resolve this issue I downloaded libapt-pkg.so.4.12 and ran command sudo dpkg -i libapt-pkg.so.4.12.deb it gives error

    dpkg: error processing libapt-pkg4.12_1.0.9.7ubuntu4_i386.deb (--install):  cannot access archive: No such file or directory
    Errors were encountered while processing: libapt-pkg4.12_1.0.9.7ubuntu4_i386.deb

marked as duplicate by David Foerster, Charles Green, Zanna command-line Dec 22 '17 at 15:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Please anyone ? – Abhijeet yadav Sep 15 '15 at 9:56
  • What is Ubuntu version? When did it start? Your p.2 is incorrect. – Pilot6 Sep 15 '15 at 9:56
  • It started 1 week ago, I dont know if I executed a command I should'nt have. – Abhijeet yadav Sep 15 '15 at 9:59
  • What's the output of apt-get install libapt-pkg4.12? – David Foerster Sep 15 '15 at 10:58

Run in terminal

wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/libapt-pkg4.12_0.8.16~exp12ubuntu10.21_amd64.deb
sudo dpkg -i libapt-pkg4.12_0.8.16~exp12ubuntu10.21_amd64.deb
  • dpkg: warning: files list file for package xkb-data' missing, assuming package has no files currently installed. dpkg: warning: files list file for package libgtk2.0-common' missing, assuming package has no files currently installed. dpkg: warning: files list file for package iproute' missing, assuming package has no files currently installed. dpkg: warning: files list file for package lsb-release' missing, assuming package has no files currently installed. (Reading database ... 326872 files and directories currently installed.) – Abhijeet yadav Sep 15 '15 at 10:17
  • Preparing to replace libapt-pkg4.12 0.8.16~exp12ubuntu10.21 (using libapt-pkg4.12_0.8.16~exp12ubuntu10.21_amd64.deb) ... Unpacking replacement libapt-pkg4.12 ... dpkg: regarding libapt-pkg4.12_1.0.9.7ubuntu4_i386.deb containing libapt-pkg4.12:i386: libapt-pkg4.12:i386 breaks apt (<< 0.9.4~) apt (version 0.8.16~exp12ubuntu10.24) is present and installed. dpkg: error processing libapt-pkg4.12_1.0.9.7ubuntu4_i386.deb (--install): installing libapt-pkg4.12:i386 would break apt, and deconfiguration is not permitted (--auto-deconfigure might help) – Abhijeet yadav Sep 15 '15 at 10:17
  • OK. Why did you download i386 package? I fixed the command. But it looks that you have it installed already. You should use the solution only for your architechture amd64 in the other answer. But you seem to do both. – Pilot6 Sep 15 '15 at 10:21
  1. Download the deb file for Precise

    cd; wget http://mirrors.kernel.org/ubuntu/pool/main/a/apt/libapt-pkg4.12_0.8.16\~exp12ubuntu10.25_amd64.deb
  2. Extract the deb file

    dpkg -x libapt-pkg4.12_0.8.16\~exp12ubuntu10.25_amd64.deb deb
  3. Copy the files

    sudo cp deb/usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12.0 /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12.0
  4. Create a symbolic link

    sudo ln -s /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12.0 /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12
  5. After the files are available again, your package system will work again. You should re-install the package libapt-pkg4.12 anyway

    sudo apt-get install --reinstall libapt-pkg4.12
  • I am using Ubuntu 12.04 LTS, 64-bit machine with Intel® Core™ i3-4005U CPU @ 1.70GHz × 4 Processor – Abhijeet yadav Sep 15 '15 at 9:58
  • Why not just install the deb by dpkg -i? – Pilot6 Sep 15 '15 at 10:00
  • @Pilot6 -_- sure :\ – A.B. Sep 15 '15 at 10:03
  • Hey @A.B, Thank you for your reply. I did what you as you said. Everything was fine except the execution of the last command. The last command when executed gives Error. – Abhijeet yadav Sep 15 '15 at 10:04
  • Which error do you mean? – A.B. Sep 15 '15 at 10:12

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