-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.

10
  • Have you tried "ls -ar blah/*"? You might have hidden files in the directory.
    – Garnet
    Oct 20, 2021 at 20:32
  • 1
    @Garnet, itym ls -a bla/, without the final asterisk, since it won't match dotfiles
    – ilkkachu
    Oct 20, 2021 at 20:34
  • Yes. Still empty. Oct 20, 2021 at 20:35
  • 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. Oct 21, 2021 at 6: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. Oct 21, 2021 at 6:38

1 Answer 1

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

3
  • 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, 2021 at 21:43
  • Changing the "s" didn't solve the issue. Oct 21, 2021 at 6:26
  • The setgid bit on a directory will have no effect on a user's ability to delete it
    – roaima
    Oct 21, 2021 at 6:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .