[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: