WSL reports environment session uptime, not system uptime
- A brief description
Function calls requesting system uptime return the uptime for the current environment session, and not the uptime for the system.
- Expected results
System uptime
- Actual results (with terminal output if applicable)
Uptime of current WSL environment session, for example from a newly-spawned WSL session:

- Your Windows build number
14379
- Steps / commands required to reproduce the error:
- Open a WSL environment session using
bash.exeor similar. - Run
/bin/uptime - Wait a few minutes
- Run
/bin/uptime - Kill all Linux processes and end the current WSL session.
- Launch a new WSL session.
- Immediately run
/bin/uptime
- Required packages and commands to install
Nothing additional that isn't provided by running LxRun /install
If this is actually the intended behaviour, then feel free to close this IR, but please document it as the intended behaviour (as it is currently undocumented.)
Out of curiosity, is there something that is broken due to this behavior?
From the subsystem's perspective we do not "boot" until you launch bash.exe for the first time. Marking this as "by design." If you have a scenario that is broken because of this please let us know.
No broken scenario (yet), but I'm glad to see this clarified as a design decision.
On 25 Jul 2016 10:26 am, "Ben Hillis" [email protected] wrote:
From the subsystem's perspective we do not "boot" until you launch bash.exe for the first time. Marking this as "by design." If you have a scenario that is broken because of this please let us know.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/657#issuecomment-234987317, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdVxX-ygrSDdQuOh13GYZ4v9M5_KbWNks5qZNWngaJpZM4JNBuX .
Closing this out.
I realized you closed this out, but this is an issue for me. I really want to use WSL, but am forced to go with cygwin because of this.
While I understand why it responds this way, it really is quite astonishing of a response. Is there no way we can expose the system uptime for this?
Can you describe your scenario in more detail? You should be able to use interop (running .exes) to query Windows state.
We have a handful of windows machines in a mostly linux/unix environment. We have a system that remotely sshs in and checks a number of things, one of which is uptime. Rewriting the system to have a special code-path for the windows machines adds additional complexity incurring both immediate and future costs.
Not to mention, it's straight-up unexpected behavior to not have uptime show the time the system has been up. I don't think anyone who's used any linux or unix based system would ever expect that.
I'm not sure if this is the best place, please correct me if it is not.
Another use case I've found was having cron jobs execute during a particular time. If we have a WSL on the machine, it seems to be entirely halted making it impossible for cron to work. I'm running WSL version 2, on a CentOS 7 install.