apt-get upgrade 中止如何恢复?(哈希值不匹配)

apt-get upgrade 中止如何恢复?(哈希值不匹配)

我问过堆栈溢出但被重定向到这里。

我担心我犯了某种错误。

在执行升级时apt-get upgrade(队列中有大约 160 多个软件包),我意外退出,导致升级中途中止。现在我无法重新启动升级。

apt-get upgrade说没有要升级的软件包...

apt-get update给出错误:

W: Failed to fetch http://security.debian.org/dists/wheezy/updates/main/binary-armel/Packages  Hash Sum mismatch

W: Failed to fetch http://security.debian.org/dists/wheezy/updates/contrib/binary-armel/Packages  Hash Sum mismatch

W: Failed to fetch http://security.debian.org/dists/wheezy/updates/non-free/binary-armel/Packages  Hash Sum mismatch

[several more of these... and ending in: ]
E: Some index files failed to download. They have been ignored, or old ones used instead.
E: Couldn't rebuild package cache

完整输出为在 pastebin 上

我尝试了这些但没有成功:

  • apt-get -f install

输出:

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  • dpkg --configure -a

无输出

  • rm -vf /var/lib/apt/lists/*; rm -vf /var/lib/apt/lists/partial/*; apt-get update

与上面相同的错误。

  • dpkg-reconfigure -a

最终在此之后中止:

[ ok ] Stopping acpid (via systemctl): acpid.service.
[ ok ] Starting acpid (via systemctl): acpid.service.
[ ok ] Stopping apache2 (via systemctl): apache2.service.
[ ok ] Starting apache2 (via systemctl): apache2.service.
gpg: key B98321F9: "Squeeze Stable Release Key <[email protected]>" not changed
gpg: key 473041FA: "Debian Archive Automatic Signing Key (6.0/squeeze) <[email protected]>" not changed
gpg: key 65FFB764: "Wheezy Stable Release Key <[email protected]>" not changed
gpg: key 46925553: "Debian Archive Automatic Signing Key (7.0/wheezy) <[email protected]>" not changed
gpg: key 518E17E1: "Jessie Stable Release Key <[email protected]>" not changed
gpg: key 2B90D010: "Debian Archive Automatic Signing Key (8/jessie) <[email protected]>" not changed
gpg: key C857C906: "Debian Security Archive Automatic Signing Key (8/jessie) <[email protected]>" not changed
gpg: Total number processed: 7
gpg:              unchanged: 7
[ ok ] Stopping avahi-daemon (via systemctl): avahi-daemon.service.
[ ok ] Reloading dbus configuration (via systemctl): dbus.service.
[ ok ] Starting avahi-daemon (via systemctl): avahi-daemon.service.
update-alternatives: using /usr/share/man/man7/bash-builtins.7.gz to provide /usr/share/man/man7/builtins.7.gz (builtins.7.gz) in auto mode
update-initramfs: deferring update (trigger activated)
[ ok ] Starting loadcpufreq (via systemctl): loadcpufreq.service.
[ ok ] Starting cpufrequtils (via systemctl): cpufrequtils.service.
[ ok ] Stopping cron (via systemctl): cron.service.
[ ok ] Starting cron (via systemctl): cron.service.
[ ok ] Starting dbus (via systemctl): dbus.service.
update-initramfs: deferring update (trigger activated)
update-initramfs: deferring update (trigger activated)
update-initramfs: deferring update (trigger activated)
Regenerating fonts cache... done.
udev active, skipping device node creation.
update-initramfs: deferring update (trigger activated)
dpkg-query: error: --status needs a valid package name but 'gcc-4.7-base' is not: ambiguous package name 'gcc-4.7-base' with more than one installed instance

Use --help for help about querying packages.
/usr/sbin/dpkg-reconfigure: gcc-4.7-base is not installed

我不知道如何找出已安装的内容和未安装的内容。

非常欢迎任何有关如何恢复的建议!

答案1

这可能应该移至超级用户或类似用户,但由于您已经被重新重定向......

首先我建议在屏幕会话。这样,当您注销或连接中断时,更新仍会继续进行:

screen -S upd

要分离会话,请按Ctrl 一个然后按d

要重新连接会话类型:

screen -r upd

粘贴您列出的尝试过但没有成功的操作的输出也会很有帮助。

一些建议:

  • 你试过切换存储库
  • 你是否递归删除/var/lib/apt/列表/*
  • 你是否mkdir /var/lib/apt/lists/partial

我的建议来自: https://askubuntu.com/questions/41605/trouble-downloading-packages-list-due-to-a-hash-sum-mismatch-error/

编辑:根据您添加的信息判断,您可能需要强制删除gcc-4.7-基础然后重新安装并重复dpkg-重新配置-a。如果另一个包失败,请重复此过程直至成功,然后重新运行 apt-get (dist-)upgrade。

相关内容