Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filesystem watchers like libinotify do not work #216

Closed
mablae opened this issue Apr 16, 2016 · 159 comments
Closed

Filesystem watchers like libinotify do not work #216

mablae opened this issue Apr 16, 2016 · 159 comments

Comments

@mablae
Copy link

@mablae mablae commented Apr 16, 2016

The whole /proc/sys/fs structure is missing, too.

inotitywait does not get triggered by filesystem changes.

@stehufntdev
Copy link
Collaborator

@stehufntdev stehufntdev commented Apr 18, 2016

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!

@mablae
Copy link
Author

@mablae mablae commented Apr 18, 2016

@patryk9200 Thanks!

@JSMike
Copy link

@JSMike JSMike commented Jun 1, 2016

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/

@mablae
Copy link
Author

@mablae mablae commented Jun 1, 2016

JSMike: It does not work. This is why we opened this issue 😄

@JSMike
Copy link

@JSMike JSMike commented Jun 1, 2016

yes, I was just trying to add detail

@stehufntdev
Copy link
Collaborator

@stehufntdev stehufntdev commented Jul 5, 2016

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).

@alanosman
Copy link

@alanosman alanosman commented Jul 28, 2016

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.

@aseering
Copy link
Contributor

@aseering aseering commented Aug 1, 2016

@SRGOM -- I don't know that there's automated telemetry, but users can vote on issues here:

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/category/161892-bash

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.

@ghost
Copy link

@ghost ghost commented Aug 3, 2016

Just posting here to show how much I would love to see this feature implemented

@jwsloan
Copy link

@jwsloan jwsloan commented Aug 4, 2016

@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.

@catmando
Copy link

@catmando catmando commented Aug 4, 2016

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?

@jwsloan
Copy link

@jwsloan jwsloan commented Aug 4, 2016

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.

@catmando
Copy link

@catmando catmando commented Aug 4, 2016

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...

@noinkling
Copy link

@noinkling noinkling commented Apr 29, 2017

Nodemon works fine here for me on Node 7.

@computersarecool
Copy link

@computersarecool computersarecool commented Apr 29, 2017

@simonbuchan you may be right. I am running node 7.9.0 but this does work on my real Linux machine that is running 7.8.0

Do you have a recommendation for something better than nodemon?

@simonbuchan
Copy link

@simonbuchan simonbuchan commented Apr 29, 2017

Hmm, if you can't reproduce the issue on real Linux with the same node and nodemon versions, that seems like a wsl bug to me, but open a new issue for it, to stop speaking anyone that's commented on this one 😇

@matbrgz
Copy link

@matbrgz matbrgz commented Sep 11, 2019

WSL2:

$ ls /proc/sys/fs
binfmt_misc  mqueue  xfs         dentry-state       file-nr      lease-break-time  nr_open      pipe-max-size         protected_fifos      protected_symlinks
epoll        nfs     aio-max-nr  dir-notify-enable  inode-nr     leases-enable     overflowgid  pipe-user-pages-hard  protected_hardlinks  suid_dumpable
inotify      quota   aio-nr      file-max           inode-state  mount-max         overflowuid  pipe-user-pages-soft  protected_regular

But jekyll serve isn't regenerating after change code, watch isnt working.

@JohannesKuehnel
Copy link

@JohannesKuehnel JohannesKuehnel commented Nov 10, 2019

@MatheusRV
Funnily enough, bundle exec jekyll serve (jekyll 4.0.0) without the --no-watch option re-generates on code changes for me (WSL with Ubuntu 18.04, Win 10 Pro N 1903), but after the first file re-generation I cannot stop the process with CTRL+C. If I try to, it gets stuck and I cannot even close it with kill and with the Task Manager.

@bashbaugh
Copy link

@bashbaugh bashbaugh commented Dec 27, 2019

bundle exec jekyll serve is behaving correctly for me with the --watch option. I am able to stop the process. WSL with Ubuntu 18.04, Win 10 Home 1909.

@gusbemacbe
Copy link

@gusbemacbe gusbemacbe commented Mar 22, 2020

I have still a problem with Jekyll and Ruby (installed from rbenv), using Arch Linux as WSL 2:

Auto-regeneration may not work on some Windows versions.
                    Please see: https://github.com/Microsoft/BashOnWindows/issues/216
                    If it does not work, please upgrade Bash on Windows or run Jekyll with --no-watch.
 Auto-regeneration: enabled for '/mnt/d/gusbe/GitLab/dicas-para-alunos-da-dankicode'
#<Thread:0x000055823d03d378 /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/command
s/serve/live_reload_reactor.rb:41 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        5: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/commands/serve/live
_reload_reactor.rb:44:in `block in start'
        4: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run'
        3: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run_machine
'
        2: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/commands/serve/live
_reload_reactor.rb:47:in `block (2 levels) in start'
        1: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_serve
r'
/home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_tcp_server': no accep
tor (port is in use or requires root privileges) (RuntimeError)
bundler: failed to load command: jekyll (/home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bin/jekyll)
RuntimeError: no acceptor (port is in use or requires root privileges)
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_tcp_server'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_server'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/commands/serve/live_reload_reacto
r.rb:47:in `block (2 levels) in start'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run_machine'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/commands/serve/live_reload_reacto
r.rb:44:in `block in start'
@BenMatheja
Copy link

@BenMatheja BenMatheja commented Mar 22, 2020

I have still a problem with Jekyll and Ruby (installed from rbenv), using Arch Linux as WSL 2:

Auto-regeneration may not work on some Windows versions.
                    Please see: https://github.com/Microsoft/BashOnWindows/issues/216
                    If it does not work, please upgrade Bash on Windows or run Jekyll with --no-watch.
 Auto-regeneration: enabled for '/mnt/d/gusbe/GitLab/dicas-para-alunos-da-dankicode'
#<Thread:0x000055823d03d378 /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/command
s/serve/live_reload_reactor.rb:41 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        5: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/commands/serve/live
_reload_reactor.rb:44:in `block in start'
        4: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run'
        3: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run_machine
'
        2: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/commands/serve/live
_reload_reactor.rb:47:in `block (2 levels) in start'
        1: from /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_serve
r'
/home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_tcp_server': no accep
tor (port is in use or requires root privileges) (RuntimeError)
bundler: failed to load command: jekyll (/home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bin/jekyll)
RuntimeError: no acceptor (port is in use or requires root privileges)
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_tcp_server'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_server'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/commands/serve/live_reload_reacto
r.rb:47:in `block (2 levels) in start'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run_machine'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run'
  /home/gusbemacbe/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/bundler/gems/jekyll-4a875acb2616/lib/jekyll/commands/serve/live_reload_reacto
r.rb:44:in `block in start'

Using WSL2 with Ubuntu distribution and can confirm auto-regeneration is not working anymore (as it did with WSL1).

  • Ruby 2.6.0 via rbenv
@IgnusG
Copy link

@IgnusG IgnusG commented Apr 21, 2020

The filewatcher for vs code remote (latex build on change) as well as jest (--watch) or webpack (dev server) are all broken in WSL2. I assume it all falls under this issue?

I had my projects in the windows fs instead so this was relevant for me. Sorry about the noise #4739 (comment)

@DavidBurela
Copy link
Member

@DavidBurela DavidBurela commented May 4, 2020

Another data point that Jekyll watch it is not working on WSL2 with Ubuntu 20.04

@DavidBurela
Copy link
Member

@DavidBurela DavidBurela commented May 10, 2020

An update, I've found a workaround to get it working in the short term.
It seems to be an issue with the windows filesystem bridge.

When I have the jekyll site on the C:/ drive e.g. /mnt/c/source/blog then modifying files does not trigger a recompile.
But when the files are in the 'native' linux filesystem e.g. ~/blog then modifying files correctly triggers a recompile.

Doing it this way means jekyll serve acts as expected.

@gusbemacbe
Copy link

@gusbemacbe gusbemacbe commented May 10, 2020

An update, I've found a workaround to get it working in the short term.
It seems to be an issue with the windows filesystem bridge.

When I have the jekyll site on the C:/ drive e.g. /mnt/c/source/blog then modifying files does not trigger a recompile.
But when the files are in the 'native' linux filesystem e.g. ~/blog then modifying files correctly triggers a recompile.

Doing it this way means jekyll serve acts as expected.

Unfortunately your hack did not work for me. See what and how I did. I tried to do what you got.

  1. I moved the repository blablabla from /mnt/d/gusbe/GitLab to Ubuntu 20.04's /home/gusbemacbe/Git/.
  2. I ran the command gem install <all gems>.
  3. I entered the folder blablabla and ran the jekyll serve, but it failed and still was auto-generation.
  4. Then I ran the commands bundle install, bundle update and bundle exec jekyll serve, but it failed again. The same error.
@TheHanna
Copy link

@TheHanna TheHanna commented May 28, 2020

An update, I've found a workaround to get it working in the short term.
It seems to be an issue with the windows filesystem bridge.

When I have the jekyll site on the C:/ drive e.g. /mnt/c/source/blog then modifying files does not trigger a recompile.
But when the files are in the 'native' linux filesystem e.g. ~/blog then modifying files correctly triggers a recompile.

Doing it this way means jekyll serve acts as expected.

Thanks! This solved my issue with Angular as well! Moving my code from /mnt/c/Users/{user_name}/projects/{project_name} to ~/projects/{project_name} and running ng serve from there was exactly the fix I needed for it to detect changes and recompile automatically

@darkRaspberry
Copy link

@darkRaspberry darkRaspberry commented Aug 15, 2020

Is there any hack. for this?

@adam-arold
Copy link

@adam-arold adam-arold commented Sep 19, 2020

--watch worked for me in WSL 1, but I recently upgraded to WSL 2 and now it doesn't work. Talk about an upgrade... 😢 What can I do? Downgrade to WSL 1? Why is this closed?

@i-am-gizm0
Copy link

@i-am-gizm0 i-am-gizm0 commented Oct 22, 2020

I manged to hack this together by creating a symlink from somewhere in my /mnt directory (where I am actually working) to the linux file system and editing from the symlink

@LBognanni
Copy link

@LBognanni LBognanni commented Oct 24, 2020

For anyone having trouble with jekyll, running with --force_polling finally made it work for me. eg. bundle exec jekyll serve --force_polling

@gamepad-coder
Copy link

@gamepad-coder gamepad-coder commented Jan 7, 2021

Regarding: #216 (comment)

bundle exec jekyll serve --force_polling

Confirming this works for me too.
Thanks!

More Info:

Using:

  • WSL 2
  • Ruby 2.5.5
  • Bundler 2.2.4
  • Jekyll 3.9.0

Setup:

  • Notepad++ in Windows 10 to edit files located in a C: drive folder
  • Running Jekyll via Bash in WSL 2 Debian distro
    • cd navigating to /mnt/c/website.html file's dir within Bash before running Jekyll
  • bundle exec jekyll serve --force_polling --livereload now works as expected.

Live reloading & watching did not trigger without --force_polling option (when editing files like C:/website.html using Notepad++ in Windows).


Regarding: #216 (comment) (626327824) + #216 (comment) (635393026)

Confirming this also works using my setup.

Live reloading & watching also works for me when:

  • Jekyll called without the --force_polling option
  • Files are located inside the Linux directories (such as ~/website.html)
  • Files are edited within WSL 2 using Nano inside of Bash
@liviust
Copy link

@liviust liviust commented Jan 18, 2021

It does work, but it increases the CPU load with 15-25% on a i9-9980HK processor with WSL 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet