1

I'm trying to remove some obsolete backups, and deep inside one I've found a file 'cifs3bee' that I can find no way of removing. (And since I can't remove it, it's preventing the removal of the entire directory tree leading to it.) If I run ls -l I get:

total 1
-rwxr-xr-x 1 jgw87 root 307 Oct 30  2014 cifs3bee

And if I run file cifs3bee I sometimes get:

cifs3bee: writable, regular file, no read permission

but sometimes I get:

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

which is basically the same error I always get if I run rm, chmod, lsattr, less, or just about any other command on it (even if I sudo up to root). I even tried 'echo "x" > cifs3bee' and still get a No such file or directory error, even though ls will continue to show the file and 'rm -rf' on the parent directory fails saying that the directory isn't empty.

What's going on here, and does anyone know how to work around it? I don't even know how this file got into my backup, since the name doesn't match the pattern I set up for which files to grab.

Edit: Sorry, forgot the system specs. This is me running Linux Mint 17, working on a remote Windows server mounted via Samba. (I don't know the server specs.)

Edit: I ran strace head cifs3bee, with the following output:

execve("/usr/bin/head", ["head", "cifs3bee"], [/* 69 vars */]) = 0
brk(0)                                  = 0x11f0000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8ccbe8f000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-5.0/lib/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-5.0/lib/tls/x86_64", 0x7fff275aa470) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-5.0/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-5.0/lib/tls", 0x7fff275aa470) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-5.0/lib/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-5.0/lib/x86_64", 0x7fff275aa470) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-5.0/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-5.0/lib", 0x7fff275aa470) = -1 ENOENT (No such file or directory)
open("/home/jgw87/Software/root/lib/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/jgw87/Software/root/lib/tls/x86_64", 0x7fff275aa470) = -1 ENOENT (No such file or directory)
open("/home/jgw87/Software/root/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/jgw87/Software/root/lib/tls", 0x7fff275aa470) = -1 ENOENT (No such file or directory)
open("/home/jgw87/Software/root/lib/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/jgw87/Software/root/lib/x86_64", 0x7fff275aa470) = -1 ENOENT (No such file or directory)
open("/home/jgw87/Software/root/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/jgw87/Software/root/lib", {st_mode=S_IFDIR|0770, st_size=32768, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=168641, ...}) = 0
mmap(NULL, 168641, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8ccbe65000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0
mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8ccb8aa000
mprotect(0x7f8ccba65000, 2093056, PROT_NONE) = 0
mmap(0x7f8ccbc64000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f8ccbc64000
mmap(0x7f8ccbc6a000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f8ccbc6a000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8ccbe64000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8ccbe62000
arch_prctl(ARCH_SET_FS, 0x7f8ccbe62740) = 0
mprotect(0x7f8ccbc64000, 16384, PROT_READ) = 0
mprotect(0x608000, 4096, PROT_READ)     = 0
mprotect(0x7f8ccbe91000, 4096, PROT_READ) = 0
munmap(0x7f8ccbe65000, 168641)          = 0
brk(0)                                  = 0x11f0000
brk(0x1211000)                          = 0x1211000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2919792, ...}) = 0
mmap(NULL, 2919792, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8ccb5e1000
close(3)                                = 0
open("cifs3bee", O_RDONLY)              = -1 ENOENT (No such file or directory)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8ccbe8e000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2570
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x7f8ccbe8e000, 4096)            = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=619, ...}) = 0
mmap(NULL, 619, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8ccbe8e000
close(3)                                = 0
open("/usr/lib/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
write(2, "head: ", 6head: )                   = 6
write(2, "cannot open \342\200\230cifs3bee\342\200\231 for r"..., 38cannot open ‘cifs3bee’ for reading) = 38
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++

Unfortunately, I don't know how to interpret that. Any help?

5
  • On what filesystem type is this? The name would suggest to me that it's some sort of CIFS temporary file, and then all bets are off.
    – wurtel
    Jul 15, 2015 at 13:49
  • any error reported in dmesg ? can you umount the filessytem and run fsck ?
    – Archemar
    Jul 15, 2015 at 13:52
  • Looks strange, generally 'echo "x" > cifs3bee' should create the file if it's not already present. try a lsof cifs3bee and see if it gives any results. What does ls -i cifs3bee give?
    – neuron
    Jul 15, 2015 at 14:02
  • [Edited post to give system info] dmesg has some errors from CIFS, so that may be related to what's going on. lsof gives a file-not-found error. I'll try unmounting once some other tasks have completed.
    – Jason
    Jul 15, 2015 at 14:45
  • On the theory that there's some non-printable character in the filename, does ls -b or ls -q in that directory show anything unusual?
    – Jeff Schaller
    Jul 15, 2015 at 16:08

2 Answers 2

2

First thought, I wonder if you might have a trailing space(s) on the file name. Test by typing ls "cifs and then tab to auto-complete (assuming you are on a Linux box, which is a big assumption of course). If this does not bear fruition try removing the file by its inode instead.

Good explanation of how to do so here: delete / remove files with inode number

Highlights of the process include
First get the inode for the file: ls -il

Then with the inode in hand try and remove the file:

find . -inum [inode-number] -exec rm -i {} \;</b>
7
  • giving reference is fine, can you copy/paste usefull details ?
    – Archemar
    Jul 15, 2015 at 14:04
  • Absolutely. Thought it would be most useful to have a source with explanation, but I also updated the original post to include a basic example of the proces.
    – User567
    Jul 15, 2015 at 14:14
  • it's really not that big an assumption on this stackexhange. ;) Jul 15, 2015 at 14:38
  • Thanks. No trailing spaces, and even thought I can find the inode number I still get the error when trying to delete it. ('rm: cannot remove ‘./cifs3bee’: No such file or directory')
    – Jason
    Jul 15, 2015 at 14:48
  • Sorry, would add this comment to your post above, but do not have high enough rep. So it is a CIFS share. We may be beating our heads here for something you need to verify from the Windows side in regards to permissions. Do you have direct access to the Windows box or can you get assistance from its admins to verify the Windows security for the folder/file itself?
    – User567
    Jul 15, 2015 at 17:39
1

You may still me able to mv that file around it's partition. Try to move it away. But in seems that's disk or filesystem error. Next step I would do is fsck .

Also, try 'strace echo "abcd" > file' and find out which syscall really generates the error like "no such file or directory" because if it not exist it should be created, so something else not exist like bash interpreter or parent directory or echo is not echo but alias.

Another possibility that something removes/restores file so you just not really lucky and it gets removed recreated in same time as you look onto it.

Another possibility is that something specific for filesystem as other guys properly pointed that presence of 'cifs' in file name points to this possibility.

1
  • Thanks. Mv still fails, but I added the strace results as an edit.
    – Jason
    Jul 15, 2015 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.