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

Most upvoted comments

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

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

To me, the best way to make it work is

rake app:update:bin

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

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.

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

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

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

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.

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!

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