问题
I am trying to compile ARM code in Ubuntu 12.
Everything is working fine when I put the code in the local directory.
But when I put the code in cited mount directory error shows up:
making testXmlFiles
sh: 0: getcwd() failed: No such file or directory
ARM Compiling xxxxx.c
sh: 0: getcwd() failed: No such file or directory
Here is my setting in fstab
//10.0.0.1/data /mnt/data cifs auto,noserverino,credentials=/root/.smbcredentials,file_mode=0777,dir_mode=0777,uid=user,gid=users,noperm 0 0
What is going on here? What could cause this error?
回答1:
This error is usually caused by running a command from a directory that no longer exist.
Try changing your directory and re-run the command.
回答2:
Try the following command, it worked for me.
cd; cd -
回答3:
That also happened to me on a recreated directory, the directory is the same but to make it work again just run:
cd .
回答4:
This can happen with symlinks sometimes. If you experience this issue and you know you are in an existing directory, but your symlink may have changed, you can use this command:
cd $(pwd)
回答5:
In Ubuntu 16.04.3 LTS, the next command works for me:
exit
Then I've login again.
回答6:
Please check the directory path whether exists or not. This error comes up if the folder doesn't exists from where you are running the command. Probably you have executed a remove command from same path in command line.
回答7:
In my case nothing above has worked. After banging my head against the wall for a while I've found out, that I've destroyed the /etc/passwd
entries by running a custom-made-linux-server-setup-bash-script which worked well previously, but this time the regex within the "sed" command erased all the existing entries :D
After copy pasting the default entries from another working linux server I could finally restart sshd.
So don't forget to backup the original /etc/passwd
file before applying any regex replacements on it :)
回答8:
if some directory/folder does not exist but somehow you navigated to that directory in that case you can see this Error,
for example:
- currently, you are in "mno" directory (path = abc/def/ghi/jkl/mno
- run "sudo su" and delete mno
- goto the "ghi" directory and delete "jkl" directory
- now you are in "ghi" directory (path abc/def/ghi)
- run "exit"
- after running the "exit", you will get that Error
- now you will be in "mno"(path = abc/def/ghi/jkl/mno) folder. that does not exist.
so, Generally this Error will show when Directory doesn't exist.
to fix this, simply run "cd;" or you can move to any other directory which exists.
回答9:
Even i was having the same problem with python virtualenv It got corrected by a simple restart
sudo shutdown -r now
来源:https://stackoverflow.com/questions/12758125/sh-0-getcwd-failed-no-such-file-or-directory-on-cited-drive