几天前我一直尝试升级 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 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
不确定是否有帮助。
答案1
有时损坏的安装包会损坏您的包管理系统,导致您的 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.)
已修复。希望这对其他人有帮助。
答案2
以下是对我有用的方法:
sudo dpkg --force-all -r ubuntu-docs
如果再次出现问题,我会报告。顺便说一下,解决方案发布在如何让 dpkg 再次工作?
哦,是的,建议:现在我每次都需要使用 Synaptic 来更新系统——因为 ubuntu-docs 每次更新都会出现,我需要取消勾选它 :-/。我想我会开始问另一个问题,询问如何在每次后续更新中删除特定的包。
答案3
您的命令可能只是试图重新使用计算机上缓存的损坏包。尝试运行以下命令来清除 apt 缓存:
sudo apt-get clean
(警告,这将删除所有缓存的包,因此如果您安装到一半,则需要重新下载一堆东西)。
然后您应该能够正常完成升级过程。