Closed mablae closed 7 years ago
Thanks for reporting the issue.
Currently, only portions of procfs are implemented and there is limited inotify support. To get this on our priority list can you add it to our [UserVoice](https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/category/161892-bash page) page? Thanks again for trying out WSL!
I just added at UserVoice request for filesystem watchers & inotify. https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13469097-support-for-filesystem-watchers-like-inotify
@patryk9200 Thanks!
All of the node.js watch functions that I've tried fail on EPERM. I've ensured that all files and directories that it's trying to access have the proper ownership group and user. I even tried running watch tasks as the root user, and I receive the same eperm issue. I've also made sure that all of the files are listed inside the linux subsystem, and that I'm not trying to watch files mounted to /mnt/c/
JSMike: It does not work. This is why we opened this issue :smile:
yes, I was just trying to add detail
Thanks for the feedback. Inotify will not be fully supported in the Anniversary update, but we are tracking the work for future insider builds. If you haven't already, please vote on the user voice page for inotify (https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13469097-support-for-filesystem-watchers-like-inotify).
I'm in the same boat #697 .. I have to go back to CygWin until we can see this resolved. I am very excited about this in Windows though. I spent a good day trying to get our dev kit working, and from what I can tell, the build is very solid. But yes, I also fell into missing proc/sys/net problems with mongo too so we will have to come back once these features are enabled.
@SRGOM -- I don't know that there's automated telemetry, but users can vote on issues here:
So Microsoft does have some information about both which features people want to use and how much they care about them.
On that note -- have you voted for this issue there? It's relatively high on the list.
Just posting here to show how much I would love to see this feature implemented
@meffect if you haven't already, you should throw three votes at it on the UserVoice page linked above. It has gotten a lot of traction lately, but hasn't yet been tagged by the MS team.
how about how to work around the issue in the meantime??? for example what config settings etc, need to be used for a basic rails 5x install?
I generated my app with --skip-spring --skip-listen
. Then when I run guard I use guard -p
to force polling mode. I thought about trying to get spork running instead of spring, but I haven't done that yet. Guard without Spring does make TDD a slow and painful process, though. So I love seeing that UserVoice page getting more votes.
Thanks @jwsloan
If you have already generated a rails app, here is what you have to do to fix:
1) comment out this gems listen, spring, and spring-watcher-listen in the Gemfile:
#gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
#gem 'spring'
#gem 'spring-watcher-listen', '~> 2.0.0'
I am not sure you have to comment out spring / spring-watcher-listen, but that works for me...
Then in the development.rb comment out this line:
#config.file_watcher = ActiveSupport::EventedFileUpdateChecker
and of course bundle install...
Good call on the file_watcher
config, @catmando. I forgot about that part. I had to do that as well.
@jwsloan Yep I gave it 3 votes. Imo, it looks more important than some of the ones above it so hopefully microsoft will tag it soon
My currently blocking issue is writing an web application. typescript -watch and gulp -watch no workie. My way around it is to use node/npm windows binaries for gulp and typescript. the work around is ok, but not ideal for me because I use conemu to open 4 bash terminals inside a single window. i dont really like having to open a second window to call windows binaries for various reasons, mainly extra screen real estate needed. Also i'd much prefer to not have those windows binaries installed at all on my machine and just have the linux ones.
But ya there seem to be many other issues out there where you cant really work around them
Personally the workaround I used with a rails 5 application was to modify the file_watcher
config in development.rb
so that it can be disabled with an environment variable.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker unless ENV['NO_INOTIFY']
Then set the the NO_INOTIFY
environment variable in my .zshrc
. That way one can still easily collaborate with people not using WSL, or just dev on other machines without Gemfile mess :)
I didn't need to do anything with the Gemfile at all here, it seemed to fall back to polling nicely.
Thanks for the info, @bluefantail. Are you using Spring with that setup?
Yea I am, I initially thought that would be an issue as well and tried re-bundling without it (unsuccessfully). Disabling the file_watcher seemed to do the job, without the need for disabling spring at all. I'm newish to rails, but I can only presume if spring is an issue, the config also disables the spring-listen file watchers as well, or something like that. This is the Gemfile in question https://github.com/bluefantail/bathtub/blob/master/Gemfile
Major blocker for any modern web dev workflow.
Voted on UserVoice (glad to see it high on the list there) but, yeah... oof. I was over the moon excited for Bash on Windows until I slammed into this reality. As everyone has said, this impacts a significant slice of modern web development tooling.
:beers: praying for a fix in the near future :beers:
@bluefantail: It looks like config.file_watcher = ActiveSupport::FileUpdateChecker
may be a better workaround then actually removing the config line. FileUpdateChecker
does not cause the same issue as EventedFileUpdateChecker
.
That will allow you to be able to run rails server
, and you should still get reloaded assets during local development, but it will not help with running rails test
. With Spring loaded, that still is causing me issues. TDD becomes very tedious without Spring...
Just a comment noting I've run into the EPERM error with nodejs+grunt-contrib-watch ... it fails so badly you can't even ctrl+c/ctrl+d out, you have to kill WSL entirely.
Like other commenters, it's a blocker to actually using WSL for production level dev. Not trying to be difficult, just indicating the severity/importance. Have voted on user voice as well.
Hey. I think I might have run into the same problem with EPERM when using Ember.js, which uses NodeWatcher or facebook watchman.
/cc BackRef: jekyll/jekyll#5233
I found a workaround for this, which may help you all out.
The issue is that the watch function is using filesystem events that are not currently being exposed to the windows 10 bash shell. Workaround, in short, is to poll for changes instead of listening for events.
For those of you using gulp, you use the gulp-watch
package:
var watch = require('gulp-watch');
gulp.task('sass', function() {
//Compile my sass
});
gulp.task('serve', ['sass'], function() {
//Watch for changes and run sass task
watch("./scss/**/*.scss", {usePolling:true}, function(){
gulp.start('sass');
});
});
gulp.task('default', ['serve']);
The gulp watch package is basically a gulp wrapper for chokidar
, which you should also be able to use as a replacement for node's watch feature. Pass it the {usePolling:true}
parameter and you're golden.
Or if you're running jekyll
in ruby, you can just use a flag like so:
#jekyll serve --force_polling
I hope that helps in the meantime while we wait for better support!
You mean you found the work around I already mentioned on our tracker?
We've finished implementing inotify internally, now we just need to wait for it to hit the insider builds. Note that we can only report events that are triggered inside WSL (both DrvFS and VolFs are fine). If you use Windows Notepad++ to make changes, we won't be able to report it.
@envygeeks There are a few mentions of falling back to polling in this thread that predate your jekyl/jekyl
reference (including an UserVoice comment from August 5th), no need to be rude to contributors. I'm sure somebody will appreciate Sean's particular presentation of the workaround (conveniently inline on this thread).
@JasonLinMS Thanks for the update! Is the caveat that changes must occur within WSL permanent, or is there hope for changes made from [insert favorite Windows editor/IDE here] will be picked up?
@awkaiser Thanks for waiting so long for this! Honestly, implementing inotify for file changes from Windows is a lot more complicated, since WSL can't see those changes, and because Windows vs Linux file operation semantics differ greatly. Unfortunately, the likelihood of this support coming soon is extremely low.
@envygeeks Right, That is the same workaround for Jekyll that you had mentioned earlier (though I had not clicked your backlink until now--apologies).
Regardless, my focus was on a gulp implementation and since I couldn't find a completed solution anywhere else, I figured I'd post what I made here so others in my same situation could save the hour or so of trial and error and have something that works.
@seanriceaz Only issue I have with your post is when you said "I found a workaround for this". This implies you found a workaround for the fundamental cause behind Issue #216 . However that is not true. You are presenting an alternative method of watching the file system for changes when using gulp. This undermines the severity of the fundamental issue and also makes light of other scenarios where gulp can not be used, does not want to be used, or should not be used, in my opinion.
@meffect If you're going to split hairs like that, please recognize that "a workaround" is not the same as "the workaround" and "may help" is not the same as "will help." Gulp isn't right for everyone in all cases but it is a very popular tool, and leaving a trail of potentially helpful breadcrumbs for affected developers isn't hurting anyone on this thread. I mean, I don't use Gulp, am not annoyed by Sean's contribution, and feel like it's a bit of a stretch to assert that he's "undermining the severity of the fundamental issue." I'd assume that anyone who has hit a brick wall and discovered this Github Issue while troubleshooting is probably aware of the severity of this issue.
@JasonLinMS Bridging the two systems would certainly be a challenge, but good to know it's not completely off the table, just delayed indefinitely until some wizard invents a clever solution. Looking forward to this first step landing.
My understanding from what @JasonLinMS is saying is that the upcoming fix will not be able to watch for changes made to files inside your Windows drive mounts (e.g. /mnt/c
). If that's the case, and we want to use Windows tools to edit our files, what's the proposed developer workflow?
@awkaiser from what @JasonLinMS said:
We've finished implementing inotify internally, now we just need to wait for it to hit the insider builds. Note that we can only report events that are triggered inside WSL (both DrvFS and VolFs are fine). If you use Windows Notepad++ to make changes, we won't be able to report it.
you can change files in /mnt/c, but you can't change them using Windows programs. (or at least you won't get a notification)
I'm more curious about this statement, though:
implementing inotify for file changes from Windows is a lot more complicated, since WSL can't see those changes, and because Windows vs Linux file operation semantics differ greatly
So.. if you make a change to something using a Windows app, while the file is open in something in WSL, then WSL cannot see those changes at all? (presumably until all WSL file handles are closed?) Is that how I'm to understand that?
So, there's not a possible way to directly map FindFirstChangeNotification or ReadDirectoryChangesW into inotify ?
Thanks for the clarification @ericblade! In terms of developer workflow, doesn't that effectively lead to the same end result: A web developer working in /mnt/c/web/my_cool_project
using their favorite Windows editor/IDE won't trigger the watch processes of the aforementioned build tools (Gulp, Browserify, Webpack, etc.) when they save updates to files?
That's what I'm assuming because one layer isn't talking to the other and vice verse. However, editing with VIM from the terminal will trigger it I'm assuming.
If you use Windows Notepad++ to make changes, we won't be able to report it.
That's a bit of a bummer to hear. It's been an annoying problem with using VM shared folders for a long time now (though I believe Macs can make things work using NFS), I was hoping that WSL would finally come along and help us out. I know from experience that polling workarounds (if they're even available) have quite a few downsides. As it stands, workflow, particularly for web dev, is still going to be seriously hampered on Windows machines without some major pain points in terms of configuring tooling... unless you like to work in Vim.
Edit: here is one of the workarounds for Vagrant, readme has a summary of the general problem. Maybe the WSL team can take inspiration.
I use the Windows versions of most of the stuff that I use, so I'm not especially hampered by this functionality missing, but I did want to see if my operating system builds would work on it, and OpenEmbedded just won't even start up without this functionality. :-)
I'm curious what the behavior is now when you edit a file in a Windows app while you have a handle open in WSL. It seems like having two vastly differing methods of access could potentially cause disturbing results, and I don't just mean you accidentally overwrite some changes you made earlier with changes you just made now, I'm thinking of the catastrophic loss of file type of results. Not that I'm saying it is a thing, but I'd like to know what actually happens, so that we can be aware of it.
Sublimetext for Ubuntu works great inside WSL. Just launch it with an X server like VcXsrv or Xming and it will take advantage of all the new supported features like filesystem watchers.
@ericblade, I have seen issues when using Atom on the windows side, and changing git branches in WSL. Things seem to get confused, and I get into a state where neither side has permissions to a certain directory or file. I haven't nailed down the exact reproduction steps, but it has happened more than once, and is quite a pain to recover from.
I just noticed @onomatopellan's post. That is brilliant! I know what I'll be doing at lunch today.
[edited after I solved the issue to include the errors and the solutions]
I have vcXsrv
running and can run xcalc
but when I tried installing sublime text:
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
it gives this error:
cp: cannot create regular file ‘/usr/share/icons/hicolor/48x48/apps/’: No such file or directory
It does infact installs ok in /opt/sublime_text/
, but fails to create links in /usr/local/bin
(which, although, can be done manually afterwards with ln -s /opt/sublime_text/sublime_text /usr/local/bin/sublime_text
)
But on launching it gives this error:
Unable to load libgdk-x11-2.0.so
It seems I needed to install libgdk
and/or xbase-clients
and other such basic libraries for GUI support I guess which doesn't come with bare bash.
sudo apt-get install -y xbase-clients libgtk2.0-0 libgdk-pixbuf2.0-0 libfontconfig1 libxrender1 libx11-6 libglib2.0-0 libxft2 libfreetype6 libc6 zlib1g libpng12-0 libstdc++6-4.8-dbg-arm64-cross libgcc1
It might need fewer libs than that but I'm not sure and just being inclusive.
@laggingreflex You shouldn't have problems downloading the tarball:
cd
sudo apt install libgtk2.0-0
wget https://download.sublimetext.com/sublime_text_3_build_3114_x64.tar.bz2
tar xvjf sublime_text_3_build_3114_x64.tar.bz2
DISPLAY=:0.0 ./sublime_text_3/sublime_text
@jwsloan
I have seen issues when using Atom on the windows side, and changing git branches in WSL. Things seem to get confused, and I get into a state where neither side has permissions to a certain directory or file.
Yeah.. I'm afraid that actually being able to directly access /mnt/c and such might actually be a really bad idea. Perhaps it might be a good idea to actually yank that file system layer, and replace it with NFS or something. It sounds like it's going to lead people into nasty problems.
though I believe Macs can make things work using NFS - @noinkling
Not sure about NFS, but for anyone who doesn't also use a Mac: yes, on OSX you can go between the CLI and GUI without any serious hitches. Changes can be triggered on both sides, although it remains a bad idea to edit the same file in two different editors (that's just confusing :)).
I was able to install submlime-text-3 using the steps that failed for @laggingreflex. Then I used the following so that I can run subl some_file.rb
to launch it.
ln -s /opt/sublime_text/sublime_text /usr/local/bin/subl
The whole /proc/sys/fs structure is missing, too.
inotitywait does not get triggered by filesystem changes.