inotify worked in WSL1. Then it was deliberately turned off in WSL2 due to an unsupported feature in a GNU software which is now solved.
How can inotify be enabled or turned on in WSL2?
inotify worked in WSL1. Then it was deliberately turned off in WSL2 due to an unsupported feature in a GNU software which is now solved.
How can inotify be enabled or turned on in WSL2?
inotify is supported in WSL2, but only on the Linux-based ext4 filesystem. Where you may be having trouble is that it does not work on Windows drives which are mounted using the 9P protocol (e.g. /mnt/c
) or symlinks to any files on those drives.
I'm unaware of this being (per the question) due to "an unsupported feature in a GNU software which is now solved", nor it being "deliberately turned off". It's my understanding that the WSL team just hasn't "plumbed" (their word from the 2019 Build Conference) it in 9P.
It does, as you mention work in WSL1 on Windows drives mounted via drvfs, and using WSL1 is still a viable option for many development tasks. Of course, this is only necessary if you require that your watched files be on a Windows drive. Also note that WSL1 really used the Windows drive for both the Linux filesystem (via an overlay of sorts in your WSL1 directory), so if inotify worked for one, it likely worked for both for the same reason (same implementation of syscall translation).
The simplest solution, though, if it meets your workflow, is to just move your project somewhere on the WSL/Linux/ext4 filesystem, such as under your $HOME
folder (again, not using a symlink).
As for how to enable it, I don't think that's going to be possible. While the 9P client is open-source and included in the WSL2 kernel Github project here, the server that runs in Windows and provides access to those drives is, as far as I know, still closed-source.
For more details, see this answer.