A few moments ago, while trying to restart the Postfix service on a client’s system, I was getting the following error:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Some strace runs later, I found that my pwd had been removed and recreated, so I was essentially in a state of limbo as far as the system was concerned. Quick fix:
cd && cd -
Brings me to my ~ directory, then back to the original pwd, and – most importantly – no more errors.