Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #236361 > unrolled thread

"ls -d" OK, but not "ls"

Started byVincent Lefevre <vincent@vinc17.net>
First post2021-06-23 16:10 +0200
Last post2021-06-23 19:30 +0200
Articles 14 — 7 participants

Back to article view | Back to linux.debian.user


Contents

  "ls -d" OK, but not "ls" Vincent Lefevre <vincent@vinc17.net> - 2021-06-23 16:10 +0200
    Re: "ls -d" OK, but not "ls" Roberto C. Sánchez <roberto@debian.org> - 2021-06-23 16:20 +0200
      Re: "ls -d" OK, but not "ls" Vincent Lefevre <vincent@vinc17.net> - 2021-06-23 16:20 +0200
    Re: "ls -d" OK, but not "ls" The Wanderer <wanderer@fastmail.fm> - 2021-06-23 16:20 +0200
      Re: "ls -d" OK, but not "ls" Vincent Lefevre <vincent@vinc17.net> - 2021-06-23 16:30 +0200
        Re: "ls -d" OK, but not "ls" The Wanderer <wanderer@fastmail.fm> - 2021-06-23 16:50 +0200
        Re: "ls -d" OK, but not "ls" Vincent Lefevre <vincent@vinc17.net> - 2021-06-23 16:50 +0200
          Re: "ls -d" OK, but not "ls" Nicolas George <george@nsup.org> - 2021-06-23 16:50 +0200
    Re: "ls -d" OK, but not "ls" Greg Wooledge <greg@wooledge.org> - 2021-06-23 16:30 +0200
      Re: "ls -d" OK, but not "ls" Vincent Lefevre <vincent@vinc17.net> - 2021-06-23 16:50 +0200
        Re: "ls -d" OK, but not "ls" Andrei POPESCU <andreimpopescu@gmail.com> - 2021-06-23 20:30 +0200
          Re: "ls -d" OK, but not "ls" Vincent Lefevre <vincent@vinc17.net> - 2021-06-23 22:50 +0200
            Re: "ls -d" OK, but not "ls" Vincent Lefevre <vincent@vinc17.net> - 2021-06-25 12:40 +0200
    Re: "ls -d" OK, but not "ls" Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2021-06-23 19:30 +0200

#236361 — "ls -d" OK, but not "ls"

FromVincent Lefevre <vincent@vinc17.net>
Date2021-06-23 16:10 +0200
Subject"ls -d" OK, but not "ls"
Message-ID<CtbJM-7kC-7@gated-at.bofh.it>
On a Debian GNU/Linux 10 (buster) machine:

$ ls -ld /etc/systemd
drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd
$ ls /etc/systemd
ls: cannot open directory '/etc/systemd': No such file or directory

Any explanation???

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

[toc] | [next] | [standalone]


#236362

FromRoberto C. Sánchez <roberto@debian.org>
Date2021-06-23 16:20 +0200
Message-ID<CtbTr-7nE-1@gated-at.bofh.it>
In reply to#236361
On Wed, Jun 23, 2021 at 03:59:51PM +0200, Vincent Lefevre wrote:
> On a Debian GNU/Linux 10 (buster) machine:
> 
> $ ls -ld /etc/systemd
> drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd
> $ ls /etc/systemd
> ls: cannot open directory '/etc/systemd': No such file or directory
> 
> Any explanation???
> 
Is the result the same if you specify /bin/ls?  I am wondering if 'ls'
might be an alias in your shell with some strange option(s) defined.

Regards,

-Roberto

-- 
Roberto C. Sánchez

[toc] | [prev] | [next] | [standalone]


#236364

FromVincent Lefevre <vincent@vinc17.net>
Date2021-06-23 16:20 +0200
Message-ID<CtbTr-7nE-5@gated-at.bofh.it>
In reply to#236362
On 2021-06-23 10:02:01 -0400, Roberto C. Sánchez wrote:
> Is the result the same if you specify /bin/ls?

Yes:

$ /bin/ls /etc/systemd
/bin/ls: cannot open directory '/etc/systemd': No such file or directory

> I am wondering if 'ls' might be an alias in your shell with some
> strange option(s) defined.

Yes, "ls" is aliased in my shell (zsh). That's why I also tried
after running sh (dash), where I have no aliases.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

[toc] | [prev] | [next] | [standalone]


#236363

FromThe Wanderer <wanderer@fastmail.fm>
Date2021-06-23 16:20 +0200
Message-ID<CtbTr-7nE-3@gated-at.bofh.it>
In reply to#236361

[Multipart message — attachments visible in raw view] — view raw

On 2021-06-23 at 09:59, Vincent Lefevre wrote:

> On a Debian GNU/Linux 10 (buster) machine:
> 
> $ ls -ld /etc/systemd
> drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd
> $ ls /etc/systemd
> ls: cannot open directory '/etc/systemd': No such file or directory
> 
> Any explanation???

On a non-systemd machine, I get:


$ ls -ld /etc/systemd/
drwxr-xr-x 4 root root 4096 Jul 23  2019 /etc/systemd/
$ ls /etc/systemd/
system  user


It seems possible that the 4 vs. 3 may be notable.

An empty directory will normally report 2: the '.' link from inside it,
and the named link from the parent directory. 4 here reflects the two
'..' links from the two visible subdirectories; 3 would indicate that
one of those four links is missing on your system, and depending on
which one that is, it seems possible that that could lead to misbehaviors.

It could be useful to check on this with other tools. For a start, what
does

$ stat /etc/systemd/

report?


Also, my first thought was to verify that ls is running the way you
think it is. What do the following commands give you?

$ type ls
$ echo $LS_DEFAULT_OPTIONS

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

[toc] | [prev] | [next] | [standalone]


#236366

FromVincent Lefevre <vincent@vinc17.net>
Date2021-06-23 16:30 +0200
Message-ID<Ctc38-7qI-9@gated-at.bofh.it>
In reply to#236363
On 2021-06-23 10:11:57 -0400, The Wanderer wrote:
> On 2021-06-23 at 09:59, Vincent Lefevre wrote:
> 
> > On a Debian GNU/Linux 10 (buster) machine:
> > 
> > $ ls -ld /etc/systemd
> > drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd
> > $ ls /etc/systemd
> > ls: cannot open directory '/etc/systemd': No such file or directory
> > 
> > Any explanation???
> 
> On a non-systemd machine, I get:
> 
> $ ls -ld /etc/systemd/
> drwxr-xr-x 4 root root 4096 Jul 23  2019 /etc/systemd/
> $ ls /etc/systemd/
> system  user
> 
> It seems possible that the 4 vs. 3 may be notable.
> 
> An empty directory will normally report 2: the '.' link from inside it,
> and the named link from the parent directory. 4 here reflects the two
> '..' links from the two visible subdirectories; 3 would indicate that
> one of those four links is missing on your system, and depending on
> which one that is, it seems possible that that could lead to misbehaviors.

These are systemd machines, and on the other machines on the network,
I get 6.

> It could be useful to check on this with other tools. For a start, what
> does
> 
> $ stat /etc/systemd/
> 
> report?

  File: /etc/systemd/
  Size: 0               Blocks: 8          IO Block: 4096   directory
Device: 17h/23d Inode: 118         Links: 3
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-04-19 09:40:10.717284464 +0200
Modify: 2021-04-19 09:40:41.893170056 +0200
Change: 2021-04-19 09:40:41.941169879 +0200
 Birth: -

The number of links is indeed strange.

I also suppose that the size should not be 0.

> Also, my first thought was to verify that ls is running the way you
> think it is. What do the following commands give you?
> 
> $ type ls
> $ echo $LS_DEFAULT_OPTIONS

$ type ls
ls is /bin/ls
$ echo $LS_DEFAULT_OPTIONS

$ 

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

[toc] | [prev] | [next] | [standalone]


#236369

FromThe Wanderer <wanderer@fastmail.fm>
Date2021-06-23 16:50 +0200
Message-ID<Ctcmu-7x4-11@gated-at.bofh.it>
In reply to#236366

[Multipart message — attachments visible in raw view] — view raw

On 2021-06-23 at 10:26, Vincent Lefevre wrote:

> On 2021-06-23 10:11:57 -0400, The Wanderer wrote:
>
>> On 2021-06-23 at 09:59, Vincent Lefevre wrote:
>> 
>>> On a Debian GNU/Linux 10 (buster) machine:
>>> 
>>> $ ls -ld /etc/systemd
>>> drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd
>>> $ ls /etc/systemd
>>> ls: cannot open directory '/etc/systemd': No such file or directory
>>> 
>>> Any explanation???

>> It could be useful to check on this with other tools. For a start, what
>> does
>> 
>> $ stat /etc/systemd/
>> 
>> report?
> 
>   File: /etc/systemd/
>   Size: 0               Blocks: 8          IO Block: 4096   directory
> Device: 17h/23d Inode: 118         Links: 3
> Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
> Access: 2021-04-19 09:40:10.717284464 +0200
> Modify: 2021-04-19 09:40:41.893170056 +0200
> Change: 2021-04-19 09:40:41.941169879 +0200
>  Birth: -
> 
> The number of links is indeed strange.
> 
> I also suppose that the size should not be 0.

It almost certainly should not. On my system, the size is reported as
4096, matching the size of the directory as reported by 'ls -ld'. I also
have a birth timestamp, and the number of links (4) is different;
everything else either matches, or is expected to differ.

I didn't notice that this was 0 in your initial report; I somehow
managed to conflate the 4096 from my own 'ls' output as appearing in
yours.

>> Also, my first thought was to verify that ls is running the way you
>> think it is. What do the following commands give you?
>> 
>> $ type ls
>> $ echo $LS_DEFAULT_OPTIONS
> 
> $ type ls
> ls is /bin/ls
> $ echo $LS_DEFAULT_OPTIONS
> 
> $ 

So that's a dead end.

At a glance, it's looking as if you have a corrupt inode here. I second
Greg's suggestion of a fsck or equivalent, and I'd also suggest that
(probably after that's done) you do some checking to validate that the
underlying disk is still OK.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

[toc] | [prev] | [next] | [standalone]


#236370

FromVincent Lefevre <vincent@vinc17.net>
Date2021-06-23 16:50 +0200
Message-ID<CtccN-7tO-1@gated-at.bofh.it>
In reply to#236366
On 2021-06-23 16:26:10 +0200, Vincent Lefevre wrote:
> On 2021-06-23 10:11:57 -0400, The Wanderer wrote:
> > It could be useful to check on this with other tools. For a start, what
> > does
> > 
> > $ stat /etc/systemd/
> > 
> > report?
> 
>   File: /etc/systemd/
>   Size: 0               Blocks: 8          IO Block: 4096   directory
> Device: 17h/23d Inode: 118         Links: 3
> Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
> Access: 2021-04-19 09:40:10.717284464 +0200
> Modify: 2021-04-19 09:40:41.893170056 +0200
> Change: 2021-04-19 09:40:41.941169879 +0200
>  Birth: -

And while I'm at it, "strace" gives:

[...]
stat("/etc/systemd", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
openat(AT_FDCWD, "/etc/systemd", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
[...]

So, on the same directory, "stat" succeeds, but not "openat".

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

[toc] | [prev] | [next] | [standalone]


#236371

FromNicolas George <george@nsup.org>
Date2021-06-23 16:50 +0200
Message-ID<Ctcmu-7x4-13@gated-at.bofh.it>
In reply to#236370

[Multipart message — attachments visible in raw view] — view raw

Vincent Lefevre (12021-06-23):
> And while I'm at it, "strace" gives:
> 
> [...]
> stat("/etc/systemd", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
> openat(AT_FDCWD, "/etc/systemd", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
> [...]
> 
> So, on the same directory, "stat" succeeds, but not "openat".

Have you looked at dmesg?

Regards,

-- 
  Nicolas George

[toc] | [prev] | [next] | [standalone]


#236367

FromGreg Wooledge <greg@wooledge.org>
Date2021-06-23 16:30 +0200
Message-ID<Ctc38-7qI-11@gated-at.bofh.it>
In reply to#236361
On Wed, Jun 23, 2021 at 03:59:51PM +0200, Vincent Lefevre wrote:
> On a Debian GNU/Linux 10 (buster) machine:
> 
> $ ls -ld /etc/systemd
> drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd

The "0" here is suspicious, and would be an indicator of wrongness
if this is ext4.

What type of file system is it?

> $ ls /etc/systemd
> ls: cannot open directory '/etc/systemd': No such file or directory
> 
> Any explanation???

If it's ext4, then my guess is "corrupted file system, fsck it".

If it's btrfs or zfs, then my guess is "btrfs or zfs voodoo, consult
a shaman".

[toc] | [prev] | [next] | [standalone]


#236368

FromVincent Lefevre <vincent@vinc17.net>
Date2021-06-23 16:50 +0200
Message-ID<Ctcmu-7x4-3@gated-at.bofh.it>
In reply to#236367
On 2021-06-23 10:27:01 -0400, Greg Wooledge wrote:
> On Wed, Jun 23, 2021 at 03:59:51PM +0200, Vincent Lefevre wrote:
> > On a Debian GNU/Linux 10 (buster) machine:
> > 
> > $ ls -ld /etc/systemd
> > drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd
> 
> The "0" here is suspicious, and would be an indicator of wrongness
> if this is ext4.
> 
> What type of file system is it?

aufs

> > $ ls /etc/systemd
> > ls: cannot open directory '/etc/systemd': No such file or directory
> > 
> > Any explanation???
> 
> If it's ext4, then my guess is "corrupted file system, fsck it".
> 
> If it's btrfs or zfs, then my guess is "btrfs or zfs voodoo, consult
> a shaman".

And aufs?

Note: I am not the administrator of the machine (I have opened
a ticket, but I don't know when I will get an answer). However,
if there is something corrupt in the FS, I would have expected
this to be signaled by the kernel instead of getting ENOENT.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

[toc] | [prev] | [next] | [standalone]


#236383

FromAndrei POPESCU <andreimpopescu@gmail.com>
Date2021-06-23 20:30 +0200
Message-ID<CtfNn-1bA-11@gated-at.bofh.it>
In reply to#236368

[Multipart message — attachments visible in raw view] — view raw

On Mi, 23 iun 21, 16:43:51, Vincent Lefevre wrote:
> On 2021-06-23 10:27:01 -0400, Greg Wooledge wrote:
> > On Wed, Jun 23, 2021 at 03:59:51PM +0200, Vincent Lefevre wrote:
> 
> > > $ ls /etc/systemd
> > > ls: cannot open directory '/etc/systemd': No such file or directory
> > > 
> > > Any explanation???
> > 
> > If it's ext4, then my guess is "corrupted file system, fsck it".
> > 
> > If it's btrfs or zfs, then my guess is "btrfs or zfs voodoo, consult
> > a shaman".
> 
> And aufs?

An astrologist.

(sorry, could not resist)

Is this a new issue? If it worked before, what changed since then?

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

[toc] | [prev] | [next] | [standalone]


#236388

FromVincent Lefevre <vincent@vinc17.net>
Date2021-06-23 22:50 +0200
Message-ID<CthYR-2oq-3@gated-at.bofh.it>
In reply to#236383
On 2021-06-23 21:24:43 +0300, Andrei POPESCU wrote:
> Is this a new issue?

I don't know. The machine had been reinstalled in January. But
since this reinstallation, I haven't tried to log in until today
(I was using it only via job submissions).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

[toc] | [prev] | [next] | [standalone]


#236437

FromVincent Lefevre <vincent@vinc17.net>
Date2021-06-25 12:40 +0200
Message-ID<CtRpD-7tw-1@gated-at.bofh.it>
In reply to#236388
On 2021-06-23 22:47:40 +0200, Vincent Lefevre wrote:
> On 2021-06-23 21:24:43 +0300, Andrei POPESCU wrote:
> > Is this a new issue?
> 
> I don't know. The machine had been reinstalled in January. But
> since this reinstallation, I haven't tried to log in until today
> (I was using it only via job submissions).

FYI, the machines have now been reinstalled. It seems that aufs is
unreliable. There have already been problems in the last few years.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

[toc] | [prev] | [next] | [standalone]


#236381

FromJoe Pfeiffer <pfeiffer@cs.nmsu.edu>
Date2021-06-23 19:30 +0200
Message-ID<CteRj-DN-3@gated-at.bofh.it>
In reply to#236361
Vincent Lefevre <vincent@vinc17.net> writes:

> On a Debian GNU/Linux 10 (buster) machine:
>
> $ ls -ld /etc/systemd
> drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd
> $ ls /etc/systemd
> ls: cannot open directory '/etc/systemd': No such file or directory
>
> Any explanation???

snowball:776$ ls -ld /etc/systemd
drwxr-xr-x 5 root root 4096 Jun 17 11:20 /etc/systemd/
snowball:777$ ls /etc/systemd
journald.conf  logind.conf  network/  networkd.conf  pstore.conf  resolved.conf  sleep.conf  system/  system.conf  user/  user.conf
snowball:778$ stat /etc/systemd
  File: /etc/systemd
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: 901h/2305d	Inode: 16517453    Links: 5
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-06-23 11:04:12.898744989 -0600
Modify: 2021-06-17 11:20:15.302495478 -0600
Change: 2021-06-17 11:20:15.302495478 -0600
 Birth: 2012-10-03 22:45:10.910122061 -0600

I'm with the people guessing you've got FS corruption.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web