Skip to content

Instantly share code, notes, and snippets.

@tbjgolden
Last active December 20, 2023 12:08
Show Gist options
  • Star 48 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save tbjgolden/c53ca37f3bc2fab8c930183310918c8c to your computer and use it in GitHub Desktop.
Save tbjgolden/c53ca37f3bc2fab8c930183310918c8c to your computer and use it in GitHub Desktop.
[Arch Linux] [Manjaro] How to avoid "Visual Studio Code is unable to watch for file changes in this large workspace" (error ENOSPC)

To avoid this error, we need to increase the inotify watcher limit.

The way to do this is different on Arch based distributions than other Linux distributions.

Instructions for Arch Linux/Manjaro

Check for an already existing inotify config file (recent versions of Manjaro include one)

ls /etc/sysctl.d/*-max_user_watches.conf

a) If no output

echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max_user_watches.conf && sudo sysctl --system

b) If the command outputs a file

(in the rare case where it outputs multiple files, continue using the last one in the list)

# replace `/etc/sysctl.d/50-max_user_watches.conf` with the file returned from the previous `ls` command
echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/50-max_user_watches.conf && sudo sysctl --system

Check it's working

cat /proc/sys/fs/inotify/max_user_watches

Expected output: 524288

Credits

@tbjgolden
Copy link
Author

@alejandroferrin
Oh cool - also using Plasma!
Yeah the reason this is so painful is that Manjaro has a file 50-max_user_watches.conf preconfigured, but Arch doesn't.
The original instuctions for this for Arch was to create a 40-max_user_watches.conf but the existing config overrides it (50 > 40) on Manjaro.

Ultimately finding the existing definition in 50-max_user_watches.conf oughta do the trick 👍

@rdricco
Copy link

rdricco commented Jan 12, 2021

Worked here on Manjaro but I needed to delete the files with typo

@darshansiddu01
Copy link

How to make this change when on linux not running as root user.
I'm connecting to remote development environment using Remote-SSH extension

@cascadingstyletrees
Copy link

cascadingstyletrees commented Nov 5, 2021

How to make this change when on linux not running as root user. I'm connecting to remote development environment using Remote-SSH extension

Pretty sure you need privileged access, kernel changes generally require root, unless you have a really permissive system.

@carlosSoto2
Copy link

Works

@MelinaMontes
Copy link

It works perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment