The Problem
Some user directories cannot be deleted. For example:
/root/.cache/doc/ directory /root/.cache/doc/by-app directory
If we try to delete the directory, we get the below error:
# rm -rf /root/.cache/doc/ rm: cannot remove 'doc/by-app': Function not implemented
The Solution
The directories are the mount points for /dev/fuse device.
# mount --mount (ext, ocfs2, nfs, gfs, fuse, cifs, btrfs, xfs) /dev/fuse on /root/.cache/doc type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
# df /dev/fuse 0 0 0 - /root/.cache/doc
We can see the following user process xdg-docum are using the /root/.cache/doc.
# lsof -b M -n -l -c|grep -i fuse xdg-docum 2222 0 mem REG 252,0 259336 67222590 /usr/lib64/libfuse.so.2.9.4 xdg-docum 2222 0 7u CHR 10,229 0t0 24701 /dev/fuse
# cat ps|grep -i xdg-docum root 2222 0.0 0.0 590816 4860 ? Sl Jan1 0:00 /usr/libexec/xdg-document-portal
Conclusion
The mount from /dev/fuse on /root/.cache/doc is managed by the user process /usr/libexec/xdg-document-portal. The users may need to gracefully stop this process and then umount the /root/.cache/doc if they want to delete the directories.