I am on WSL2 and had/have Ubuntu 18.04 installed. I went through a couple of steps to upgrade versions (enabling systemd, creating a symbolic link for apt-pkg, etc.). I was finally able to run sudo do-release-upgrade
successfully and cat /etc/lsb-release
returns DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
.
However, my terminal and VS Code are still showing version 18.04. How do I fix this so I'm only using 22.04.1?
I was following instructions here and running these commands or variations of them:
$ sudo apt update
$ sudo apt upgrade -y
> wsl --shutdown
$ sudo apt --purge autoremove
$ sudo apt install update-manager-core -y
$ sudo do-release-upgrade
I also ran the following command from here when I wasn't able to run reboot
(before realizing I should just use wsl --shutdown
in Powershell):cd /mnt/c/ && cmd.exe /c start "rebooting WSL" cmd /c "timeout 5 && wsl -d $WSL_DISTRO_NAME" && wsl.exe --terminate $WSL_DISTRO_NAME
I was getting an error saying "No module found named 'apt-pkg'", so I followed instructions here. That then gave me command not found
error for do-release-upgrade
, but I fixed that with this info.
I finally fixed the apt-pkg error by creating a symbolic link as described here so Ubuntu was directed towards python 3.6 instead of a more recent version.
I was then getting this error message when trying to run sudo do-release-upgrade
:
A problem occurred during the update. This is usually some sort of network problem, please check your network connection and retry.Err https://packages.cloud.google.com/apt cloud-sdk InReleaseThe following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
I fixed that error by running curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
I was then finally able to run sudo do-upgrade-release
, but at the very end it prompts to reboot, so I wasn't able to do that in the same session and ended up just restarting my computer, hoping that would do the trick. It didn't (seem to at least)--I was still seeing Ubuntu 18.04. I hadn't run cat /etc/lsb-release
yet, so I don't know if it had updated there or not. Because I was still seeing 18.04 in the terminal and VSCode, I basically just started running variations of apt update/upgrade
and do-release-upgrade
, so it's quite possible I upgraded twice without realizing it.
Please let me know if any other info is needed.