Q:

sleep doesn't work on Ubuntu 20.04 (WSL)

After upgrading to 20.04 on WSL sleep doesn't work with an error:
sleep: cannot read realtime clock: Invalid argument

A:

wget https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1871129/+files/libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb

sudo dpkg --install libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb

sudo apt-mark hold libc6

sudo apt --fix-broken install

sudo apt full-upgrade

How to upgrade Ubuntu 18.04 to 20.04 on WSL Windows 10

A:

Just had this problem and I replaced the /usr/bin/sleep binary with a python script that roughly replaces the functionality.
Backup /usr/bin/sleep and replace with the file with the following contents
#!/usr/bin/env python3

import sys
import time

time.sleep(int(sys.argv[1]))

Remember to chmod +x /usr/bin/sleep after replacing.

A:

This is because of a bug in WSL1. Look here:
https://discourse.ubuntu.com/t/ubuntu-20-04-and-wsl-1/15291

The upcoming Ubuntu 20.04 implements glibc 2.31. Unless you are on Insider you have not gotten the fix for issue 4989 yet and likely will not for a couple months. Without the fix things tend to break on Ubuntu 20.04 on WSL 1, sometimes even in the upgrade process 9 to Ubuntu 20.04. For example htop doesn’t work on Ubuntu 20.04 on unpatched WSL 1.

