升级 20.04 至 20.10 失败 UnicodeDecodeError

升级 20.04 至 20.10 失败 UnicodeDecodeError

do-release-upgrade 会抛出此错误

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/groovy", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeController.py", line 2089, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeController.py", line 1926, in fullUpgrade
    if not self.doPostInitialUpdate():
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeController.py", line 966, in doPostInitialUpdate
    self.tasks = self.cache.installedTasks
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeCache.py", line 823, in installedTasks
    for line in pkg._pcache._records.record.split("\n"):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xae in position 1030: invalid start byte
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/problem_report.py", line 477, in add_to_existing
    self.write(f)
  File "/usr/lib/python3/dist-packages/problem_report.py", line 430, in write
    block = f.read(1048576)
  File "/usr/lib/python3.8/codecs.py", line 322, 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-pi67sg1k/groovy", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeController.py", line 2089, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeController.py", line 1926, in fullUpgrade
    if not self.doPostInitialUpdate():
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeController.py", line 966, in doPostInitialUpdate
    self.tasks = self.cache.installedTasks
  File "/tmp/ubuntu-release-upgrader-pi67sg1k/DistUpgrade/DistUpgradeCache.py", line 823, in installedTasks
    for line in pkg._pcache._records.record.split("\n"):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xae in position 1030: invalid start byte
➜  ~ 

答案1

根据错误报告在 ubuntu 14.04 中,我发现这是一个软件包问题。

“do-release-update 退出并显示类似上述消息后,/tmp 中会残留一个临时的 ubuntu-release-upgrader-{random}。

  • 进入该目录,即 cd /tmp/ubuntu-release-upgrader-asd123
  • 编辑 DistUpgradeCache.py
  • 前往def installedTasks(self)
  • 在这行后面:for pkg in self:
  • 添加print(pkg)

找到有问题的包之后,这是出现错误之前的最后一个包(对我来说是intel-openvino-runtime-ubuntu18-2019.3.376

apt-get remove包裹

相关内容