Internet stops working, "Failed to add /run/systemd/ask-password to directory watch: No space left on device"
An answer to this question on the Unix & Linux Stack Exchange.
Question
I'm running Lubuntu 16.04. After running the system for a while the wireless internet will stop working.
Dutifully, I run:
sudo service network-manager restart
But this returns the message:
Failed to add /run/systemd/ask-password to directory watch: No space left on device
But I have lots of space available on the hard disk, in RAM, and via swap. What's going on?
Answer
As discussed here, it turns out that the Crashplan back-up service is the most likely culprit. It uses many inotify watches and, eventually, eats them all up.
The immediate fix is to run:
sudo -i
echo 1048576 > /proc/sys/fs/inotify/max_user_watches
exit
To make more watches available.
The long-term fix is to edit the file /etc/sysctl.conf to include the line:
fs.inotify.max_user_watches=1048576
Edit: It's been a few days now, and the problem hasn't arisen since I performed the above.