I know there can be a lot of duplicates. I have gone through almost all of them (like lsof, fuser, etc) and I could not get it resolved.
rm: cannot remove 'temp_p/sys': Device or resource busy
This is the error I receive while trying to delete a folder from a bash script. The command I use is:
test -f "$TEMP_DIR" && sudo rm -rf "$TEMP_DIR"
I tried to do rm -rf from the shell, and it shows the same output. Output of lsof is:
lsof +D <directory name>
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/76585/gvfs Output information may be incomplete. lsof: WARNING: can't stat() vfat file system /media/kostef1/9016-4EF8 Output information may be incomplete.
Fuser also does not show anything. If I list all hidden files, it still hoes not show anything starting with dot.