do-release-upgrade 启动失败 - 原因 python3

do-release-upgrade 启动失败 - 原因 python3

我在将 Ubuntu (budgie) 从 20.04 升级到 20.10 时遇到了问题。每当更新过程开始时,就会出现以下错误

$ do-release-upgrade 
Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree        
Reading state information... Done

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-6xunjon_/groovy", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-6xunjon_/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-6xunjon_/DistUpgrade/DistUpgradeController.py", line 2089, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-6xunjon_/DistUpgrade/DistUpgradeController.py", line 1910, in fullUpgrade
    if not self.askLivepatch():
  File "/tmp/ubuntu-release-upgrader-6xunjon_/DistUpgrade/DistUpgradeController.py", line 1173, in askLivepatch
    version = next((r.version for r in di.get_all("object") if r.series == self.toDist), self.toDist)
AttributeError: 'UbuntuDistroInfo' object has no attribute 'get_all'
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-6xunjon_/groovy", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-6xunjon_/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-6xunjon_/DistUpgrade/DistUpgradeController.py", line 2089, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-6xunjon_/DistUpgrade/DistUpgradeController.py", line 1910, in fullUpgrade
    if not self.askLivepatch():
  File "/tmp/ubuntu-release-upgrader-6xunjon_/DistUpgrade/DistUpgradeController.py", line 1173, in askLivepatch
    version = next((r.version for r in di.get_all("object") if r.series == self.toDist), self.toDist)
AttributeError: 'UbuntuDistroInfo' object has no attribute 'get_all'
=== Command detached from window (Wed Oct 28 00:49:32 2020) ===
=== Command terminated with exit status 1 (Wed Oct 28 00:49:42 2020) ===

问题被确定与 Python 有关。当尝试重新安装 Python 时,问题显示如下

$ sudo apt install --reinstall python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 to upgrade, 0 to newly install, 1 reinstalled, 0 to remove and 0 not to upgrade.
Need to get 47.6 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 python3 amd64 3.8.2-0ubuntu2 [47.6 kB]
Fetched 47.6 kB in 0s (109 kB/s)
(Reading database ... 569444 files and directories currently installed.)
Preparing to unpack .../python3_3.8.2-0ubuntu2_amd64.deb ...
running python pre-rtupdate hooks for python3.8...
Unpacking python3 (3.8.2-0ubuntu2) over (3.8.2-0ubuntu2) ...
Setting up python3 (3.8.2-0ubuntu2) ...
running python rtupdate hooks for python3.8...
/usr/share/bleachbit/bleachbit/__init__.py:260: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if msgctxt is not None and msgctxt is not "":
/usr/lib/budgie-desktop/plugins/budgie-advanced-brightness-controller/MyLog.py:40: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if (path is not ""):
/usr/lib/budgie-desktop/plugins/budgie-advanced-brightness-controller/XrandrHelper.py:52: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if (self.dimCacheFilePath is not ""):
/usr/lib/budgie-desktop/plugins/budgie-advanced-brightness-controller/XrandrHelper.py:63: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if (self.dimCacheFilePath is not ""):
/usr/lib/budgie-desktop/plugins/budgie-advanced-brightness-controller/XrandrHelper.py:86: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.noOfDisplays is 1:
/usr/lib/budgie-desktop/plugins/budgie-advanced-brightness-controller/XrandrHelper.py:88: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif self.noOfDisplays is 2:
/usr/lib/budgie-desktop/plugins/budgie-advanced-brightness-controller/XrandrHelper.py:127: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if (path is not ""):
/usr/share/mkchromecast/mkchromecast/cast.py:103: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if iface is not None and iface[0]['addr'] is not '127.0.0.1':
/usr/share/mkchromecast/mkchromecast/systray.py:787: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if platform is 'Darwin':
/usr/share/mkchromecast/mkchromecast/systray.py:793: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if platform is 'Linux':
/usr/share/mkchromecast/mkchromecast/systray.py:854: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if platform is 'Darwin' and self.notifications is 'enabled':
/usr/share/mkchromecast/mkchromecast/systray.py:854: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if platform is 'Darwin' and self.notifications is 'enabled':
running python post-rtupdate hooks for python3.8...
Processing triggers for man-db (2.9.1-1) ...
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
~$ readlink -f /etc/os-release
/usr/lib/os-release

这里存在什么问题?

答案1

我已经确定问题与 Python 有关,因此我使用以下命令手动删除了模块发行版信息

python3 -m pip uninstall distro-info

然后,我重新安装了如下内容

sudo apt install --reinstall python3-distro-info

这就对了。

do-release-upgrade 

它是固定的并且运行良好。

相关内容