# Localhost unreachable on Windows Subsystem for Linux (WSL2, Ubuntu) (Git Issue #: 69765)

**URL:** <https://forum.ansible.com/t/localhost-unreachable-on-windows-subsystem-for-linux-wsl2-ubuntu-git-issue-69765/33069>\
**Category:** Ansible Project\
**Tags:** windows, ubuntu\
**Created:** [June 1, 2020, 11:37pm UTC](https://forum.ansible.com/t/localhost-unreachable-on-windows-subsystem-for-linux-wsl2-ubuntu-git-issue-69765/33069 "2020-06-01T23:37:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo2](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@Leo2](https://forum.ansible.com/u/Leo2)\
**Post date:** [June 1, 2020, 11:37pm UTC](https://forum.ansible.com/t/localhost-unreachable-on-windows-subsystem-for-linux-wsl2-ubuntu-git-issue-69765/33069/1 "2020-06-01T23:37:47Z")

</div>

Hi everyone,

I opened an [issue](https://github.com/ansible/ansible/issues/69765)at Github project but unfortunately got closed unexpectedly. I still believe the there are some compatibility problems between Ansible and WSL, because the scenario I described in the issue worked fine on local docker as well as on my vm boxes.

##### SUMMARY

Unable to establish connection to localhost under Windows Subsystem for Linux (WSL, Ubuntu)

##### ISSUE TYPE- Bug Report

##### COMPONENT NAME

Network

##### ANSIBLE VERSION

```auto
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]

```

##### CONFIGURATION

```auto
DEFAULT_LOCAL_TMP(/etc/ansible/ansible.cfg) = /tmp/ansible-local-2309_h96pb5

```

##### OS / ENVIRONMENT

OS:  
OS Name: Microsoft Windows 10 Pro (Version 1909)  
OS Version: 10.0.18363 N/A Build 18363

WSL:  
Distributor ID: Ubuntu  
Description: Ubuntu 20.04 LTS  
Release: 20.04  
Codename: focal

##### STEPS TO REPRODUCE

Run this command:

```auto
ansible localhost -m ping

```

##### EXPECTED RESULTS

The ping request successfully poerformed, and Ansible returns the following:

```auto
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

```

##### ACTUAL RESULTS

The ping request failed. The following error returned:

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [June 2, 2020, 12:25am UTC](https://forum.ansible.com/t/localhost-unreachable-on-windows-subsystem-for-linux-wsl2-ubuntu-git-issue-69765/33069/2 "2020-06-02T00:25:28Z")

</div>

With the further details exposed by -vvv we can see the error message when it tried to create the temp folder

> sleep: cannot read realtime clock

A quick google search brings up an issue on the WSL repo about this problem [https://github.com/microsoft/WSL/issues/4898](https://github.com/microsoft/WSL/issues/4898). Looks like there are some workarounds in that post that indicate it’s due to a recent package update that isn’t handled by WSL. Ansible has no guarantees that it will work properly on WSL, while most things are fine you’ve encountered one of those edge cases which stop us from officially supporting/testing Ansible on this platform. There is nothing we can do here but rely on WSL implementing the POSIX syscalls that Ansible relies on.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Leo2](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@Leo2](https://forum.ansible.com/u/Leo2)\
**Post date:** [June 2, 2020, 3:02pm UTC](https://forum.ansible.com/t/localhost-unreachable-on-windows-subsystem-for-linux-wsl2-ubuntu-git-issue-69765/33069/3 "2020-06-02T15:02:16Z")

</div>

Thanks For pointing the direction Jordan!

I was able to solve the problem by installing libc6\_2.31 on my WSL Ubuntu. The steps are as following:  
[Download libc6\_2.31-0ubuntu9\_amd64.deb.zip](https://github.com/microsoft/WSL/files/4603734/libc6_2.31-0ubuntu9_amd64.deb.zip)  
mv libc6\_2.31-0ubuntu9\_amd64.deb.zip libc6\_2.31-0ubuntu9\_amd64.deb

sudo dpkg -i libc6\_2.31-0ubuntu9\_amd64.deb

When I ran “ansible localhost -m ping” again, I was able to get the following:

localhost | SUCCESS =\> {  
“ansible\_facts”: {  
“discovered\_interpreter\_python”: “/usr/bin/python3”  
},  
“changed”: false,  
“ping”: “pong”  
}

As Jordan mentioned, this is a problem on the WSL side rather than Ansible itself. Hope the above helps whoever encountered the same problem.
