microsoft / microsoft/WSL

DNS resolution broken in Docker Desktop WSL after timezone change: "Clock change detected. Flushing caches" loop

Open
#13,777 12 comments 2 reactions 0 assignees View on GitHub
emailed-logs network
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

10.0.19045.6456

### WSL Version

2.6.1.0

### Are you using WSL 1 or WSL 2?

- [x] WSL 2
- [ ] WSL 1

### Kernel Version

6.6.87.2-1

### Distro Version

Ubuntu 22.04.5 LTS

### Other Software

Docker version 28.5.2, build ecc6942

### Repro Steps

1. Change timezone in WSL (e.g., via Ansible or manually).
2. Restart WSL.

### Expected Behavior

- Timezone changes should not break DNS resolution.
- systemd-resolved should not flush caches aggressively due to minor time adjustments.
- WSL should maintain network connectivity regardless of time sync issues.

### Actual Behavior

- DNS resolution fails permanently.
- Network connectivity is lost (even ICMP).
- Manual fixes (disabling systemd-timesyncd, restarting services) do not resolve the issue.

### Diagnostic Logs

After changing the timezone in WSL (using Ansible task community.general.timezone) to match the host system, DNS resolution stopped working entirely. The timezone was already the same as on the host, but the change triggered a cascade of issues:

1. systemd-resolved constantly flushes DNS cache
Logs `systemctl status systemd-resolved` show repeated messages:
```
systemd-resolved[139]: Clock change detected. Flushing caches.
```

This prevents any DNS resolution, as the cache is cleared before queries can complete.

2. systemd-timesyncd fails to sync time
Logs `systemctl status systemd-timesyncd` show timeouts when trying to reach NTP servers:
```
systemd-timesyncd[146]: Timed out waiting for reply from 91.189.91.157:123 (ntp.ubuntu.com).
```

This creates a "chicken and egg" problem: DNS fails because time is unstable, and time sync fails because DNS is broken.

3. No network connectivity. Even basic `ping 1.1.1.1` fails with:
```
From 172.23.150.55 icmp_seq=1 Destination Host Unreachable
```

Attempt fixes (none worked):
```
sudo timedatectl set-ntp false
sudo systemctl stop systemd-timesyncd
sudo systemctl disable systemd-timesyncd
sudo systemctl restart systemd-resolved
sudo hwclock -s
```
Disabled WSL time sync as per [Microsoft docs](https://learn.microsoft.com/en-us/windows/wsl/wsl-config#time-settings).
Restarted WSL (wsl --shutdown).

Can be usefull my current status too:
```
$ timedatectl status
Local time: Mon 2025-11-24 00:50:13 EET
Universal time: Sun 2025-11-23 22:50:13 UTC
RTC time: Sun 2025-11-23 22:50:13
Time zone: Europe/Warsaw (EET, +0200)
System clock synchronized: yes
NTP service: inactive
RTC in local TZ: no
```

Docker containers located in this wsl works fine.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the timezone-change and WSL restart steps, then inspect the systemd-resolved and systemd-timesyncd status logs described in the report. Compare DNS and ICMP connectivity before and after the change; done means WSL retains network connectivity and does not enter the repeated cache-flushing loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, linux
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.