如何修复损坏的包目录?

如何修复损坏的包目录?

在我的 Ubuntu 11.10 上安装后mono-complete,软件包目录中的某些内容损坏了。每当我尝试安装\删除任何内容时,我都会收到错误并被告知使用apt-get -f install。我从 GUI 中得到同样的结果。当我尝试执行此操作时,我收到以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  mono-devel mono-xbuild
The following NEW packages will be installed:
  mono-devel mono-xbuild
0 upgraded, 2 newly installed, 0 to remove and 83 not upgraded.
2 not fully installed or removed.
Need to get 0 B/2,256 kB of archives.
After this operation, 9,048 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 269743 files and directories currently installed.)
Unpacking mono-xbuild (from .../mono-xbuild_2.10.5-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/mono-xbuild_2.10.5-1_all.deb (--unpack):
 unable to open '/usr/lib/mono/4.0/xbuild.exe.dpkg-new': No such file or directory
No apport report written because MaxReports is reached already
                                                              Unpacking mono-devel (from .../mono-devel_2.10.5-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/mono-devel_2.10.5-1_all.deb (--unpack):
 unable to open '/usr/lib/mono/2.0/al.exe.dpkg-new': No such file or directory
No apport report written because MaxReports is reached already
                                                              Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/mono-xbuild_2.10.5-1_all.deb
 /var/cache/apt/archives/mono-devel_2.10.5-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我知道我缺少一些 mono 文件\目录,但我无法重新安装 mono,因为它apt-get只是告诉我运行apt-get -f install- 但是它不起作用。

我怎样才能解决这个问题?

更新
运行apt-get update出现以下错误:

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/edgy/universe/source/Sources  404  Not Found [IP: 91.189.88.46 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/edgy/universe/binary-i386/Packages  404  Not Found [IP: 91.189.88.46 80]

W: Failed to fetch http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu/dists/oneiric/main/source/Sources  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu/dists/oneiric/main/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead

答案1

尝试这个:

sudo apt-get update

这将更新您的系统软件列表。

进而,

sudo apt-get install -f

这应该可以修复你的包裹。

如果没有,那么你的包管理器就坏了,我建议你重新安装——但是仅有的如果你已经尝试了其他所有方法!!!

答案2

您的 /etc/apt/sources.list 的最后两行是错误的。将其从文件中删除:

deb http://us.archive.ubuntu.com/ubuntu edgy universe
deb-src http://us.archive.ubuntu.com/ubuntu edgy universe

进而:

sudo apt-get update
sudo apt-get -f install

这应该可以解决问题。如果解决了请告诉我!

问候

答案3

我在使用 Firefox 时也遇到了类似的问题。

我通过编辑状态文件解决了这个问题。只需删除引起问题的软件的条目即可。

sudo gedit /var/lib/dpkg/status

我仍然无法安装 Firefox,但至少现在可以安装其他软件了。如果您找到安装所述软件包的方法,请通知我。

答案4

请检查未正确安装并抛出错误的软件。重新安装。

sudo apt-get install --reinstall <package> .  
sudo apt-get update; sudo apt-get install -f

然后继续安装您想要的软件。

相关内容