Windows 10 V.1909 and WSL1 Ubuntu 20.04 LTS

Ubuntu in the Windows Store just had an update to 20.04 LTS, the new long term support version, which is great, but at the moment can…

Windows 10 V.1909 and WSL1 Ubuntu 20.04 LTS

Ubuntu in the Windows Store just had an update to 20.04 LTS, the new long term support version, which is great, but at the moment can cause some issues when running in Windows Subsystem for Linux V1 on Windows 10 V.1909.

In short, Ubuntu 20.04 LTS has an issue that arises from a patch in glibc 2.31 18 that implements a nanosleep() library call in a more UNIX-like manner 17 based on CLOCK_REALTIME as outlined here.

So, if you install Ubuntu fresh on a Windows 10 (Version 1909) system from the store’s “Ubuntu” link now, some features won’t work. For example, /bin/sleep will return an error: “cannot read realtime clock: invalid argument” and htop will just show a blank screen.

This is because the distribution makerd “Ubuntu” used to be 18.04 LTS and is now 20.04 LTS. The older release has received it’s own store entry now named “Ubuntu 18.04 LTS”.

To install a fresh copy of Ubuntu, you should for the moment use “Ubuntu 18.04 LTS”.

If you installed Ubuntu before on your system, the store will update it, but it will not do a version change for you. So you will not be running into the issue.

To find the version of the distro running on your system, run:

$ lsb_release -a

To update an existing Ubuntu distro that was installed via the Windows Store, you need to run sudo do-release-upgrade -d but beware because right now, it will fail to upgrade to 20.04 for exactly the reason above — the version upgrade uses the “sleep” command that is not working.

WARNING. DANGEROUS STEPS AHEAD.

Should you anyway want to currently upgrade from 18.04 LTS to 20.04 LTS on your WSL1 system, you would have to temporarily substitute the sleep command with a dummy:

$ sudo mv /bin/sleep /bin/sleep~ ; sudo touch /bin/sleep ; sudo chmod +x /bin/sleep

and then upgrade.

$ sudo do-release-upgrade -d

In the end, you can copy back the original sleep (which will now fail to run due to the bug mentioned above).

$ sudo rm /bin/sleep ; sudo mv /bin/sleep~ /bin/sleep

Then, to make sure everything worked, do a:

$ sudo apt update

$ sudo apt upgrade -y

To remove old, unused packages you can run:

$ sudo apt autoremove -y

Should the system report that packages were “held back”, you can update them individually using:

$ sudo apt install "name-of-held-back-package"