如何恢复损坏的 ubuntu 系统?

如何恢复损坏的 ubuntu 系统?

我实际上是在尝试使用 update-alternatives 将我的 python 包更新到当前版本。由于我对此不太熟悉,我尝试通过观看 YouTube 视频来完成它。不幸的是,在其中一个视频中,我输入了命令,sudo unlink /usr/bin/python这导致终端和软件更新程序很快无法工作。但不知何故,我能够通过“文件”打开终端,而且当我尝试在过程结束时通过终端安装一些新软件(Xterm)时,它显示如下

kayalvizhi@eyegirl:~$ sudo apt-get install xterm
Reading package lists... Done
Building dependency tree       
Reading state information... Done

xterm is already the newest version (330-1ubuntu2).
The following packages were automatically installed and are no longer required:
  libllvm7 libllvm9
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  python3-distupgrade
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
Need to get 0 B/106 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
(Reading database ... 207547 files and directories currently installed.)
Preparing to unpack .../python3-distupgrade_1%3a18.04.38_all.deb ...
/var/lib/dpkg/info/python3-distupgrade.prerm: 6: /var/lib/dpkg/info/python3-distupgrade.prerm: py3clean: not found
dpkg: warning: old python3-distupgrade package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/python3-distupgrade_1%3a 18.04.38_all.deb (--unpack):
new python3-distupgrade package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/python3-distupgrade.postinst: 6: /var/lib/dpkg/info/python3-distupgrade.postinst: py3compile: not found
dpkg: error while cleaning up:
 installed python3-distupgrade package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/python3-distupgrade_1%3a18.04.38_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

然后我下达了命令

sudo dpkg--configure-a

kayalvizhi@eyegirl:~$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of ubuntu-release-upgrader-gtk:
 ubuntu-release-upgrader-gtk depends on python3-distupgrade (= 1:18.04.38); however:
  Version of python3-distupgrade on system is 1:18.04.37.

dpkg: error processing package ubuntu-release-upgrader-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-release-upgrader-core:
 ubuntu-release-upgrader-core depends on python3-distupgrade (= 1:18.04.38); however:
  Version of python3-distupgrade on system is 1:18.04.37.

dpkg: error processing package ubuntu-release-upgrader-core (--configure):
 dependency problems - leaving unconfigured
Setting up python3-lib2to3 (3.6.9-1~18.04) ...
Setting up python3-distutils (3.6.9-1~18.04) ...
dpkg: error processing package python3-distupgrade (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Setting up dh-python (3.20180325ubuntu2) ...
/var/lib/dpkg/info/dh-python.postinst: 6: /var/lib/dpkg/info/dh-python.postinst: py3compile: not found
dpkg: error processing package dh-python (--configure):
 installed dh-python package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of python3-all:
 python3-all depends on dh-python; however:
  Package dh-python is not configured yet.

dpkg: error processing package python3-all (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Errors were encountered while processing:
 ubuntu-release-upgrader-gtk
 ubuntu-release-upgrader-core
 python3-distupgrade
 dh-python
 python3-all

我还有一个红色的球体,里面有一个减号,每当我把光标移到它上面时,它就会显示

a problem occurred when checking for the updates

我怎样才能让一切恢复正常?

相关内容