After upgrading to 20.04 on WSL sleep doesn't work with an error:
sleep: cannot read realtime clock: Invalid argument
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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.
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
Just had this problem and I replaced the
/usr/bin/sleep binary with a python script that roughly replaces the functionality.
/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))
chmod +x /usr/bin/sleep after replacing.
It's far from ideal but another workaround is to edit
/var/lib/dpkg/info/libc6:amd64.postinst and comment out the
set -e at the top of the script (insert a
# as the first character in the line).
You will still receive the
sleep: cannot read realtime clock: Invalid argument error but it will not cause the upgrade of the package to abort.
It's not ideal because:
Installing this via dpkg on the Surface Pro X solved it for me, https://ubuntu.pkgs.org/19.10/ubuntu-updates-main-arm64/libc6_2.30-0ubuntu2.2_arm64.deb.html
After install I ran wsl -t Ubuntu in PowerShell then sudo apt-mark hold libc6.
I just installed Ubuntu 20.04 using WSL 1 (my windows 10 version is 1903, OS Build 18362.778) and got this error trying to run a redis server.
Thanks to Raj's link to https://www.how2shout.com/how-to/how-to-upgrade-ubuntu-18-04-lts-to-20-04-lts-on-wsl-windows-10.html I got it fixed using what it suggested there.
sudo -i sudo mv /bin/sleep /bin/sleep~ ; touch /bin/sleep ; chmod +x /bin/sleep
After that the redis server ran ok.