tech

Error ENOSPC; System limit for number of file watchers reached

Error ENOSPC; System limit for number of file watchers reached
Featured image
tech linux

so yeah what is this you might say this is a weird title, this is not philosophy why are you doing this you might say. this is my blog i post what i want whenever i want so if you faced this error read if not skip ahead simple. don’t complain in my Dm’s

I launched my trusty obsidian vault and about to start to get down to my usual productiviy note taking system… then i get the error

Error ENOSPC System limit for number of file watchers reached

I start to panic and think maybe its something faulty in the program startup I should close it and start it up again. then the same error pop up. third time is a charm they say I tried I again it did not work i updated my machine a few hours ago so I am now thinking that this might be some changes to the kernel modules and that is why this is acting up. maybe if I reboot it, the pc would benefit from the updates and this would go away I thought. So I did reboot it and the error kept on poping up. so I went to the internet to search for and dig up some answers.

It turns out that the maximum number of files the system can monitor had been reached. Since I am not working on a project larger than I have in the past I not sure why this happened. It turns out that the limit was 8,192, which is fairly low for a software developer. Fortunately, it is easy to increase the limit.

Use the below command to check the current limit.

cat /proc/sys/fs/inotify/max_user_watches

// response
    8192

Startpaging around I found that 524,288 is a popular number for setting the new limit. To do so:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf

// response
 fs.inotify.max_user_watches=524288

Have the Linux kernel read & use the new limit.

sudo sysctl -p

// response
fs.inotify.max_user_watches = 524288

Check the number of watchers again just to be sure.

cat /proc/sys/fs/inotify/max_user_watches

// response
524288

Now you can finally rest in peace and never worry again about your number of file watches

References:

Previous Albert Camus; How to live a perfect life Next Sex on Steroids; How Social media helped objectify women