-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WSL1] [glibc] sleep: cannot read realtime clock: Invalid argument #4898
Comments
Guidance on this issue in Ubuntu on WSL1 is here: https://discourse.ubuntu.com/t/ubuntu-20-04-and-wsl-1/15291:
Workarounds include:
If you need to reset Ubuntu and are on WSL 1, you should switch to the Ubuntu 18.04 image. I can confirm upgrading glibc from 2.30.3 to 2.31.1 on Arch on WSL breaks sleep. I used the Arch rootfs from the ArchWSL project: https://github.com/yuk7/ArchWSL/releases/download/20.2.7.0/Arch.zip Imported it. Confirmed 2.20.3 installed:
In /etc/pacman.conf changed SigLevel= to Never. Ran updates:
Confirmed new version:
Tried strace attached. |
It looks like sleep used to call:
Appears that support for nanosleep was added in 14915. But now calls:
The line in sleep is here: https://github.com/coreutils/coreutils/blob/master/src/sleep.c#L142
Here are the release notes for glibc 2.31.1, they mention some changes related to clock issues but nothing jumps out as directly related: https://sourceware.org/ml/libc-announce/2020/msg00001.html Also this may all technically be a duplicate of #2503 |
Most def. Apologies I saw this submission and knew it was dupe #2503 earlier in the afternoon, but got pulled away before I could hit the button. Thanks for going down the rabbit hole. I'll forward-dupe #2503 as a (probably bad precedent) bump. If this is in glibc it'll hit distros in the store soon enough. Presumably eating |
Between glibc 2.30 and 2.31 they add the following to /posix/nanosleep.c:
|
Right, this. |
Here an interesting related email thread:
|
Yeah. Ref. |
I was wondering would issues like these get backported to with cumulative updates, or I would I have to wait till the next window version. |
I spoke with one of the senior engineers on our foundations team and they do plan to land glibc 2.31, with the problematic change, in Ubuntu Focal 20.04, our next release in April. This one would be a useful to have backported unless it can be fixed upstream. |
sorry for commenting again I was wondering if there were going to have wait till the next window version to get it fixed? |
As @therealkenc surmised, the issue is the lack of CLOCK_REALTIME support in WSL1's clock_nanosleep. We have a fix working internally, which will make its way to insiders. We will also look into backporting this to older Windows versions, but I can't make any promises or provide a timeline for this, unfortunately. |
I believe this is the problem that caused 100% CPU utilization on a single core for the |
I've gotten 2.31 to work fine on my Arch install by recompiling the package with a patch to
If anyone's feeling adventurous, feel free to try this out. |
Close. You've got to be careful about |
That's a valid point, but |
This breaks Ubuntu Focal also. # uname -a
Linux [redacted] 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
# wslsys
Release Install Date: 0x5ceea999
Branch: 19h1_release
Build: 18363
Full Build: 18362.1.amd64fre.19h1_release.190318-1202
Uptime: 6d 4h 6m
Linux Release: Ubuntu Focal Fossa (development branch)
Linux Kernel: Linux 4.4.0-18362-Microsoft
Packages Count: 1367
# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libc-bin : Depends: libc6 (< 2.31) but 2.31-0ubuntu5 is installed
libc-dev-bin : Depends: libc6 (< 2.31) but 2.31-0ubuntu5 is installed
libc6-dev : Depends: libc6 (= 2.30-0ubuntu3) but 2.31-0ubuntu5 is installed
locales : Depends: libc-bin (> 2.31) but 2.30-0ubuntu3 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
# apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libc-bin libc-dev-bin libc6-dev libcrypt-dev
Suggested packages:
glibc-doc
The following NEW packages will be installed:
libcrypt-dev
The following packages will be upgraded:
libc-bin libc-dev-bin libc6-dev
3 upgraded, 1 newly installed, 0 to remove and 131 not upgraded.
2 not fully installed or removed.
Need to get 0 B/3331 kB of archives.
After this operation, 44.0 kB disk space will be freed.
Do you want to continue? [Y/n]
Setting up libc6:amd64 (2.31-0ubuntu5) ...
Checking for services that may need to be restarted...
Checking init scripts...
Nothing to restart.
sleep: cannot read realtime clock: Invalid argument
dpkg: error processing package libc6:amd64 (--configure):
installed libc6:amd64 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libc6:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1) |
Ubuntu Focal Fossa (20.04) also broken
|
I've run into this as well on Ubuntu 20.04, and I'm currently using sudo apt-mark hold libc6 to prevent libc from being updated to the version that breaks in WSL 1. |
I "fixed" it somehow on my install. Because the error is in the postinstall script of libc6 package, I simply edited /var/lib/dpkg/info/libc6:amd64.postinst and transformed "sleep 1" in "echo sleep 1". Of course this is not a fix and I think I did it worse: all calls to sleep will fail. But it was fun and Ubuntu WSL1 is not my main driver so I had nothing to lose ;) |
Will this be fixed for WSL1 or we can only count on WSL2? |
The latest build of Ubuntu 20.04 seems to be working fine without any issue in WSL1. |
@Kraml A fix is coming to WSL1, and we're looking into backporting it to currently released Windows versions. |
Simply do: pacman -U https://archive.archlinux.org/packages/g/glibc/glibc-2.30-3-x86_64.pkg.tar.xz ... as it will let pacman also automatically download the package's detached .sig file and verify it according to /etc/pacman.conf settings. And do you mean P.S. There should also be a default value |
I think I glanced at the wrong line when I added my comment, but I can't remember which was one already in there. Here's what those lines are currently set to in my pacman.conf. I updated my original comment to clarify. Thanks.
|
I ran into the same problem, and this procedure from this bug report fixed it:
|
how can i fix the bug of sleep cannot read real time clock invalid argument? im using the latest version of ubuntu . i then tried apt --fix-broken install but then Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) showed up! , please help how to fix this |
I am using this solution #4898 (comment) for a month. No trouble and much easier/secure. |
Could you suggest how to solve the compile errors under WSL1 Ubuntu 20.04 shown below ?
If the includes are changed to
, then the error becomes
The search list is shown below
|
@jiucenglou so you have libc6-dev installed? |
@jiucenglou If you want to compile some C or C++, them install at least the "build-essential" ubuntu/debian meta package. Save this hint in your knowledge base. build-essential is sufficient to compile nanosleep.c tiny C code.
|
@SuperSandro2000 @juliomaranhao Many thanks ! I failed to install build-essential because sleep was broken. The problem was then solved by using another fresh Ubuntu 20.04 instance. |
it is already fixed in last dev insider preview, but if you want to get it
in semi ann release, maybe you need to wait several month
Escape0707 <[email protected]> 于2020年8月7日周五 下午11:20写道:
|
Worked fine but it stops package manager to upgrade 3 packages to their previous state. But glad it worked... |
I have this problem on Ubuntu 20.04 from windows store, but not on Ubuntu 18.04. Debian also works fine. |
This is actually causing two problems on ArchWSL for me now: The first is this old |
I got the following error: Any suggestions? |
Seems like your systemd is too new, and it requires updated glibc or
libxcrypt. But I’m not very sure as well...
|
This also effects Kali, any chance you will have this fixed anytime soon?
|
@hellohackie : Thanks for your workaround, now let me expand on that.. You can work around this even more by installing busybox-static and using:
Observe:
|
last line didn't work for me, but changing the command a bit, and worked!
|
This issue is fixed for Insiders in the Beta channel and the Release Preview channel with 20H2 Build 19042.487 (KB4571744). I would recommend reversing any custom changes to your WSL once you've updated. |
Windows build number: Microsoft Windows [Version 10.0.18362.592]
WSL version: 1
Linux distro: Arch WSL
Description:
I'm using Arch WSL in WSL 1 and after an update which bumped glibc from 2.30.3 to 2.31.1 the sleep command stopped working throwing out the error: sleep: cannot read realtime clock: Invalid argument
This affects namely as Ansible, as ansible runs sleep commands in multiple modules. In this issue, on the Arch WSL github (yuk7/ArchWSL#108) , some problems with rust packages were also identified.
Downgrading to the previous version solves the issue. Now, I know that Arch WSL is not an official WSL implementation but this may actually happen when Ubuntu, etc, reach the aforementioned version of glibc
The text was updated successfully, but these errors were encountered: