guard: No space left on device - Failed to watch ...

Guardfile:

guard 'rspec', :version => 2, :cli => "--color --format nested" do
  watch(%r{^spec/.+_spec\.rb})
  watch(%r{^lib/(.+)\.rb})     { |m| "spec/#{m[1]}_spec.rb" }
end

Gemfile

group :development do
  gem 'guard'
  gem 'libnotify'
  gem 'guard-rspec'
  gem 'rb-readline'
end

Environment

  • Linux 2.6.32-5-amd64
  • ruby 1.8.7 (2011-06-30 patchlevel 352)

Error

When I run guard start I see libnotify message with report and then guard crashes with next error:

//home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/watcher.rb:80:in `initialize': No space left on device - Failed to watch "/home/blake/dev/my/project_child/.git/objects/78": The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `new'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:199:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:58:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listener.rb:100:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:20:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard.rb:203:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/cli.rb:75:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/bin/guard:6
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19:in `load'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/watcher.rb:80:in `initialize': No space left on device - Failed to watch "/home/blake/dev/my/project_child/.git/objects/78": The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `new'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:199:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:58:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listener.rb:100:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:20:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard.rb:203:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/cli.rb:75:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/bin/guard:6
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19:in `load'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19


Does it try to watch git files? Do I miss something?

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Try increasing the max_user_watches for inotify. It is default set to 8192. I bumped it to 100k and things are ok.

cat /proc/sys/fs/inotify/max_user_watches

echo 100000|sudo tee /proc/sys/fs/inotify/max_user_watches

To increase max_user_watches at boot, edit /etc/sysctl.conf and add fs.inotify.max_user_watches=100000 or fix fs.inotify.max_user_watches= to 100000.

Don’t thank me, thank this guy -> http://blog.sorah.jp/2012/01/24/inotify-limitation