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

Function not implemented - Failed to initialize inotify (Errno::ENOSYS) Apple M1 linux/amd64 platform #34

Closed
sanzstez opened this issue Mar 5, 2021 · 16 comments · Fixed by TuftsUniversity/mira_on_hyrax#57

Comments

@sanzstez
Copy link

sanzstez commented Mar 5, 2021

Ruby Image: --platform=linux/amd64 ruby:2.7.2-slim-buster
Rails: 6.1.3
Device: Apple m1 macbook pro

After running
docker-compose run --rm rails ./bin/setup

Got:

`/usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:69:in `initialize': Function not implemented - Failed to initialize inotify (Errno::ENOSYS)
sidekiq_1    | Function not implemented - Failed to initialize inotify
sidekiq_1    | /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:69:in `initialize'
sidekiq_1    | /usr/local/bundle/gems/listen-3.4.1/lib/listen/adapter/linux.rb:34:in `new'
sidekiq_1    | /usr/local/bundle/gems/listen-3.4.1/lib/listen/adapter/linux.rb:34:in `_configure'
sidekiq_1    | /usr/local/bundle/gems/listen-3.4.1/lib/listen/adapter/base.rb:47:in `block in configure'
sidekiq_1    | /usr/local/bundle/gems/listen-3.4.1/lib/listen/adapter/base.rb:42:in `each'
sidekiq_1    | /usr/local/bundle/gems/listen-3.4.1/lib/listen/adapter/base.rb:42:in `configure'
sidekiq_1    | /usr/local/bundle/gems/listen-3.4.1/lib/listen/adapter/base.rb:66:in `start'
sidekiq_1    | /usr/local/lib/ruby/2.7.0/forwardable.rb:235:in `start'
`

Update:
It's docker for mac problem, so redirected to their issues: #docker/for-mac#5321
Temporary solution:
#from20020516/checkparam-rails@93a7d45

@sanzstez sanzstez changed the title Function not implemented - Failed to initialize inotify (Errno::ENOSYS) Function not implemented - Failed to initialize inotify (Errno::ENOSYS) Apple M1 linux/amd64 platform Mar 6, 2021
@oraposa
Copy link

oraposa commented Mar 22, 2021

I'm having the same issue using RC1. Diagnostics ID -> 3726840A-0F9B-4159-9004-2858654FAC31/20210322173340

@esromneb
Copy link

esromneb commented Jul 1, 2021

This issue comes because the M1 arm docker is using qemu and this doesn't support inotify. To fix this comment this line

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

in config/environments/development.rb

@kaka-ruto
Copy link

The workaround worked for me. Thanks

@tushargoyal2
Copy link

This issue comes because the M1 arm docker is using qemu and this doesn't support inotify. To fix this comment this line

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

in config/environments/development.rb

Thanks it worked!

@bishopandco
Copy link

Anyone else landing here and still not getting past this problem, the answer on this Stack Overflow worked for me.
https://stackoverflow.com/questions/69773109/how-to-fix-function-not-implemented-failed-to-initialize-inotify-errnoenos

@feapaydin
Copy link

This issue comes because the M1 arm docker is using qemu and this doesn't support inotify. To fix this comment this line

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

in config/environments/development.rb

I was running the project in a docker container (from ruby image) on a M1 Air but I built the container with amd64 architecture using docker buildx. This also worked in this scenario, thank you.

etagwerker added a commit to fastruby/refugerestrooms that referenced this issue Apr 24, 2022
DeeDeeG pushed a commit to RefugeRestrooms/refugerestrooms that referenced this issue Apr 28, 2022
* This causes problems in docker+apple m1

  (`ActiveSupport::EventedFileUpdateChecker`
  isn't working on Docker for Apple Silicon (M1) at the moment.)

  More here: evilmartians/terraforming-rails#34

* Make sure we use amd64 for Mac OS X M1 compatibility
toppa pushed a commit to fastruby/refugerestrooms that referenced this issue May 15, 2022
@baranyeni
Copy link

This still creates the same error when I try to run something on Docker CLI

@marlosirapuan
Copy link

same here

@djimondev
Copy link

To me, the best way to make it work is

rake app:update:bin

@svenjr
Copy link

svenjr commented Aug 26, 2022

The only way I was able to get this to work is to follow everything here and then also

export DISABLE_SPRING=true

In my example, I was simply trying to get to the console via bundle exec rails c

DeeDeeG added a commit to RefugeRestrooms/refugerestrooms that referenced this issue Oct 11, 2022
* Fixes Apple M1 Issue w/ Docker (#672)
  - This causes problems in docker+apple m1
      (`ActiveSupport::EventedFileUpdateChecker`
      isn't working on Docker for Apple Silicon (M1) at the moment.)
      More here: evilmartians/terraforming-rails#34
  - Make sure we use amd64 for Mac OS X M1 compatibility

* Update Dependencies for May 2022 (#673)
  - ruby: Upgrade Ruby from 2.7.5 to 2.7.6
  - Gemfile.lock: Update nokogiri from 1.13.3 to 1.13.6
  - Gemfile[.lock]: Update rails (5.2.6.3 --> 5.2.8) and its dependencies
      Also updates a few indirect dependencies.
      Specifically: concurrent-ruby, i18n, loofah, mini_mime, and thor.
  - Gemfile.lock: Update puma from 5.6.2 to 5.6.4
  - yarn.lock: Update minimist from 1.2.5 to 1.2.6
  - yarn.lock: Update node-forge from 1.2.1 to 1.3.1
  - yarn.lock: Update swagger-ui from 4.1.3 to 4.7.0
      Also update some of its dependencies, such as @braintree/sanitize-url.
  - yarn.lock: Update async from 2.6.3 to 2.6.4
  - Revert "yarn.lock: Update swagger-ui from 4.1.3 to 4.7.0"
      It broke when updating, not sure why. Possibly webpack-related???
      Back to swagger-ui 4.1.3.
  - deps: Resolve @braintree/sanitize-url to v6.x
      Was v5.x. (This is a JS dependency, in package.json and yarn.lock.)
  - yarn.lock: Update eventsource from 1.0.7 to 1.1.1
  - Gemfile.lock: Update rack from 2.2.3 to 2.2.3.1

* update to new maps public key (#675)
  - update to new public key
  - upgrade to rails 6
  - add net gems to Gemfile
  - update lock file
  - fix linting errors with upgrade
  - use proper "visible" syntax
  - update API gems
  - change to old css rspec helper

* Update dependencies for early October 2022 (#676)
  - yarn.lock: Update terser
  - yarn.lock: Dedupe dependencies
  - ruby: Bump Ruby from 3.1.0 to 3.1.2
      (Was recently updated from 2.7.6 to 3.1.0 in PR 675)

Co-authored-by: Mikena Wood <mi-wood@users.noreply.github.com>
Co-authored-by: Ernesto Tagwerker <ernesto+github@ombulabs.com>
jottr pushed a commit to steinmuehle/stm that referenced this issue Nov 18, 2022
livereload breaks because qemu [isn't supported by
inotify](evilmartians/terraforming-rails#34 (comment)).
@fhightower
Copy link

fhightower commented Dec 12, 2022

This issue comes because the M1 arm docker is using qemu and this doesn't support inotify. To fix this comment this line

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

in config/environments/development.rb

Another solution (rather than commenting out the file_watcher) is to replace EventedFileUpdateChecker with FileUpdateChecker (docs).

So in config/environments/development.rb you replace:

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

with:

config.file_watcher = ActiveSupport::FileUpdateChecker

@moyses
Copy link

moyses commented Jan 3, 2023

This issue comes because the M1 arm docker is using qemu and this doesn't support inotify. To fix this comment this line
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
in config/environments/development.rb

Thanks it worked!

on my app this line is not exists

@sealocal
Copy link

sealocal commented Jan 7, 2023

The discussion does not explicitly point to the alternative solution/workaround, which is to specify a compatible OS/architecture for the docker image:

Instead of the image specified in the original post ...

Ruby Image: --platform=linux/amd64 ruby:2.7.2-slim-buster Rails: 6.1.3 Device: Apple m1 MacBook pro

use the linux/arm64/v8 platform.

In the Dockerfile FROM line or with the docker run CLI:

--platform=linux/arm64/v8 ruby:2.7.2-slim-buster

docker/for-mac#6174 (comment)
docker/for-mac#5321 (comment)

dannymidnight added a commit to buildkite/docs that referenced this issue Apr 21, 2023
There seems to be an issue with the listen running on linux/amd64.

I found a workaround which seems fine since we're likely to stop using
sprockets.

evilmartians/terraforming-rails#34 (comment)
clbarrell pushed a commit to buildkite/docs that referenced this issue Apr 21, 2023
There seems to be an issue with the listen running on linux/amd64.

I found a workaround which seems fine since we're likely to stop using
sprockets.

evilmartians/terraforming-rails#34 (comment)
@bibendi
Copy link

bibendi commented May 2, 2023

https://orbstack.dev/ has solved the problem on amd64 containers

@jthom-ut
Copy link

Enabling Rosetta for Docker (under "Features in Development" in Docker Desktop's settings as I am writing this) fixed this for me.

Screenshot 2023-07-18 at 3 57 33 PM

biggianteye added a commit to biggianteye/planner that referenced this issue Aug 12, 2023
Without this setting enabled, you will get the following fatal error every time
you try to run a rake command in docker:

  Errno::ENOSYS: Function not implemented - Failed to initialize inotify
  /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:69:in `initialize'

See evilmartians/terraforming-rails#34 for a
description of the problem.
@CodeBrotha
Copy link

Enabling Rosetta for Docker (under "Features in Development" in Docker Desktop's settings as I am writing this) fixed this for me.

Screenshot 2023-07-18 at 3 57 33 PM

This is the way! Thanks. All the other workarounds (setting arm64 platform, disabling config.file_watcher, recreating bin folder) either didn't work, or broke the repo for non M1 Mac users on my team.

freesteph added a commit to betagouv/aplypro that referenced this issue Feb 6, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
freesteph added a commit to betagouv/aplypro that referenced this issue Feb 6, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
freesteph added a commit to betagouv/aplypro that referenced this issue Feb 6, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
freesteph added a commit to betagouv/aplypro that referenced this issue Feb 6, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
freesteph added a commit to betagouv/aplypro that referenced this issue Feb 8, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
freesteph added a commit to betagouv/aplypro that referenced this issue Feb 8, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
freesteph added a commit to betagouv/aplypro that referenced this issue Feb 8, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
freesteph added a commit to betagouv/aplypro that referenced this issue Feb 8, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
freesteph added a commit to betagouv/aplypro that referenced this issue Feb 8, 2024
Apple M1 + Docker + OSX < 13 = trouble with filesystem listening
because of QEMU-based emulation something something, see further
details on the issue.

In the meantime disable inotify which makes performance much better
when firing up Guard and other commands in Docker.

[1]: evilmartians/terraforming-rails#34 (comment)
biggianteye added a commit to biggianteye/planner that referenced this issue May 3, 2024
Without this setting enabled, you will get the following fatal error every time
you try to run a rake command in docker:

  Errno::ENOSYS: Function not implemented - Failed to initialize inotify
  /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:69:in `initialize'

See evilmartians/terraforming-rails#34 for a
description of the problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.