sleep doesn't work on Ubuntu 20.04 (WSL)
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
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.
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.
This command worked for me. use with root user privilege.
apt-mark hold libc6
apt --fix-broken install
apt full-upgrade
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:
- A standard post-install script is modified.
- The script change must be applied every time
libc6
is upgraded.