Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  76] [ 0]  / answers: 1 / hits: 48342  / 2 Years ago, wed, june 8, 2022, 11:43:02

I'm new to WSL2-Ubuntu. My computer already had preisntalled the 20.04 version, but I saw there's already the 22.04 version, so I was wondering if it was worthy to have the new one. If so, how can I upgrade it?


More From » 22.04

 Answers
3

Short-answer:


In general, the process for upgrading Ubuntu on WSL is pretty much the same as from a "normal" Ubuntu CLI now:


sudo apt update && sudo apt full-upgrade
# restart Ubuntu
sudo do-release-upgrade

Explanation:


Side-note: I recommending reading this question and my answer for some background information about why the Microsoft Store version won't upgrade an existing Ubuntu/WSL release.



if it was worthy to have the new one



Since it's a brand new install anyway, I'd recommend going ahead and upgrading now, yes. Several reasons:



  • While no release is ever "perfect", 22.04 has been out for long enough now to reach the 22.04.1 milestone. That's important, because Canonical always waits for the first point release to move an LTS release into the "stable" channel. Prior to that, even though 22.04 was released in April, it was still considered a "development" release.



  • Eventually, you'll need to upgrade anyway. That "eventually" may be a long time down the road, since 20.04 will be supported for almost 3 more years, but you'll ultimately get 2 more years of support (from today) on 22.04 than you will on 20.04.



  • It's always easier to upgrade when you have fewer packages (especially anything from a PPA) on the system. Ubuntu upgrades are typically fairly painless, but the more you have installed, the more chance (even if still small) that something will require manual intervention on your part.




So yes, it's a good idea to go ahead and upgrade.



if so, how can I upgrade it?



There are two ways to go about this:


Delete and reinstall


First, if you really haven't starting using it yet, and are willing to just "delete and reinstall", you can go ahead and directly install 22.04. At some point, I would expect that the "Ubuntu" in the Store will move to 22.04, but as mentioned in the linked post, you still won't be able to use it to "upgrade" an existing distribution. For that reason, at least for the moment, use the "Ubuntu 22.04" release in the Store:



  1. To remove the existing distribution (of course, this is a destructive operation -- All data inside Ubuntu will be remove), from PowerShell:


    wsl -l -v
    # Confirm the distribution name and adjust below if needed
    wsl --unregister Ubuntu


  2. Then install or upgrade the "Ubuntu 22.04" release from the Microsoft Store.



  3. After installing from the Store, you can either launch it, or from PowerShell:


    ubuntu2004.exe install --ui=none

    Thank you @Blair, for pointing out in this answer the error in my previous instructions.


    This will take a few seconds, ask for your username and password, and complete. Your Ubuntu distribution under WSL should now be 22.04.






"Normal" 22.04 upgrade from 20.04


Set aside several hours where you won't need WSL. LTS upgrades takes a while.



  1. First, make sure your 20.04 installation is up-to-date:


    sudo apt update && sudo apt full-upgrade


  2. Close down Ubuntu on WSL, and from PowerShell:


    wsl -l -v 
    # Confirm the distribution name and adjust below if needed
    wsl --terminate Ubuntu


  3. Restart Ubuntu and:


    sudo do-release-upgrade

    There will be some user interaction required fairly early in the upgrade, IIRC. When complete, exit the upgrade screen session, restart Ubuntu again as above, and you should be good-to-go.


    Note: Several prior versions required that you remove the snapd package before upgrading. In several tests now on my own distributions, this no longer appears to be necessary for the 20.04 -> 22.04 upgrade. If you do get an error when upgrading, however, it might be useful to try sudo apt remove snapd and then try again.




After upgrading (for either method)


After upgrading, there are a few "annoyances" in 22.04 when running on WSL that you can easily correct. See:



I can't recall if either or both of these are present after an upgrade, but I know they are in the "stock" 22.04 WSL install.


[#247] Thursday, June 9, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
listeerrated

Total Points: 354
Total Questions: 112
Total Answers: 100

Location: Guam
Member since Fri, Jun 18, 2021
3 Years ago
listeerrated questions
;