Cygwin /cygdrive/c no such file or directory
Asked Answered
O

2

6

Host system: Windows Server 2008 32-bit
Installed: Cygwin

I don't know when this problem started, but one of my Rails gems uses the command which to determine the location of a system-installed executable. In my circumstance, it returns /cygdrive/c/Windows/System32/pngcrush - and the file is inaccessible.

In both cygwin terminal and Windows cmd I get the following:

ls -la /cygdrive/c = No such file or directory

mount =

C:/cygwin/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin on / type ntfs (binary,auto)
B: on /cygdrive/b type smbfs (binary,posix=0,user,noumount,auto
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)

Running cd / in Windows terminal brings me to C:\

cd /cygdrive = The system cannot find the path specified

FURTHER EDIT:

I can access the drives using /c for example, but just not /cygdrive/c which is what which returns.

Outport answered 2/9, 2014 at 13:35 Comment(0)
O
6

I found the answer on superuser.com; moving C:\cygwin\bin to the front of the PATH variable fixed the issue.

Outport answered 3/9, 2014 at 17:23 Comment(3)
Did you try restarting afterwards? The environment has to reload.Outport
I did. Still for some strange reason, it is loading the commads coming with git.Subaltern
...and the applications you're using exist within C:\cygwin\bin? i.e., C:\cygwin\bin\which exists?Outport
T
4

This fix was necessary, but not sufficient, for me; one more fix was needed. I was getting the error running Bourne shell scripts which referred to other files on the localFS. All the paths checked out. It wasn't until I used Sys Internals procmon to troubleshoot that I noticed an extra char at the end of the path that wasn't resolving. Viewing the shell script in Notepad++ with View/Show Symbol/Show All Characters revealed Windows style [CR][LF] line ends, not Unix [LF]. Cygwin's sh.exe was including the [CR] on the end of the path, resulting in file not found. I appied cygwin's d2u to convert line ends, and the problem was fixed.

Twopenny answered 7/1, 2016 at 15:5 Comment(1)
lifesafer mate :)Dash

© 2022 - 2024 — McMap. All rights reserved.