ls: cannot access file: No such file or directory

11

3

Context: I added a drive to my machine, and for whatever reason, I am unable to access a directory(?) on it.

ls -l

ls: cannot access Downloads: No such file or directory
total 56
d?????????  ? ?    ?        ?            ? Downloads
drwxr-xr-x 26 user    12288 Aug 12 23:29 foo

ls -a

.  ..  Downloads  foo

cd

bash: cd: Downloads: No such file or directory

touch

touch: cannot touch ‘Downloads’: File exists

mkdir Downloads

mkdir: cannot create directory ‘Downloads’: File exists

cat Downloads

cat: Downloads: No such file or directory

file Downloads

Downloads: cannot open `Downloads' (No such file or directory)

mv Downloads down

mv: cannot stat ‘Downloads’: No such file or directory

Furthermore, the following commands do not remove the file(?), as root or otherwise:

rm Downloads
rm -rf Downloads
rmdir Downloads

One more piece of information, bash auto-completes Downloads, so bash also seems to think it is there.

Beefy_Swain

Posted 2015-08-15T09:28:25.407

Reputation: 361

Perhaps your filesystem has been corrupted. Are you able to do any action in a different OS? – Zumo de Vidrio – 2017-01-12T09:15:04.787

I would say that the metadata is corrupted or unreadable by the current OS. If you "repair" it there, it may work or it may become permanently inaccessible anywhere. Proceed with caution (and backups) – Kit – 2017-05-07T05:21:13.353

Perhaps this is the same as https://askubuntu.com/questions/548930/d-cannot-access-dirname-no-such-device

– Foo Bar – 2017-08-02T20:18:26.000

Answers

1

ls: cannot access Downloads: No such file or directory total 56 d????????? ? ? ? ? ? Downloads drwxr-xr-x 26 user 12288 Aug 12 23:29 foo

This is a typical case of having only read perms on a dir and no exec perms. And the other command outputs give the show that you don't have write perms either. To understand why this happens you'll have to know about inodes, dentries and the path lookup process of the kernel

Arnab Mukherjee

Posted 2015-08-15T09:28:25.407

Reputation: 11

0

I had a file show up in a similar state. I was able to fix it by running fsck.

thains

Posted 2015-08-15T09:28:25.407

Reputation: 1

5It would be nice to be more specific - e.g. by booting a live distro, or on reboot. Maybe you found what the core problem was - e.g. improperly unmounted network share, or permissions on his new disk that do not make sense to his current system, etc. – r0berts – 2017-01-26T18:31:46.827

0

D, you haven't described the situation around the issue, but here goes,

First does the directory appear in your file manager? According to your listing

d?????????  ? ?    ?        ?            ? Downloads

The directory "exists" but, without any discernable/set/assigned permissions, nor does it belong to a user or a group. In fact, on the face of it, read access is completely blocked. Again, describe the situation around this issue, meaning how did you arrive at this point?.

As an experiment , boot a live distro, and access that way, get the listing for Downloads and either assign "standard" directory permissions 755 or delete the directory. From time to time i have experienced what seem to be "bad writes" of files with the same issue and have had to jump to a live distro to delete them from my daily driver. If you CAN access the Download directory from the live distro, then recover it's contained data "off world" before you delete the directory. It's better to recreate the directory correctly once you are back in normal operation.

moonbutt74

Posted 2015-08-15T09:28:25.407

Reputation: 140

updated post with contex – Beefy_Swain – 2015-08-15T19:29:41.747

Check your mount options for the drive. – moonbutt74 – 2015-08-15T20:25:31.693

-1

Yan Peng

Posted 2015-08-15T09:28:25.407

Reputation: 1

1How will sole unmounting help? It's like repairing a car by putting it out of sight. If the link leads to the real solution, please cite it here; the target site may change or disappear. Is the solution substantially different than what other answers suggest? – Kamil Maciorowski – 2018-09-12T09:57:53.673