Linux – Cannot Remove File, Device or Resource Busy

killprocessrm

I tried removing a file. The most relevant answer can be found here, but I found no luck. Here is the original problem:

maxgitt@mgpc:~$ sudo rm -rf /var/lib/docker/
rm: cannot remove '/var/lib/docker/aufs': Device or resource busy

To locate the process I tried the following:

maxgitt@mgpc:~$ sudo lsof +D /var/lib/docker/
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.

So I tried found in a comment in the above answer but found nothing,

maxgitt@mgpc:~$ /sbin/fuser -m /var/lib/docker/
bash: /sbin/fuser: No such file or directory

Even ps couldn't find the process

maxgitt@mgpc:~$ ps aux | grep docker
maxgitt   5349  0.0  0.0  14224  1024 pts/18   S+   15:21   0:00 grep --color=auto docker
maxgitt@mgpc:~$ 

Any help on how to kill this mysterious process would be great.

Best Answer

Its still mounted. I bet you see it if you run mount. If so run the following

# umount /var/lib/docker/aufs
# rm -rf /var/lib/docker