shell init issue when click tab, what's wrong with getcwd?
once i click Tab on bash, the error message will appear, what's wrong?
symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success
symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success
symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success
symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success
symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success
symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success
sometimes, the error message is:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No s uch file or directory
how to solve shell init problem?
Solution 1:
This usually occurs when your current directory does not exist anymore. Most likely, from another terminal you remove that directory (from within a script or whatever). To get rid of this, in case your current directory was recreated in the meantime, just cd
to another (existing) directory and then cd
back; the simplest would be: cd; cd -
.
Solution 2:
Just change the directory to another one and come back. Probably that one has been deleted or moved.
Solution 3:
By chance, is this occurring on a directory using OverlayFS (or some other special file system type)?
I just had this issue where my cross-compiled version of bash would use an internal implementation of getcwd
which has issues with OverlayFS. I found information about this here:
It seems that this can be traced to an internal implementation of getcwd() in bash. When cross-compiled, it can't check for getcwd() use of malloc, so it is cautious and sets GETCWD_BROKEN and uses an internal implementation of getcwd(). This internal implementation doesn't seem to work well with OverlayFS.
http://permalink.gmane.org/gmane.linux.embedded.yocto.general/25204
You can configure and rebuild bash with bash_cv_getcwd_malloc=yes
(if you're actually building bash and your C library does malloc a getcwd call).
Solution 4:
Yes, cd; and cd - would work. The reason It can see is that, directory is being deleted from any other terminal or any other program and recreate it. So i-node entry is modified so program can not access old i-node entry.