Changing fs.inotify.max_user_watches


#1

Hi there,

As part of the React Native packager facebook uses watchman which in turn uses inotify. The default limits specified by ubuntu are low

ubuntu@box324:~$ cat /proc/sys/fs/inotify/max_user_watches
8192

So they suggest running (from here: https://facebook.github.io/react-native/docs/troubleshooting.html#unable-to-start-react-native-package-manager-on-linux)

echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

The problem is I get

sysctl: permission denied on key ‘fs.inotify.max_user_watches’

When running that command on CircleCI. How can I set that parameter so my React build could work?

Many thanks
Frankie


#2

I’m running into the same issue, did you solve it?


#3

I’ve had success using:

- sudo sysctl fs.inotify.max_user_watches=524288
- sudo sysctl -p

as part of the build setup to just set the limit temporarily. YMMV…


#4

How to do that if you use the docker executor?

Since sudo is not allowed there…


#5

So, how do you set “max_user_watches” on the host machine if you use the Docker executor?


#6

Since inotify limits cannot be raised in the Circle 2.0 docker, I’ve gotten successful builds (and deploys with exp publish) by using a machine build (set machine: true) in config.yml… and (for my project) installing yarn as part of the build. I’ve left these changes only on the deploy branch.

version: 2
jobs:
  build:
    # Allow increase of inotify limit to support watchman for exp publish.
    # This should only be on the deploy branch.
    # See  https://circleci.com/docs/2.0/executor-types/
    machine: true
    steps:
      ...
      - run: |
          curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
          echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
          sudo apt-get update && sudo apt-get install yarn
      - run: yarn install

Good luck. It’s an unfortunate limitation in the environment for docker in CircleCI 2.0. Hope they fix it soon.


#7

Does it still work for you?

I get:

sudo sysctl fs.inotify.max_user_watches=524288

sysctl: permission denied on key 'fs.inotify.max_user_watches'

#8