-1

I am trying to delete a directory.

rm -rf bla

rm: cannot remove ‘bla’: Directory not empty

It looks empty. I have also tried rmdir.

The ownership and groups looks fine. In fact, the directory was created by a tool I just ran.

drwxrwsr-x 2 me mygroup 4096 Oct 20 17:59 bla

I have changed permissions to chmod 777 bla, but I still cannot delete it.

I am on a cluster and do not have sudo rights. The file itself is not in any special system location or anything.

mindlessgreen
  • 1,229
  • 4
  • 12
  • 21
  • Have you tried "ls -ar blah/*"? You might have hidden files in the directory. – Garnet Oct 20 '21 at 20:32
  • 1
    @Garnet, itym `ls -a bla/`, without the final asterisk, since it won't match dotfiles – ilkkachu Oct 20 '21 at 20:34
  • Yes. Still empty. – mindlessgreen Oct 20 '21 at 20:35
  • I would have ran `find bla -ls`. I doubt it, but is there a file system which will deny deleting a directory until all deleted files/directories are unlinked? – Bib Oct 20 '21 at 20:45
  • Take a look at [this](https://unix.stackexchange.com/questions/506319/why-am-i-getting-directory-not-empty-with-rm-rf). – schrodingerscatcuriosity Oct 20 '21 at 21:09
  • Is `bla` a directory on an NFS filesystem? If so - and only if so - please take a look at https://unix.stackexchange.com/q/348315/100397 (the error message won't apply, but the symptoms and solution might) – roaima Oct 20 '21 at 21:31
  • *In fact, the directory was created by a tool I just ran.* Please, provide the name of tool, version, ... – Damir Oct 20 '21 at 21:47
  • 1
    @roaima I have experienced this issue with .nfs0000093883 like temporary file which prevents the directory from being deleted. In this case, the directory is empty. – mindlessgreen Oct 21 '21 at 06:33
  • @Damir Not really sure if the tool matters. It is a bioinformatic tool called [CellRanger](https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/what-is-cell-ranger). It itself is probably a mashup of various other tools. – mindlessgreen Oct 21 '21 at 06:33
  • 1
    I wrote to the system admin and it turns out the issue was beyond me. Got this response: "There is an issue with metadata on Glusterfs that causes this kind of behavior. I can fix this for you." So, I don't know what kind of magic they do. Anyway, Thank you all for your help and suggestions. – mindlessgreen Oct 21 '21 at 06:38

1 Answers1

0

Can you try chmod 0777 bla or chmod g-s bla. I think s bit in group permissions blocking the rm.

I think you must remove that bit. But I don't know how? Also you can try remove all permissions with chmod 0700 bla

  • No, it shouldn't be the problem. To the part *But I don't know how?* -You gave the answer in your first sentence in this part `chmod g-s bla` - this is the exact way how to remove 'setgid' bit. – Damir Oct 20 '21 at 21:43
  • Changing the "s" didn't solve the issue. – mindlessgreen Oct 21 '21 at 06:26
  • The setgid bit on a directory will have no effect on a user's ability to delete it – roaima Oct 21 '21 at 06:48