Upgrade problem, dpkg error & apt-get update leads to error message: libapt-pkg.so.4.12: file too

Bug #1022384 reported by Christopher Forster
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Hi, I get an error whenever I try to open an application using apt or try to install anything & now I want to finding a way to update Lubuntu 12.04 with apt. apt-get update leads to error message: libapt-pkg.so.4.12: file too short. I'm running Lubuntu 12.04 from a DELTACO USB SATA/IDE adapter kit from an USB port. I have tried to repair the file system with the fsck tool. I know that running the ext4 file system without a journal can cause problems. Other than that the system works very well.

From Terminal:
Code:
dmesg | grep EXT4
[ 3.033062] EXT4-fs (sdb1): mounted filesystem without journal. Opts: (null)
[ 9.255690] EXT4-fs (sdb1): re-mounted. Opts: errors=remount-ro

Update from Terminal:
Code:
sudo apt-get update
apt-get: error while loading shared libraries: /usr/lib/i386-linux-gnu/libapt-pkg.so.4.12: file too short

Code:
sudo apt-get install <package>
apt-get: error while loading shared libraries: /usr/lib/i386-linux-gnu/libapt-pkg.so.4.12: file too short

Code:
sudo synaptic
synaptic: error while loading shared libraries: /usr/lib/i386-linux-gnu/libapt-pkg.so.4.12: file too short

Code:
sudo update-manager
Traceback (most recent call last):
File "/usr/bin/update-manager", line 33, in <module>
from UpdateManager.UpdateManager import UpdateManager
File "/usr/lib/python2.7/dist-packages/UpdateManager/UpdateManager.py", line 39, in <module>
import apt_pkg
ImportError: /usr/lib/i386-linux-gnu/libapt-pkg.so.4.12: fil för kort
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 20, in <module>
import apport.fileutils
File "/usr/lib/python2.7/dist-packages/apport/fileutils.py", line 22, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python2.7/dist-packages/apport/packaging_impl.py", line 20, in <module>
import apt
File "/usr/lib/python2.7/dist-packages/apt/__init__.py", line 21, in <module>
import apt_pkg
ImportError: /usr/lib/i386-linux-gnu/libapt-pkg.so.4.12: fil för kort

Original exception was:
Traceback (most recent call last):
File "/usr/bin/update-manager", line 33, in <module>
from UpdateManager.UpdateManager import UpdateManager
File "/usr/lib/python2.7/dist-packages/UpdateManager/UpdateManager.py", line 39, in <module>
import apt_pkg
ImportError: /usr/lib/i386-linux-gnu/libapt-pkg.so.4.12: fil för kort

"fil för kort" which means file too short in Swedish.

I also got: "Ett problem inträffade vid kontroll av uppdateringar." which means: A problem occurred when checking for updates.

Running fsck & e2fsck from Debian 7 "Wheezy" testing, output in Swedish:
Code:
root@debian:/# fsck /dev/sdc1
fsck från util-linux 2.20.1
e2fsck 1.42.4 (12-Jun-2012)
/dev/sdc1 var inte fläckfritt avmonterat, kontroll framtvingad.
Pass 1: Kontrollerar inoder, block och storlekar
Pass 2: Kontrollerar katalogstruktur
Pass 3: Kontrollerar katalogförbindelser
Pass 4: Kontrollerar referensräknare
Pass 5: Kontrollerar gruppsammanfattningsinformation
/dev/sdc1: 157422/5431296 filer (0.2% ej sammanhängande), 1632724/21717248 block

Code:
root@debian:/# e2fsck -f /dev/sdc1
e2fsck 1.42.4 (12-Jun-2012)
Pass 1: Kontrollerar inoder, block och storlekar
Pass 2: Kontrollerar katalogstruktur
Pass 3: Kontrollerar katalogförbindelser
Pass 4: Kontrollerar referensräknare
Pass 5: Kontrollerar gruppsammanfattningsinformation
/dev/sdc1: 157422/5431296 filer (0.2% ej sammanhängande), 1632724/21717248 block

Running from Terminal in Lubuntu 12.04, output in Swedish:

Code:
sudo dpkg -i libapt-pkg4.12_0.8.16~exp12ubuntu10_i386.deb
dpkg: fel: läser paketinfofilen "/var/lib/dpkg/available": Är en katalog

Source: http://pkgs.org/ubuntu-12.04/ubuntu-main-i386/libapt-pkg4.12_0.8.16~exp12ubuntu10_i386.deb/download/

Code:
sudo dpkg -i libapt-pkg4.12_0.8.16~exp12ubuntu10.2_i386.deb
dpkg: fel: läser paketinfofilen "/var/lib/dpkg/available": Är en katalog

Source: http://packages.ubuntu.com/sv/precise/i386/libapt-pkg4.12/download

Original source by Lyfang (aka Christopher Forster): http://ubuntuforums.org/showthread.php?t=2020530

Revision history for this message
Christopher Forster (christopherforster) wrote :

[SOLVED] Extract libapt-pkg4.12_0.8.16~exp12ubuntu10.2_i386.deb with File Roller. Backup all files mentioned with the cp command. In my case only libapt-pkg.so.4.12.

Or locate files with PCManFM as a superuser to backup file(s) and backup file(s):

Run from (LX)Terminal:
gksudo pcmanfm

Copy both libapt-pkg.so.4.12 & libapt-pkg.so.4.12.0 to the directory /usr/lib/i386-linux-gnu i.e.:
/usr/lib/i386-linux-gnu/libapt-pkg.so.4.12
/usr/lib/i386-linux-gnu/libapt-pkg.so.4.12.0

The apt-get command now works great!

Revision history for this message
Christopher Forster (christopherforster) wrote :

update-manager error:

"installArchives() failed: Could not exec dpkg!
Error in function:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/aptdaemon/progress.py", line 428, in run
    self._child(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/progress.py", line 748, in _child
    os.execlp(apt_pkg.config["Dir::Bin::DPkg"], *args)
  File "/usr/lib/python2.7/os.py", line 327, in execlp
    execvp(file, args)
  File "/usr/lib/python2.7/os.py", line 344, in execvp
    _execvpe(file, args)
  File "/usr/lib/python2.7/os.py", line 368, in _execvpe
    func(file, *argrest)
OSError: [Errno 13] Permission denied"

Revision history for this message
Adam Conrad (adconrad) wrote :

This looks like filesystem corruption or dying hardware. The part where bits of it were solved by re-extracting the relevant libraries seems to back this up. Marking invalid, as it's not a dpkg bug.

Changed in dpkg (Ubuntu):
status: New → Invalid
Revision history for this message
Christopher Forster (christopherforster) wrote :

Thanks for responding. Adam Conrad (adconrad), most likely filesystem corruption. However software reliability with program closer to the main operating system layer/parts such as libraries are more vital to the OS experience. I don't think a file system without a journal should be able to break dpkg or apt. This issue has not been specifically addressed?

Revision history for this message
Svartalf (frank-earlconsult) wrote :

Most likely filesystem corruption?

Not lookinng like it guys. Fresh install. New laptop. Works fine until I try to do a package migration.

Canonical...hint from one distribution dev (embedded) to a fellow distribution dev- it does NO good whatsoever to make it "easy to use" and "pretty" if it does stupid things like this. Worse, you're not helping end users when you do a brushoff like this.

Revision history for this message
Christopher Forster (christopherforster) wrote :

If trying to update the repository with apt and one gets a bunch of error messages: Is there a way to debug apt? I have now reinstalled Lubuntu though. @Svartalf (frank-earlconsult) comment #5, if this bug affects you could you please confirm this bug? ("This bug affects 1 person. Does this bug affect you? Yes, it affects me")

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.