我尝试使用 GUI 更新管理器工具从 20.04 升级到 22.04。但仅在第一步之后它就一直崩溃。因此我尝试通过 CLI 运行命令进行升级sudo do-release-upgrade -d
。但我收到以下错误:
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [819 B]
Get:2 Upgrade tool [1,267 kB]
Fetched 1,268 kB in 0s (0 B/s)
authenticate 'jammy.tar.gz' against 'jammy.tar.gz.gpg'
extracting 'jammy.tar.gz'
Reading cache
Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit https://cli.github.com/packages stable InRelease
Hit http://dl.google.com/linux/chrome/deb stable InRelease
Hit http://packages.microsoft.com/repos/code stable InRelease
Hit http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit https://repo.protonvpn.com/debian stable InRelease
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit http://ppa.launchpad.net/swi-prolog/stable/ubuntu focal InRelease
Hit http://deb.anydesk.com all InRelease
Fetched 114 kB 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-nd8my0mh/jammy", line 8, in <module>
sys.exit(main())
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeMain.py", line 241, in main
if app.run():
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeController.py", line 2042, in run
return self.fullUpgrade()
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeController.py", line 1873, in fullUpgrade
if not self.doPostInitialUpdate():
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeController.py", line 906, in doPostInitialUpdate
self.quirks.run("PostInitialUpdate")
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeQuirks.py", line 99, in run
func()
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeQuirks.py", line 122, in jammyPostInitialUpdate
self._test_and_fail_on_pam_tally()
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeQuirks.py", line 395, in _test_and_fail_on_pam_tally
content = f.read()
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 0xd9 in position 16: invalid continuation 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-nd8my0mh/jammy", line 8, in <module>
sys.exit(main())
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeMain.py", line 241, in main
if app.run():
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeController.py", line 2042, in run
return self.fullUpgrade()
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeController.py", line 1873, in fullUpgrade
if not self.doPostInitialUpdate():
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeController.py", line 906, in doPostInitialUpdate
self.quirks.run("PostInitialUpdate")
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeQuirks.py", line 99, in run
func()
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeQuirks.py", line 122, in jammyPostInitialUpdate
self._test_and_fail_on_pam_tally()
File "/tmp/ubuntu-release-upgrader-nd8my0mh/DistUpgrade/DistUpgradeQuirks.py", line 395, in _test_and_fail_on_pam_tally
content = f.read()
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 0xd9 in position 16: invalid continuation byte
我尝试了在互联网上找到的每一个答案,但没有成功:(。请帮助解决此错误。
答案1
以下是一条链接带有手册。
文件“/tmp/ubuntu-release-upgrader-l3yamuwr/DistUpgrade/DistUpgradeQuirks.py”,第 395 行,位于 _test_and_fail_on_pam_tally
这是出现错误时正在运行的升级程序脚本。编辑该文件(以 root 身份)并转到第 395 行,您会发现自己处于“for”循环中:
for f in os.listdir('/etc/pam.d'): if f in ('common-account', 'common-auth', 'common-password', 'common-session', 'common-session-noninteractive'): # managed by pam-auth-updates, and any references to # pam_tally* will be handled by libpam-modules on upgrade # without breaking continue with open(os.path.join('/etc/pam.d', f)) as f: content = f.read() if re.search('^[^#]*pam_tally', content, re.MULTILINE): <--- >line 395 <snipped>
该脚本正在循环遍历 /etc/pam.d 中的文件。您可以去那里查找问题,也可以编辑脚本以查找在出现错误时正在处理哪个文件。如下所示:
with open(os.path.join('/etc/pam.d', f)) as f: for f in os.listdir('/etc/pam.d'): print ("Rob says: " + f) content = f.read()
现在从这个临时目录再次运行升级程序,其中包括上面所做的编辑。像这样:
sudo /tmp/ubuntu-release-upgrader-l3yamuwr/DistUpgrade/jammy
答案2
您的 /etc/pam.d 目录中很可能有一个二进制文件。tar 或其他类似的软件包文件是导致此错误的常见原因。
答案3
unicode 解码错误并不重要。错误根源是 apt 或 dpkg 无法解决软件包依赖问题。软件包名称可以提示您无法解决的问题。请查看下面的 apt 错误消息行。
我自己也遇到了 libc:i386 依赖 libgcc-s1:i386 的问题。在一台不需要 i386 软件包或已标记安装 i386 arch 软件包的机器上。
删除残留物*_i386.deb
,/var/cache/apt/archives
让 dpkg 继续。您可能会遇到完全不同的依赖性问题。