Subject: Re: ls: reading directory /: No such file or directory
From: Jeff <[email-masked]>
To: [email-masked]
Date: Mon, 24 Dec 2007 04:01:28 -0800
Newsgroups: lists.cygwin
List-Id: <cygwin.cygwin.com>

On Mon, 24 Dec 2007 04:37:11 -0500,
Robert Pendell <shinji+gmane[at]elite-systems[dot]org> wrote:

>Now looking at your mount points I would say that there are 7 potential
>problem points.  The 3 mounts pointing to smb shares and the 4 mounts
>for your drives.  If the drive doesn't exist then it can cause this.  If
>the smb share cannot be reached it may be causing this and the 2 second
>delay.

That's "bingo!" :)

  Now creating a folder in the root to match the mount point will
>resolve this issue without having to change your mount table however.  I
>just checked and that cleared it right back up.

It did for me, too-- I now get error messages that actually make some
sense, and fit the circumstances. Previously, my mount table was...

>>>> \\Winxp-inspiron\c on /inspiron type system (binmode)
>>>> C:\WINDOWS\TEMP on /tmp type system (binmode)
>>>> \\Winxp-desk\c on /desk-c type system (binmode)
>>>> \\Winxp-desk\d on /desk-d type system (binmode)
>>>> C:\Cygwin\bin on /usr/bin type system (binmode)
>>>> C:\Cygwin\lib on /usr/lib type system (binmode)
>>>> C:\Cygwin on / type system (binmode)
>>>> A: on /a type system (textmode)
>>>> C: on /c type system (textmode)
>>>> D: on /d type system (textmode)
>>>> E: on /e type system (textmode)

First, I removed the bogus drive 'E: on /e', which I think was for
mapping network drives (before I knew that Cygwin could handle the
'\\host\drive\' smb share syntax directly). For the rest, I created the
empty directories to match the mount points. Being that Cygwin has its
own way of mapping POSIX file permissions onto Windows ones, I
'umount'ed each entry, created the directory with 'mkdir' (instead of
cmd.exe or Explorer), then remounted, which I was then able to do
without resorting to 'mount -f'.

When I went to mount my network shares, things got more interesting.
When I mounted one machine that is currently powered down, 'mount'
accepted it without comment after a slight delay. When I mounted the
other, which is currently accessible...

Administrator@winxp-notebook ~
$ mount '\\Winxp-desk\c' /desk-c
mount: defaulting to '--no-executable' flag for speed since native path
       references a remote share.  Use '-f' option to override.

So I went back and mounted the powered down machine with the same flag.
My mount table now looks like this:

Administrator@winxp-notebook ~
$ mount
\\Winxp-inspiron\c on /inspiron type system (binmode,noexec)
C:\WINDOWS\TEMP on /tmp type system (binmode)
\\Winxp-desk\c on /desk-c type system (binmode,noexec)
\\Winxp-desk\d on /desk-d type system (binmode,noexec)
C:\Cygwin\bin on /usr/bin type system (binmode)
C:\Cygwin\lib on /usr/lib type system (binmode)
C:\Cygwin on / type system (binmode)
A: on /a type system (textmode)
C: on /c type system (textmode)
D: on /d type system (textmode)

'ls -la /' now produces this:

Administrator@winxp-notebook ~
$ ls -la /
ls: cannot access /a: No such file or directory
ls: cannot access /d: No medium found
ls: cannot access /inspiron: No such file or directory
total 425
drwx------+ 20 Administrator  None        0 Dec 24 03:55 .
drwx------+ 20 Administrator  None        0 Dec 24 03:55 ..
???????????  ? ?              ?           ?            ? a
drwx------+  2 Administrator  None        0 Dec 19 12:23 bin
drwxrwxrwt+ 13 Administrators SYSTEM      0 Dec 23 17:52 c
dr-xr-xr-x   1              0 root        0 Dec 31  1969 cygdrive
-rwx------   1 Administrator  None      766 Jan  8  1997 cygnus.ico
-rwx------   1 Administrator  None       55 Jun  1  2002 cygwin.bat
-rwx------   1 Administrator  None     7022 Dec 19 11:08 cygwin.ico
drwx------+  6 Administrator  None        0 Dec 19 10:39 cygwindl
???????????  ? ?              ?           ?            ? d
drwx------   1 Administrator  None        0 Dec 24 01:27 desk-c
drwx------   1 Administrator  None        0 Dec 23 15:25 desk-d
drwx------+  2 Administrator  None        0 Dec 19 02:25 dev
drwx------+ 11 Administrator  None        0 Dec 19 12:55 etc
drwx------+  6 Administrator  None        0 Dec 24 03:22 home
???????????  ? ?              ?           ?            ? inspiron
drwx------+ 22 Administrator  None        0 Dec 19 02:24 lib
dr-xr-xr-x   1 Administrator  None        0 Nov 30  2006 proc
drwx------+  2 Administrator  None        0 May  9  2006 sbin
-rwx------   1 Administrator  None   415232 Dec 13 06:11 setup.exe
-rwx------   1 Administrator  None    29636 Oct  1  2005 setup.log
-rwx------   1 Administrator  None     1381 Oct  1  2005 setup.log.full
drwx------+  2 Administrator  None        0 Dec 24 03:22 tmp
drwx------+ 19 Administrator  None        0 Dec 19 02:22 usr
drwx------+  8 Administrator  None        0 Dec 19 02:22 var

This now makes total sense: This Cygwin is on a notebook with a
hot-swappable drive bay. A: or /a is a floppy drive that currently is
not on the system. D: or /d is an optical drive that /is/ on the
system, but has no media in it. \\Winxp-inspiron or /inspiron is
currently powered down. \\Winxp-desk\ or /desk-[cd] is up and
accessible. What's more, the /proc virtual file system, which has not
shown itself on my system in the last couple of cygwin1.dll revisions,
is once again visible, sparing me the embarrassment of posting a "Where
did /proc go?" message to the list.

Not wanting a bunch of empty directories on my system, I created my
mount table with 'mount -f'. This created no problems with earlier
versions of the dll and utilities:

Administrator@winxp-desk ~
$ uname -a
CYGWIN_NT-5.1 winxp-desk 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin

Administrator@winxp-desk ~
$ ls --version
ls (GNU coreutils) 5.94
[...]

As opposed to:

Administrator@winxp-notebook ~
$ ls --version
ls (GNU coreutils) 6.9
[...]

Administrator@winxp-desk ~
$ mount
\\Winxp-notebook\c on /notebook-c type system (binmode)
C:\Cygwin\bin on /usr/bin type system (binmode)
C:\Cygwin\lib on /usr/lib type system (binmode)
C:\Cygwin on / type system (binmode)
D:\TEMP on /tmp type system (binmode)
A: on /a type system (textmode)
C: on /c type system (textmode)
D: on /d type system (textmode)
E: on /e type system (textmode)

Administrator@winxp-desk ~
$ ls -la /
total 602
drwx------+ 11 Administrator None       0 Oct 31 09:41 .
drwx------+ 11 Administrator None       0 Oct 31 09:41 ..
drwx------+  2 Administrator None       0 May 20  2006 bin
dr-xr-xr-x   7             0 root       0 Dec 31  1969 cygdrive
-rwx------+  1 Administrator None     766 Jan  8  1997 cygnus.ico
-rwx------+  1 Administrator None      55 Jun  1  2002 cygwin.bat
-rwx------+  1 Administrator None    7022 May 20  2006 cygwin.ico
drwx------+  3 Administrator None       0 May 20  2006 cygwindl
drwx------+  2 Administrator None       0 Dec 19  2004 dev
drwx------+ 10 Administrator None       0 May 20  2006 etc
drwx------+  5 Administrator None       0 Dec  6 03:10 home
drwx------+ 22 Administrator None       0 May 20  2006 lib
dr-xr-xr-x  11 Administrator None       0 Dec 24  2007 proc
drwxrwx---+  2 Administrator Users      0 May 20  2006 sbin
-rwx------+  1 Administrator None  305664 Jan 10  2006 setup.exe
-rwx------+  1 Administrator None   29636 Oct  1  2005 setup.log
-rwx------+  1 Administrator None    1381 Oct  1  2005 setup.log.full
drwx------+ 18 Administrator None       0 May 20  2006 usr
drwx------+  8 Administrator None       0 May 17  2005 var

Notice that this 'ls -la /' (ver. 5.94) doesn't try to list out
everything mounted under '/'. This is significantly different
behaviour from that in ver. 6.9. "Let the user beware," as they say--
this time, of using 'mount -f'.

This has been most instructive, and I thank you for your help. Please
forgive me for writing at such length, but I wanted to document this
for the list archives, for the next person who stumbles across this
problem.

Jeff
-- 
"Sorry, my life is still in beta, and nowhere near stable enough for a
release."

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/