0

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
    
David Foerster
  • 36,264
  • 56
  • 94
  • 147

2 Answers2

1

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
Pilot6
  • 90,100
  • 91
  • 213
  • 324
  • 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
0
  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
    
A.B.
  • 90,397
  • 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 09: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
  • You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: libapache2-mod-auth-mysql : Depends: apache2.2-common (>= 2.2.3-3) but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). – Abhijeet yadav Sep 15 '15 at 10:15
  • @A.B. please remove 32-bit solution. It confused the OP. – Pilot6 Sep 15 '15 at 10:22
  • @pilot, I pasted every command for 64 bit machine. I dont't know why it is showing error for 32 bit pkg – Abhijeet yadav Sep 15 '15 at 10:25
  • Because you have downloaded i386 package. Look into your Home folder. – Pilot6 Sep 15 '15 at 10:26
  • I remove i386 and run the command, but the same error persist.--------------You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: libapache2-mod-auth-mysql : Depends: apache2.2-common (>= 2.2.3-3) but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). – Abhijeet yadav Sep 15 '15 at 10:33
  • @Abhijeetyadav That's a completely different problem. Try sudo apt-get install -f If this doesn't work, ask a new question – A.B. Sep 15 '15 at 10:43
  • @Pilot6 I have the part removed. – A.B. Sep 15 '15 at 10:59
  • @A.B. apt-get: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory – Dr.jacky Dec 22 '16 at 06:04