我有一个运行网站的 AWS EC2 实例,在升级它时遇到了问题。
以下是我尝试过的步骤:
$ sudo apt update
$ sudo apt upgrade
在第一部分之后,一切看起来都很好,然后我继续:
sudo do-release-upgrade
然后我们出错了:
Traceback (most recent call last):
File "/tmp/ubuntu-release-upgrader-_29ga8ky/bionic", line 8, in <module>
sys.exit(main())
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeMain.py", line 238, in main
if app.run():
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 2072, in run
return self.fullUpgrade()
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1981, in fullUpgrade
if not self.askDistUpgrade():
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1153, in askDistUpgrade
changes = self.calcDistUpgrade()
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1120, in calcDistUpgrade
if not self.cache.installTasks(self.tasks):
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeCache.py", line 856, in installTasks
pkg.mark_install()
File "/usr/lib/python3/dist-packages/apt/package.py", line 1356, in mark_install
fixer.resolve(True)
SystemError: E:Unable to correct problems, you have held broken packages.
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/problem_report.py", line 497, in add_to_existing
self.write(f)
File "/usr/lib/python3/dist-packages/problem_report.py", line 450, in write
block = f.read(1048576)
File "/usr/lib/python3.5/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
Original exception was:
Traceback (most recent call last):
File "/tmp/ubuntu-release-upgrader-_29ga8ky/bionic", line 8, in <module>
sys.exit(main())
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeMain.py", line 238, in main
if app.run():
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 2072, in run
return self.fullUpgrade()
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1981, in fullUpgrade
if not self.askDistUpgrade():
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1153, in askDistUpgrade
changes = self.calcDistUpgrade()
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1120, in calcDistUpgrade
if not self.cache.installTasks(self.tasks):
File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeCache.py", line 856, in installTasks
pkg.mark_install()
File "/usr/lib/python3/dist-packages/apt/package.py", line 1356, in mark_install
fixer.resolve(True)
SystemError: E:Unable to correct problems, you have held broken packages.
=== Command terminated with exit status 1 (Thu Oct 22 03:03:11 2020) ===
在查看了更多错误之后,我认为这是我的问题所在,但我仍然卡住了,不知道从这里做什么:
Reinst Failed because of python3-zope.interface:amd64 MarkKeep python3-twisted [ amd64 ]
我认为关键是
E:Unable to correct problems, you have held broken packages
---如果你运行输出是什么apt-get -f install
(没有其他参数)。如果没有输出,输出是
apt-mark showhold
什么?如果第二个命令有任何输出,请尝试apt-mark unhold
每个包,然后运行apt-get update
thenapt-get dist-upgrade
。我最终不得不卸载
python3
,python-certbot-nginx
然后我能够继续我的安装。