Score:11

How do I install Ubuntu 21.10 in WSL on Windows 11?

cn flag

I do not see the option to install Ubuntu 21.10 in the Windows Store.

I would like to install Ubuntu 21.10 in WSL on Windows 11 with the graphical support (WSLg). I have searched for "Ubuntu" in the Windows Store and only found older releases.

Score:20
vn flag

Please note that this answer is valid and tested on the released version of Ubuntu 20.04 only. As @GavinRay has reported in a separate answer, there are issues with this process on the Ubuntu Community Preview for WSL (currently using 21.04). Please see Gavin's answer for a solution there.

Ubuntu only provides (and tests) LTS releases for direct download and installation on WSL.

You can install the base "Ubuntu" distribution (which is currently 20.04) and then upgrade it to 21.10 with a slight variation on the normal mechanism:

  • sudo apt update && sudo apt upgrade to make sure the existing release is up-to-date.

  • sudo apt remove snapd -- Needed because WSL doesn't support Systemd directly

  • Sudo edit /etc/update-manager/release-upgrades and change the last line to:

    prompt=normal
    
  • sudo do-release-upgrade to upgrade to Hirsute/21.04

  • Recommended: Exit WSL, execute wsl --terminate Ubuntu from PowerShell or CMD, and restart WSL/Ubuntu.

  • Repeat sudo do-release-upgrade to upgrade to Impish/21.10

  • Recommended: sudo apt purge needrestart to get rid of unnecessary checks after installing any package.

Again, this is not a scenario that Canonical seems to necessarily test, but people have been doing it for a while (as well as installing many other different distributions).

After upgrading, I do recommend creating a backup image. This can be used to create new, clean 21.10 installations in the future if you need to try something out without impacting your normal one.

wsl --export Ubuntu Ubuntu2110_fresh_install.tar

Create new installations from it by creating a directory, and:

wsl --import Ubuntu2110Test <directory> Ubuntu2210_fresh_install.tar

I personally just go ahead and create a new installation automatically. It has the advantage of:

  • Letting me name the installation what I want (e.g. 'Ubuntu-21.10`)
  • Placing it somewhere other than under %userprofile%\AppData\Local\Packages
vn flag
This just worked for me, thanks! One almost-trivial correction (maybe of use to someone): You missed a hyphen in one command: `sudo do-release upgrade` should of course read epeat`sudo do-release-upgrade`
NotTheDr01ds avatar
vn flag
@RobCranfill Oops! Thanks for pointing that out - Fixed! And glad it helped!
Jim avatar
um flag
Jim
A little note for docker user: https://patrickwu.space/2021/03/09/wsl-solution-to-native-docker-daemon-not-starting/
NotTheDr01ds avatar
vn flag
@Jim Good info, but it looks a bit out-of-date since WSL2's kernel is now up to 5.10. Do you know if `nftables` is still a problem in WSL2 with the latest kernel?
Jim avatar
um flag
Jim
@NotTheDr01ds Unfortunately yes, I've tested on `Linux DESKTOP-7IQV62O 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux`, and `nftables` is still a problem, and finally found an article I mentioned above as a temporary solution.
NotTheDr01ds avatar
vn flag
@Jim Thanks for confirming. And ... bummer. Wonder if Canonical or Microsoft will do something about this before the pending LTS release.
NotTheDr01ds avatar
vn flag
@Jim Just a heads-up that the [Launchpad issue](https://bugs.launchpad.net/ubuntu-wsl-integration/+bug/1908539) is marked "Fix Released". If I get a chance, I'll dig deeper and try to repro on my end. Currently I'm using my 21.10 distro for Podman, but it's easy enough to create another.
Score:4
in flag

Warning - On the Community Preview version of Ubuntu (currently 21.04), the process described by @NotTheDr01ds's answer results in a "nearly bricked" WSL instance.

After the upgrade completes and you exit Ubuntu, relaunching it results in a No schemas installed error. It then exits immediately, making it extremely difficult to troubleshoot the issue.

This happened when trying to launch Ubuntu Community Preview either from Windows Terminal or the Start menu shortcut.

Fortunately, you can still launch via wsl bash. (Side note: This is because running bash this way does not result in a login shell, so the "problem script" in /etc/profile.d/wsl-integration.sh does not run.)

This very cryptic error turned out to be related to something called gsettings.

After starting via wsl bash, I was able to resolve it by running sudo apt install gsettings-desktop-schemas. Ubuntu now starts normally.

I reported this on the WSL Github as well.

Also see the LaunchPad issue reported to the Canonical/Ubuntu WSL team.

AlMo320 avatar
cn flag
I got a `command not found` running `sudo do-release-upgrade` and at this point, it would just be a couple months wait to receive the official Jammy release for WSL, but still ...
WinEunuuchs2Unix avatar
in flag
Sorry you went through all the grief. This Q&A may have helped you if you read it first: [What's the easiest way to run GUI apps on Windows Subsystem for Linux as of 2018?](https://askubuntu.com/questions/993225/whats-the-easiest-way-to-run-gui-apps-on-windows-subsystem-for-linux-as-of-2018).
NotTheDr01ds avatar
vn flag
@WinEunuuchs2Unix I'm not sure how that's relevant to this answer (or question)? The "Preview" release that this user was attempting to upgrade from didn't exist back when the question you referenced was asked or answered. Nor does it mention the `No schemas found` problem nor the `gsettings` solution.
NotTheDr01ds avatar
vn flag
I think it's okay that you didn't leave this one as a comment -- It seems viable as its own answer to me, since you were coming from 21.04 on the "Preview" release and my instructions were from the "released" version. Your answer will hopefully help out anyone else attempting to use that particular path.
NotTheDr01ds avatar
vn flag
Just a note that I reproduced this issue on the Community Preview. This has already been reported to the Canonical team [here](https://bugs.launchpad.net/ubuntu-wsl-oobe/+bug/1949414) by several folks. I've tracked the problem down to `/etc/profile.d/ wsl-integration.sh`. It didn't occur when you did `wsl bash`, since that skipped running the profile scripts, but you just got *really* lucky there ;-).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.