sh: 0: getcwd() failed: No such file or directory on cited drive

This error is usually caused by running a command from a directory that no longer exists.

Try changing your directory and rerun the command.


That also happened to me on a recreated directory. The directory is the same, but to make it work again, just run:

cd .

Try the following command. It worked for me.

cd; cd -

This can happen with symbolic links sometimes. If you experience this issue and you know you are in an existing directory, but your symbolic link may have changed, you can use this command:

cd $(pwd)

In Ubuntu 16.04.3 LTS (Xenial Xerus), the following command works for me:

exit

Then I've login again.