terraforming-rails: Function not implemented - Failed to initialize inotify (Errno::ENOSYS) Apple M1 linux/amd64 platform
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: #https://github.com/docker/for-mac/issues/5321 Temporary solution: #https://github.com/from20020516/checkparam-rails/commit/93a7d4530a4cb65f16e8ba8dd82ffb101219ff39
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 35
- Comments: 16
Commits related to this issue
- This causes problems in docker+apple m1 More here: https://github.com/evilmartians/terraforming-rails/issues/34 — committed to fastruby/refugerestrooms by etagwerker 2 years ago
- 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.) ... — committed to RefugeRestrooms/refugerestrooms by etagwerker 2 years ago
- This causes problems in docker+apple m1 More here: evilmartians/terraforming-rails#34 — committed to fastruby/refugerestrooms by deleted user 2 years ago
- Release 1.21.0 (#677) * Fixes Apple M1 Issue w/ Docker (#672) - This causes problems in docker+apple m1 (`ActiveSupport::EventedFileUpdateChecker` isn't working on Docker for Apple S... — committed to RefugeRestrooms/refugerestrooms by DeeDeeG 2 years ago
- build(gems): Disable livereload livereload breaks because qemu [isn't supported by inotify](https://github.com/evilmartians/terraforming-rails/issues/34#issuecomment-908993005). — committed to steinmuehle/stm by steinmuehle 2 years ago
- Work around listen gem issue 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. https://github.com/... — committed to buildkite/docs by dannymidnight a year ago
- Work around listen gem issue 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. https://github.com/... — committed to buildkite/docs by dannymidnight a year ago
- Add a note about turning on a Docker setting 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 im... — committed to biggianteye/planner by biggianteye a year ago
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::EventedFileUpdateCheckerin
config/environments/development.rbEnabling Rosetta for Docker (under “Features in Development” in Docker Desktop’s settings as I am writing this) fixed this for me.
To me, the best way to make it work is
rake app:update:binThe only way I was able to get this to work is to follow everything here and then also
In my example, I was simply trying to get to the console via
bundle exec rails cI 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.Another solution (rather than commenting out the
file_watcher) is to replaceEventedFileUpdateCheckerwithFileUpdateChecker(docs).So in
config/environments/development.rbyou replace:with:
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 …
use the
linux/arm64/v8platform.In the Dockerfile
FROMline or with thedocker runCLI:https://github.com/docker/for-mac/issues/6174#issuecomment-1048928733 https://github.com/docker/for-mac/issues/5321#issuecomment-823637003
https://orbstack.dev/ has solved the problem on amd64 containers
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.
Thanks it worked!
I’m having the same issue using RC1. Diagnostics ID -> 3726840A-0F9B-4159-9004-2858654FAC31/20210322173340