Hi,
I've Ubuntu 8.04, and it has some files that I just cannot delete. I've tried everything, inode, fsck etc.
Here is what the ls -li outputs
root@ubuntu:/home/luser/.local/share/Trash/files/junk# ls -l
ls: cannot access TRUNK_: No such file or directory
ls: cannot access 2006_output.mv: No such file or directory
total 0
?????????? ? ? ? ? ? 2006_output.m?v
?????????? ? ? ? ? ? TRUNK_
I've tried to delete by inode, ran fsck, tried to get lsattr, nothing works. Any ideas.
This reminds me when I was chasing after disk space not correct on a pc, and using a knoppix, found the culprit... some IE cache but impossible to remove... I had to hack the MS administrator passwd and change the users passwd in order to connect "as" and clear the "Internet Explorer temporary files (or cache?? dont remember what its called) to recuperate 800MB...
As you until then I thought I could do everything with unix or liveCD such as knoppix...
What a shock...
Remember that a directory is basicly a table with each entry being a name and an inode. In the usual case of a mysteriously undeletable file the name is some very difficult-to-type string of characters. So we suggest some counter-measure that avoids needing to type the name, such as
cd /directory
rm -i *
There is nothing actually wrong in these cases, we just have a very odd filename.
But notice this:
root@ubuntu:/home/luser/.local/share/Trash/files/junk# ls -l
ls: cannot access TRUNK_: No such file or directory
ls: cannot access 2006_output.mv: No such file or directory
total 0
?????????? ? ? ? ? ? 2006_output.m?v
?????????? ? ? ? ? ? TRUNK_
No odd filename can yield this result. Because the OP succeeded in cd'ing to this directory, he should also have permission to stat(2) the files. A simple "ls -l" should bypass the name problem just a a simple "rm -i *" would. But stat(2) appears to be failing. My guess is that the inode numbers are pointing to unallocated inodes.
In theory, "fsck -f" should fix this, and that is what I would recommend as a start. However, I have not yet encountered this problem in Linux, so I have never tried this myself.
root@ubuntu:/some/dir/# ls 2006* | od -c
ls: cannot access 2006_output.mv: No such file or directory
0000000
I tried removing with rm *, rm <files> -r -f. Here is the funny part, just doing ls gives me this
root@ubuntu:/some/dir/# ls
ls: cannot access TRUNK_: No such file or directory
ls: cannot access 2006_output.mv: No such file or directory
2006_output.m?v TRUNK_
I'm guessing this has something to do with NFS. The users data was migrated from SUSE to Ubuntu, and in old SUSE there were some NFS mounts.
Will look around.
I don't think it'd be an NFS problem unless you are actually mounting with NFS. Directories that used to be NFS-mapped shouldn't leave weird remainders behind, their contents would just vanish when not mapped in. Again, I suspect filesystem errors.
Try the following to find out what characters are in this filename without having to guess the name. Maybe it contains backspace character(s) or more?
ls -lab | pg
When a file has a weird name it is safer to find out the exact name, then carefully rename the file without letting shell expand any awkward characters (like asterisk).
There was a very good tip on this board about redirecting "ls" to a file and then looking with "od" (or "xd" if you have it). That way shell or the screen driver does not action any special characters in the filename.