locate command and Finder do not find many files
The locate command doesn't work properly anymore under Big Sur I have tried to update the locate database but I get some errors:
sudo /usr/libexec/locate.updatedb
Password:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
After these errors the command completes. locate will find some files but not others. The files I'm looking for my user definitely has access to and for sure root does. There seems to be no rhyme or reason to what files it finds and what it doesn't.
An example of files that locate won't find are files I know that exist in subdirectories of
/Users/username/Library/Application Support/
Mac Finder also doesn't find these files no matter how long I let it search "This Mac" or "Macintosh HD"
This all used to work under Catalina.
How can I fix my locate and Finder search?
MacBook Pro with Touch Bar