Debian中inotify出現錯誤時,可按以下方法解決:
檢查資源限制
cat /proc/sys/fs/inotify/max_user_watches
sudo sysctl fs.inotify.max_user_watches=1048576
/etc/sysctl.conf
,添加上述配置后執行sudo sysctl -p
。排查進程占用
find /proc/*/fd -ls 2>/dev/null | grep inotify | cut -d '/' -f 3 | xargs -I '{}' sh -c 'echo -n "{} "; cat /proc/{}/cmdline; echo ""' | uniq -c | sort -nr
。切換監控模式
--disable-inotify
參數切換為輪詢模式(部分工具支持,如tail
命令)。檢查系統日志
journalctl -k | grep -i inotify
查看內核日志,獲取具體錯誤信息。安裝/更新工具
inotify-tools
:sudo apt-get install inotify-tools
。注意:若錯誤涉及內核模塊(如inotify
未加載),需檢查內核版本(需≥2.6.13)并重新編譯內核(Debian場景較少見)。