将 19.04 升级到 19.10 时出现问题“UnicodeDecodeError:'utf-8'编解码器无法解码位置 1 中的字节 0x8b:无效的起始字节

将 19.04 升级到 19.10 时出现问题“UnicodeDecodeError:'utf-8'编解码器无法解码位置 1 中的字节 0x8b:无效的起始字节

我照做了,并得到了这个回溯。之前我做过一些指向和指向的实验do-release-upgrade -d,但我对它们都进行了and ed 操作。upgrade-alternativespythonpython3python3python3.8sudo update-alternatives --remove-all pythonsudo apt install --reinstall

$ sudo do-release-upgrade -d
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [1,554 B]                                                         
Get:2 Upgrade tool [1,319 kB]                                                                  
Fetched 1,320 kB in 0s (0 B/s)                                                                 
authenticate 'eoan.tar.gz' against 'eoan.tar.gz.gpg' 
extracting 'eoan.tar.gz'

Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit http://ca.archive.ubuntu.com/ubuntu disco InRelease                                        
Hit http://ca.archive.ubuntu.com/ubuntu disco-updates InRelease                                
Hit http://security.ubuntu.com/ubuntu disco-security InRelease                                 
Hit http://ca.archive.ubuntu.com/ubuntu disco-backports InRelease                              
Ign http://dl.google.com/linux/chrome/deb stable InRelease                                     
Hit http://dl.google.com/linux/chrome/deb stable Release                                       
Fetched 0 B in 0s (0 B/s)                                                                      
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 802, in _prepare_snap_replacement_data
    di.version('%s' % self.controller.fromDist).split()[0]
AttributeError: 'UbuntuDistroInfo' object has no attribute 'version'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/eoan", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeController.py", line 2084, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeController.py", line 1921, in fullUpgrade
    if not self.doPostInitialUpdate():
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeController.py", line 927, in doPostInitialUpdate
    self.quirks.run("PostInitialUpdate")
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 97, in run
    func()
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 129, in eoanPostInitialUpdate
    self._calculateSnapSizeRequirements()
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 459, in _calculateSnapSizeRequirements
    self._prepare_snap_replacement_data()
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 808, in _prepare_snap_replacement_data
    (r.version for r in di.get_all("object")
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.7/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-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 802, in _prepare_snap_replacement_data
    di.version('%s' % self.controller.fromDist).split()[0]
AttributeError: 'UbuntuDistroInfo' object has no attribute 'version'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/eoan", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeController.py", line 2084, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeController.py", line 1921, in fullUpgrade
    if not self.doPostInitialUpdate():
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeController.py", line 927, in doPostInitialUpdate
    self.quirks.run("PostInitialUpdate")
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 97, in run
    func()
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 129, in eoanPostInitialUpdate
    self._calculateSnapSizeRequirements()
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 459, in _calculateSnapSizeRequirements
    self._prepare_snap_replacement_data()
  File "/tmp/ubuntu-release-upgrader-ymy3ktjy/DistUpgrade/DistUpgradeQuirks.py", line 808, in _prepare_snap_replacement_data
    (r.version for r in di.get_all("object")
AttributeError: 'UbuntuDistroInfo' object has no attribute 'get_all'

答案1

我有同样的问题。我按照以下步骤解决了它:

  1. 打开一个终端。

  2. 输入以下指令:

    wget https://salsa.debian.org/debian/distro-info/raw/master/python/distro_info.py 
    sudo cp /usr/local/lib/python3.7/dist-packages/distro_info.py  /usr/local/lib/python3.7/dist-packages/distro_info.py.old
    sudo cp distro_info.py /usr/local/lib/python3.7/dist-packages/distro_info.py
    
  3. 启动命令:

    sudo do-release-upgrade
    

答案2

根据https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1874250/comments/9“这似乎通常源于 pip 安装的 distro-info 版本掩盖了 apt 版本”,你可以使用以下命令删除 pip 安装的版本

sudo python3 -m pip uninstall distro-info 
sudo apt reinstall python3-distro-info

相关内容