我的 WSL2 目前只有一个发行版 - Ubuntu 18.04。我希望将其升级到最新版本,因此我运行了https://www.nextofwindows.com/how-to-upgrade-existing-wsl-wsl2-ubuntu-18-04-to-20-04,即:
sudo apt update
sudo apt list --upgradable
sudo apt upgrade
sudo apt --purge autoremove
sudo apt install update-manager-core
sudo do-release-upgrade
对于最后一步,我必须按照https://askubuntu.com/a/1296373/611551,即链接/usr/lib/ssl/cert.pem
到/etc/ssl/certs/ca-certificates.crt
,但它最终运行,只是随后不久就失败了:
Reading cache
Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://archive.ubuntu.com/ubuntu bionic InRelease
Hit http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit https://download.docker.com/linux/ubuntu bionic InRelease
Hit http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease
Fetched 0 B in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Restoring original system state
Aborting
Reading package lists... Done
Building dependency tree
Reading state information... Done
=== Command terminated with exit status 1 (Thu Oct 6 16:35:52 2022) ===
然后它就挂了。此时我别无选择,只能中止它。重试没有帮助。
我究竟做错了什么?
答案1
根据我的经验,这通常是由于旧版本升级中存在软件包snapd
以及 WSL 中缺乏 Systemd 支持而导致的。在运行之前sudo do-release-upgrade
,请尝试:
sudo apt remove snapd
希望升级能够如预期进行。