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 · 163 comments
Closed

Filesystem watchers like libinotify do not work #216

mablae opened this issue Apr 16, 2016 · 163 comments

Comments

@mablae
Copy link

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

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!

@patryk9200
Copy link

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

@mablae
Copy link
Author

mablae commented Apr 18, 2016

@patryk9200 Thanks!

@JSMike
Copy link

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 commented Jun 1, 2016

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

@JSMike
Copy link

JSMike commented Jun 1, 2016

yes, I was just trying to add detail

@stehufntdev
Copy link
Collaborator

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

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 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 commented Aug 3, 2016

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

@jwsloan
Copy link

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

@JohannesKuehnel
Copy link

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

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

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

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

@DavidBurela
Copy link
Member

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

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

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

Is there any hack. for this?

@adam-arold
Copy link

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

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 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 commented Jan 18, 2021

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

@adam-dziedzic
Copy link

I also installed the wsd gem, as pointed here: https://jekyllrb.com/docs/installation/windows/#auto-regeneration

gem install wsd

and then

bundle exec jekyll serve --force_polling --livereload

@gilloud
Copy link

gilloud commented Dec 30, 2021

@adam-dziedzic it's not a
gem install wdm
?

@WikiLiu
Copy link

WikiLiu commented May 15, 2023

gem install wsd

yeap but now year is 2023 ,the bug still not solve

@gojimmypi
Copy link

I ended up in a tangle with GH Pages as I tried to install missing components manually on a new system after seeing error messages from my script, rather than following the instructions.

I answered "no" to a sudo prompt at install time, so the install created a local "vendors" directory via config, causing this error:

Error: could not read file /mnt/c/workspace/gojimmypi.github.io/vendor/bundle/ruby/3.0.0/gems/jekyll-3.9.3/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb: Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/ruby/3.0.0/gems/jekyll-3.9.3/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/ruby/3.0.0/gems/jekyll-3.9.3/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.

gem install wdm

didn't work for me:

image

bundle add webrick

was very helpful as noted in jekyll/jekyll#8523

bundle exec jekyll serve --force_polling --livereload

thanks @adam-dziedzic !

now working properly in WSL:

image

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

No branches or pull requests