Repository navigation
[WSL2] File changes made by Windows apps on Windows filesystem don't trigger notifications for Linux apps #4739
Description
WSL2 is really close to being a perfect runtime environment for server apps being developed in Windows. Great job! One missing feature however is breaking a core part of the developer flow.
For sources stored on the Windows filesystem, any changes made by Windows applications such as Visual Studio do not trigger any file change notifications as far as Linux apps are concerned. This means that all "live rebuild"-type tools don't work (examples: webpack --watch, jekyll --interactive, and Tilt.dev) when running under WSL2. This unfortunately renders many modern dev workflows unviable.
Notes:
- I strongly expect this is already a known issue as hinted here. However I was unable to find any open GitHub issue that specifically tracks this. Unable to save file when inotify is in use (using Node) #1956 is about a different scenario, File contents differs on mounted Windows drive between Windows and WSL #4064 isn't specifically about change notifications, [WSL 2] File watchers like create-react-app, gulp or sass doesn't work #4224 is closed, WSL2 Increase the maximum amount of inotify user watches #4293 doesn't fix it.
- I'm aware the WSL team suggests that with WSL2 it's good to store your application sources inside the Linux filesystem instead of the Windows one. However I don't think that's a viable solution since the whole point of WSL (for me) is to be able to use Windows-based editors such as full VS with a Linux dev environment. If it was sufficient to use Linux-based editors, I'd just use Mac/Linux as my actual OS and would have no need for WSL.
- This did work great on WSL1
- Changing
fs.inotify.max_user_watchesdoesn't affect this, since the issue is about changes originating on the Windows side.
Bug report template
-
Your Windows build number: 10.0.19033.1
-
What you're doing and what's happening:
This applies to all tools that listen for file change notifications, but as an example take
webpack. Repro steps:- In your Windows filesystem, create an empty directory (example:
c:\repro), and then add these three files to it - In a WSL2 Ubuntu 18.04 environment, install Node and NPM:
sudo apt-get install nodejs npm - Still in WSL2, go into the directory from earlier:
cd /mnt/c/repro - Restore NPM dependencies:
npm i - Run Webpack in watch mode:
npm run build:watch. Wait a few seconds until it completes the first build. It will now be waiting for further changes to your source files. - In a Windows application (e.g., Notepad or Visual Studio), open
c:\repro\index.jsand save some change to it. For example, change'Hello, world'to'Hello, world 2'.
- In your Windows filesystem, create an empty directory (example:
-
What's wrong / what should be happening instead:
Expected behavior: Webpack should see the change and rebuild. That is, you'll see it log information about another build, and the output in
dist/bundle.jswill be updated.Actual behavior: Webpack doesn't respond at all, because there's no file change notification.
Finally I understand that the fix for this is likely to be "add file watch capabilities to the Plan9 server", and you may feel this is already being tracked by #4064. However #4064 describes a more obscure symptom of this missing feature and makes it sound like an intermittent issue. What I'm reporting here is not intermittent at all, and is a pretty mainstream scenario (using tools like webpack --watch). Thanks!
Activity
therealkenc commentedon Dec 6, 2019
Yes, #4064 is most unfortunately titled. Worse, the OP has no repro steps and an unecessary symlink confusing the direction they are talking about. Craig's
notepad.exerepro withcatisn't aninotify(7)(file watcher) problem, even if implementinginotifyis the fix to whatever loosly implied sync problems are going on over there.Nevertheless #4701 got closed as a dupe with (quoth):
So, best I can tell, #4064 is being treated as the LZ for
inotifytriggers from Windows to WSL2. For lack. #4169 is pretty much exactly your use-case also landed dupe #4064.Yes, known regress.
nake89 commentedon Jan 4, 2020
Is there a temporary fix to this? This is giving me a headache.
Using Windows 10, WSL 2. Running npm run serve on my Vue project, which normally hot reloads when I do changes (on my Linux and Mac, and WSL1 and I think maybe WSL2 before(?)). Now I have to shut down and restart the Vue server.
Will probably just install Linux on this machine. Developing on a Windows machine is a real pain.
craigloewen-msft commentedon Jan 6, 2020
Kevin Kivi (@nake89) are you able to move your project over to the Linux root file system? i.e: Store in your Linux home folder for example? Are there any factors that are blocking you from doing so?
And per therealkenc 's comment this would be a much better landing zone for adding inotify to the 9P file server. I'll update my comment in #4701 to point here, and add some tags to this issue.
nake89 commentedon Jan 7, 2020
Craig Loewen (@craigloewen-msft) Thanks for messaging me back! I actually solved my issue by moving my project to the linux filesystem in WSL and have had no problems so far. I suggest doing the same. In VS Code simply type ctrl-shift-p and then type "Remote-WSL: New Window" This lets users use the linux filesystem in vs code, for those that did not know this :)
SteveSandersonMS commentedon Jan 7, 2020
Kevin Kivi (@nake89) That's great if your scenario allows it. But just to clarify for anyone else reading, that's not a solution in general as it doesn't work for other Windows-based editors such as VS.
craigloewen-msft commentedon Jan 7, 2020
Steve Sanderson (@SteveSandersonMS) agreed, we will still be tracking this issue here. :)
Carl-Hugo commentedon Feb 1, 2020
This is a great workaround that will save me lots of time until WSL2 supports this use-case. Thanks for sharing!
Carl-Hugo commentedon Feb 5, 2020
I wrote a small blog post explaining this workaround and talking about a few more things that I discovered/experienced, using Jekyll on WSL2: Speed up your builds to up to 375% and watch for changes for an even faster dev cycle using this workaround on WSL2/Ubuntu, if that can help someone.
Note: that applies to more than just Jekyll, Jekyll it was just the catalyst.
safizn commentedon Feb 5, 2020
For those stumbling upon, some notes about WSL2 features & limitations (OS build 19041.21, insiders slow ring):
\\wsl$\)localhostis managed for you by Windows, and allows access to WSL2. Some cases require accessing the WSL2 VM by it's IP directly.ivellios commentedon Mar 9, 2020
While I am having similar issue with my React App and I am looking for a solution to this as well, I can reply to:
This hint by @myuseringithub:
is a great one to help you! Also I found out yesterday that since
\\wsl$\is a network resource in Windows you can easily map it to a drive. Then in ANY editor/tool you can use it as if it was on your computer. Just go to the Explorer and manually enter this address to access the resource. You will most likely see "Ubuntu" folder. It is a root of your WSL and it can be mapped to the drive (right click -> map to drive). That helped me setup my project on WSL natively, while being able to edit in the windows editor.Though now I am struggling with Docker containers permissions, which I hope to solve separately and see if reloads in my app work.
Hope that helps.
nicks commentedon Mar 27, 2020
Is there anything that app devs can do to workaround this in their apps? e.g., is there a different file-change notification API that would work on WSL2 across filesystems? (there are a lot of different file-change notification APIs). Or should we wait patiently for inotify support?
Carl-Hugo commentedon Mar 27, 2020
You can use the Linux file system directly, accessible from Windows too; see #4739 (comment)
159 remaining items
raulcastillabravo commentedon May 11, 2025
I also solved it by moving my project to WSL (Windows Subsystem for Linux) and running everything from there. I’m using React with Vite inside a Dev Container, and fast refresh is now working properly.
It seems the root cause is that inotify events are not shared between the host and the container.
I wrote an article on LinkedIn explaining the full process to fix it:: https://www.linkedin.com/pulse/desarrollar-en-linux-dev-containers-desde-windows-ra%C3%BAl-castilla-bravo-cjqaf
raffaeler commentedon May 11, 2025
More simply, I solved by migrating to Ubuntu desktop without Windows at all.
Pros: much faster file system and better virtualization using KVM which allows me to virtualizing any peripheral (GPU included).
giuinnox commentedon Jul 25, 2025
i guess this problem is still there and it will not be fixed...
time to go back to linux?
kieronlanning commentedon Aug 14, 2025
Is this on a roadmap on the WSL team's board?
jankap commentedon Oct 5, 2025
Why should it? The solution is to work in the WSL filesystem, and Microsoft recommends that you do this whenever you open VS Code.
kieronlanning commentedon Oct 5, 2025
Because it's not always practical, and not obvious. It look a lot of effort to find out what the issue was in the first place - weeks of off and on investigation.
As this effectively silently fails in an un-standard way, yes... I think it requires a solution.
jankap commentedon Oct 6, 2025
I agree it should be made more obvious, i.e., better documented.
I'm afraid this is a complex problem that lies deep within the filesystem drivers; otherwise, they would have fixed it.
I wouldn't expect to get it solved, tbh. MS seems not to be focusing on WSL, devcontainer, remote development, etc., currently. Hope it will become the case again in the future.
dig12345 commentedon Oct 6, 2025
The problem with the WSL filesystem is that it is essentially temporal. A change to the windows user profile or an App Store app update can cause the filesystem to spontaneously vanish. There is a conflict between viewing a WSL image as a disposable container vs a persistent file store for one's work. Which is it? Additionally using the WSL filesystem from within windows is just as glitchy, so that leaves us with no cross-platform fully functional filesystem available. That is a very limiting factor to the WSL ecosystem IMO.
adamkerz commentedon Oct 7, 2025
??? What does that have to do with anything? I'm not using VS Code and why should I?
Using WSL filesystem is not an acceptable solution, VS Code or otherwise?
Wardrop commentedon Nov 21, 2025
+1 from me. I'm having to configure polling for everything due to
inotifynot working. I'm not familiar with many use cases of WSL/WSL2 other than for linux development on Windows, specifically for web development. This should be of higher priority in my opinion.The main problem with using the linux file system I find is data protection. I typically host my development directory with all my projects within a synced folder (e.g. OneDrive) on Windows, like anything else important on my windows machine, so I don't even have to think about. As I don't regularly collaborate with other developers, I'm only committing changes to git when hitting specific milestone or wanting to push out a release. Storing my uncommitted code within WSL therefore to me seems dangerous, unless I configure some kind of sync/backup regime which I'll need to periodically check or configure alerts for if it fails.
It's not an unsolvable problem, but it's more moving parts and more to configure and think about than I would have to compared to having my source files on Windows.
KenBrannigan commentedon Jan 1, 2026
I can't believe that we are still waiting for this after 6 years! When is this going to get done?
pdcmoreira commentedon Jan 2, 2026
You're avoiding the best possible data protection method at your disposal (regardless of WSL or Windows), which is commiting/pushing your code and then you are trying to make up for it with clunkier and less reliable methods.
I've had corrupted project files before, but that had nothing to do with WSL at all, it was purely at Windows/NTFS level.
I've never had corrupted WSL files so far, even through WSL crashes.
The only thing that always gave me peace of mind was always commiting and pushing the code, rigorously.
Now I completely moved on to Linux and everything is working flawlessly so far, zero headaches, it even feels more stable than Windows ever did. But the git discipline never changed.
fanxing-6 commentedon Mar 11, 2026
Surprisingly, it's still not fixed
badandyomega commentedon May 24, 2026
Adding a 2026-05 repro from a Docker-Desktop-on-WSL2 dev setup. Two
data points the original report doesn't cover:
just for Windows-app writes. In our setup, touches from inside the
container itself and from a sibling container sharing the same
bind mount also fail to produce inotify events. Polling sees all
three identically.
C:\...into a Linux container under Docker Desktop's WSL2backend exposes the same behavior, which means HMR / live reload
is broken not just under bare
/mnt/caccess but under the verycommon containerized-dev pattern as well.
Environment
6.6.87.2-microsoft-standard-WSL2, Node.js 20.20.2fs.inotify.max_user_watchesinside container: 1048576Minimal reproduction (~30 lines, no bundler)
Repro steps
Observed
Three writes, three
fs.watchFilepolling hits, zerofs.watchinotify events.
Workarounds tried that don't help
CHOKIDAR_USEPOLLING=1(confirms the broken channel is OS-level,not bundler-config-level)
container, Windows host) — all three see polling fire and inotify
stay silent
Happy to provide further diagnostics if useful (
stat -c '%y'crosschecks,
cat /proc/mountsfrom inside the container, strace of thefs.watchregistration showing what filesystem the inotify watch wasattached to, etc.).
inotify bridge: deliver Windows-side file changes to Linux watchers (#…