无法安装/删除/升级任何软件包

所以我几天前一直试图升级Ubuntu 11.10 64位并收到错误:

dpkg:../../ src / archives.c:978:tarobject:断言`r == stab.st_size’失败。

所以我按照这个Ubuntu论坛post和这个 。

从info文件夹和状态文件中删除了ubuntu-docs

现在,每当我尝试安装/删除/升级任何软件包时,都会收到错误消息:

 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. 

当我尝试从命令行安装ubuntu-docs ,我得到了这个输出:

  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 

…看起来和我开始时的问题差不多,所以我看了一下信息 – 没有包ubuntu-docs但是状态有条目所以我删除了它并再试一次,但是一旦我做了sudo dpkg --configure -a重新出现ubuntu-docs的条目。

有什么想法吗?

编辑 (不作为保存格式的注释)

这个post说我需要在从状态中删除相应的行后运行sudo apt-get update 。 所以我运行了sudo apt-get clean接着是sudo apt-get update 。 但我收到一条消息说:

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

运行sudo dpkg --configure -a ,状态文件包含以下行:

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

不确定它是否有帮助。

有时,损坏的安装包可能会破坏您的软件包管理系统,导致Linux无法安装或删除任何软件包(软件)。 这是我在尝试为Ubuntu安装ndas-admin后从apt-get获得的消息错误。

$ sudo apt-get install mplayer(或任何包)读取包列表…完成构建依赖关系树
读取状态信息…完成E:需要重新安装包ndas-admin,但我找不到它的存档。 (这是错误)

我尝试了sudo apt-get install -f来尝试解决问题,但得到了同样的错误。 我唯一的选择是手动编辑dpkg状态文件。

 $ 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  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.) 

固定。 希望这有助于其他人。

这对我有用:

 sudo dpkg --force-all -r ubuntu-docs 

我会再次报告是否有任何问题。 BTW解决方案发布在如何让dpkg再次运行?

哦,是的建议:现在我需要使用Synaptic每次更新系统 – 因为ubuntu-docs在每次更新时我都需要取消它: – /。 猜猜我会开始提出其他问题,询问如何从每次后续更新中删除特定包。

您的命令可能只是试图重新使用缓存在您计算机上的损坏包。 尝试运行以下命令以清除apt缓存:

 sudo apt-get clean 

(警告,这将删除所有缓存的包,所以如果你在安装的一半,它将需要重新下载一堆东西)。

然后,您应该能够正常完成升级过程。