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


11

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

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

所以我关注了Ubuntu论坛的帖子这篇帖子

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重新出现。

有什么想法吗?

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

该线程说我需要sudo apt-get update从状态中删除相应的行后再运行。所以我跑sudo apt-get cleansudo 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

不确定是否有帮助。

Answers:


7

有时,损坏的安装软件包可能会损坏软件包管理系统,从而导致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 <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.)

固定。希望这对其他人有帮助。


遇到了类似的问题,并且能够通过这种方式解决!谢谢!
学生

6

这是对我有用的东西:

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

如果有任何问题,我会再报告。BTW解决方案发布在如何使dpkg重新工作?

哦,是我的忠告:现在,我需要每次使用Synaptic来更新系统-因为ubuntu-docs在每次更新中,所以我需要取消它:-/。猜猜我将开始另一个问题,询问如何从每个后续更新中删除特定的软件包。


1

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

sudo apt-get clean

(警告,这将删除所有缓存的软件包,因此,如果您在安装过程中途中途,则需要重新下载一堆东西)。

然后,您应该能够照常进行升级过程。


好的,所以我需要从状态文件中删除与ubuntu-docs相关的信息,然后需要sudo apt-get clean。这样,我可以使用sudo dpkg -i安装任何软件包,但仍然无法升级。
wisemonkey 2011年

如果现在运行以下命令,会发生什么?sudo apt-get -f install
ImaginaryRobots

同样的事情,我不能格式化它,但它在这里是:sudo apt-get -f install(正在读取数据库... dpkg:警告:包ubuntu-docs' missing, assuming package has no files currently installed. (Reading database ... 323783 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'的文件列表文件失败。E:子进程在/ usr / bin中/ dpkg的EXITED意外
wisemonkey

我想知道这是否是错误?我不想重新安装所有内容:-/
wisemonkey 2011年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.