如何恢复完全混乱的 Ubuntu 系统

如何恢复完全混乱的 Ubuntu 系统

我有一个系统,距离大约 3000 公里,所以我无法访问它。该机器运行的是 ubuntu 13.04(是的,它早就过了 EOL),python 模块完全乱了。当我尝试使用 do-release-upgrade 将其升级到 13.10,然后升级到 14.04(如所解释的那样这里)我收到此错误消息:

Traceback (most recent call last):
  File "/usr/bin/do-release-upgrade", line 8, in <module>
    from DistUpgrade.DistUpgradeVersion import VERSION
ImportError: No module named DistUpgrade.DistUpgradeVersion

甚至 UFW 也停止工作。它显示以下错误:

Traceback (most recent call last):
  File "/usr/sbin/ufw", line 26, in <module>
    import ufw.frontend
ImportError: No module named ufw.frontend

所以我想我可以重新安装 python,然后生活就好了。尝试重新安装 python 根本不起作用,所以我想也许我可以卸载 python 并重新安装它,这也是一个非常愚蠢的举动!现在我的 python 包被报告为清除,尝试使用 dpkg 或 apt-get 执行任何操作都会引发一百万个错误然后退出,并且几乎所有工具都不起作用!

我不介意升级或安装全新的 Ubuntu(我认为无论如何我都必须这样做),但我找不到任何线索如何通过网络做到这一点?这可能吗?

编辑1:

例如,当我尝试运行sudo dpkg --configure -a修复安装程序的问题时,我得到如下输出:

dpkg: dependency problems prevent configuration of ubuntu-release-upgrader-gtk:
 ubuntu-release-upgrader-gtk depends on update-manager; however:
  Package update-manager is not configured yet.
 ubuntu-release-upgrader-gtk depends on python3-distupgrade (= 1:0.192.13); however:
  Package python3-distupgrade is not configured yet.
 ubuntu-release-upgrader-gtk depends on python3-dbus; however:
  Package python3-dbus is not configured yet.
 ubuntu-release-upgrader-gtk depends on python3-gi; however:
  Package python3-gi is not configured yet.

dpkg: error processing ubuntu-release-upgrader-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apport-gtk:
 apport-gtk depends on python3-apport (>= 2.9.2-0ubuntu8.5); however:
  Package python3-apport is not configured yet.
 apport-gtk depends on python3-gi; however:
  Package python3-gi is not configured yet.

dpkg: error processing apport-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-debian:
 python3-debian depends on python3-chardet; however:
  Package python3-chardet is not configured yet.
 python3-debian depends on python3-six; however:
  Package python3-six is not configured yet.

dpkg: error processing python3-debian (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-manager-core:
 update-manager-core depends on python3-update-manager (= 1:0.186.2); however:
  Package python3-update-manager is not configured yet.

dpkg: error processing update-manager-core (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-manager-gnome | update-manager (>= 1:0.165); however:
  Package update-manager-gnome is not installed.
  Package update-manager is not configured yet.
 update-notifier depends on ubuntu-release-upgrader-gtk; however:
  Package ubuntu-release-upgrader-gtk is not configured yet.

dpkg: error processing update-notifier (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-release-upgrader-core:
 ubuntu-release-upgrader-core depends on python3-distupgrade (= 1:0.192.13); however:
  Package python3-distupgrade is not configured yet.

dpkg: error processing ubuntu-release-upgrader-core (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of aptdaemon:
 aptdaemon depends on python3-aptdaemon (= 1.0-0ubuntu9); however:
  Package python3-aptdaemon is not configured yet.
 aptdaemon depends on python3-gi; however:
  Package python3-gi is not configured yet.

dpkg: error processing aptdaemon (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-gi-cairo:
 python3-gi-cairo depends on python3-gi (= 3.8.0-2); however:
  Package python3-gi is not configured yet.
 python3-gi-cairo depends on python3-cairo (>= 1.10.0+dfsg-3~exp2); however:
  Package python3-cairo is not configured yet.

dpkg: error processing python3-gi-cairo (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of friends:
 friends depends on friends-dispatcher; however:
  Package friends-dispatcher is not configured yet.

dpkg: error processing friends (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apport:
 apport depends on python3-apport (>= 2.9.2-0ubuntu8.5); however:
  Package python3-apport is not configured yet.
 apport depends on python3-gi; however:
  Package python3-gi is not configured yet.

dpkg: error processing apport (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 ubuntu-release-upgrader-gtk
 apport-gtk
 python3-debian
 update-manager-core
 update-notifier
 ubuntu-release-upgrader-core
 aptdaemon
 python3-gi-cairo
 friends
 apport

或者尝试运行sudo apt-get install -f输出很多错误并像这样停止:

dpkg: error processing friends-twitter (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of python3-aptdaemon.pkcompat:
 python3-aptdaemon.pkcompat depends on python3-aptdaemon (= 1.0-0ubuntu9); however:
  Package python3-aptdaemon is not configured yet.

dpkg: error processing python3-aptdaemon.pkcompat (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: too many errors, stopping
Errors were encountered while processing:
 python3-dbus
 language-selector-common
 python3-gi
 python3-xkit
 ubuntu-drivers-common
 python3-commandnotfound
 ufw
 apparmor-utils
 python3-problem-report
 python3-apport
 apport
 apport-gtk
 python3-software-properties
 software-properties-common
 python3-defer

谢谢

答案1

好吧,我最终基于 Ubuntu 13.04 创建了一个 AWS 实例,然后将所有 Python 包从 EC2 移到我的服务器。这并没有解决 apt-get 和 dpkg 的问题,但它让我可以运行其他基于 Python 的命令(例如 ufw 和 do-release-upgrade)。

然后我使用 do-release-upgrade 切换到 Saucy,然后是 Trusty。升级过程中出现了一些错误,但总体来说成功更新到了 14.04。

更新完成后,我再次运行apt-get install -fdpkg --configure -a这次错误少了很多,但仍然失败了。我一个接一个地修复了错误,再次从另一台运行 14.04 的服务器借用损坏的软件包。

最后它迁移到 14.04 并且所有软件包问题也得到修复。

相关内容