Ubuntu – Can’t install/remove/upgrade any package

installationpackage-managementsoftware-centerupgrade

So I've been trying to upgrade Ubuntu 11.10 64-bit few days back and received an error:

dpkg: ../../src/archives.c:978: tarobject: Assertion `r == stab.st_size' failed.

So I followed this Ubuntu Forums post and this one.

Removed ubuntu-docs from info folder and status file.

Now whenever I try to install/remove/upgrade any package I receive an error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 968, in simulate
    trans.unauthenticated = self._simulate_helper(trans)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 1092, in _simulate_helper
    return depends, self._cache.required_download, \
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 235, in required_download
    pm.get_archives(fetcher, self._list, self._records)
SystemError: E:I wasn't able to locate a file for the ubuntu-docs package. This might mean you need to manually fix this package.

When I try to install ubuntu-docs from command line, I get this output:

 BlockquoteReading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  ubuntu-docs
1 upgraded, 0 newly installed, 0 to remove and 33 not upgraded.
1 not fully installed or removed.
Need to get 1,408 kB of archives.
After this operation, 22.5 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric/main ubuntu-docs all 11.10.4 [1,408 kB]
Fetched 1,408 kB in 5s (265 kB/s)        
(Reading database ... 
dpkg: warning: files list file for package `ubuntu-docs' missing, assuming package has no files currently installed.
(Reading database ... 323646 files and directories currently installed.)
Preparing to replace ubuntu-docs 11.10.4 (using .../ubuntu-docs_11.10.4_all.deb) ...
Unpacking replacement ubuntu-docs ...
dpkg: ../../src/archives.c:978: tarobject: Assertion `r == stab.st_size' failed.
E: Sub-process /usr/bin/dpkg exited unexpectedly

…which looks about the same as when I started with problem, so I looked in info — there is no package ubuntu-docs but there is entry in status so I deleted it and tried again, but as soon as I do sudo dpkg --configure -a the entry for ubuntu-docs reappears.

Any thoughts?

Edit (not as a comment to save formatting):

This thread says I need to run sudo apt-get update after removing corresponding lines from status. So I ran sudo apt-get clean followed by sudo apt-get update. But I got a message saying:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

After running sudo dpkg --configure -a, status file contains following lines:

Package: ubuntu-docs
Status: install reinstreq half-installed
Priority: optional
Section: doc
Version: 11.10.4

Not sure if it helps.

Best Answer

  • Sometimes a corrupt installation package can corrupt your package management system leaving your Linux unable to install or on remove any packages (Software). Here is the message error I got from apt-get after trying to install ndas-admin for Ubuntu.

    $sudo apt-get install mplayer (or any package) Reading package lists… Done Building dependency tree
    Reading state information… Done E: The package ndas-admin needs to be reinstalled, but I can’t find an archive for it. (this is the error)

    I tried sudo apt-get install -f to try to fix the problem but got the same error. The only option I had was to edit the dpkg status file manually.

    $ sudo gedit /var/lib/dpkg/status    (if you prefer you can use vi instead of gedit)
    Locate the corrupt package, and remove the whole block of information about it and save the file. Mine looked like this:
    
    Package: ndas-admin
    Status: deinstall reinstreq half-configured
    Priority: extra
    Section: alien
    Installed-Size: 100
    Maintainer: root <root@ubuntu510>
    Architecture: i386
    Version: 1.0.2-24
    Depends: libc6 (>= 2.3.4-1)
    Description: Administration toosl for XIMETA,Inc NDAS device driver for Linux operating system
     ndas-admin – This program allows the user to register/enable/disable/unregister the XIMETA NDAS hard disk.
     .
     (Converted from a rpm package by alien version 8.53.)
    

    Fixed. Hope this helps someone else.

  • Related Question