A few months ago, I moved to Linux Mint 14 “nadia”, which is based on Ubuntu 12.10 “quantal quetzal”. I sometimes see this error after running a commmand with sudo:
rm: cannot remove `/run/user/root/gvfs': Is a directory
This happens because the root user has started a
gvfsd daemon, which mounts a virtual filesystem on that directory. The root user should never run GNOME, so it should never need gvfsd. But something in Ubuntu 12.10 starts one sometimes.
You can work around it by unmounting this directory. However, I prefer the more direct approach of killing root’s gvfsd.
First create a shell script:
sudo tee /usr/local/bin/kill-root-gvfsd > /dev/null << ENDOFLINE #!/bin/sh killall -u root gvfsd 2>/dev/null exit 0 ENDOFLINE sudo chmod 755 /usr/local/bin/kill-root-gvfsd
* Like my tee trick? Sudo is great, but I hate not being able to use shell redirects.
Running this script will kill root’s gvfsd daemon. You can run this script whenever the problem happens. But since the issue is random, and since I never want to see it again, I’ll use cron to run it periodically.
sudo tee /etc/cron.d/kill-root-gvfsd > /dev/null << ENDOFLINE 0,30 * * * * root [ -x /usr/local/bin/kill-root-gvfsd ] && /usr/local/bin/kill-root-gvfsd ENDOFLINE
Now gvfsd will stay dead. Or at least never live longer than 30 minutes.
This is a hack. A good solution would be to find out why gvfsd starts and run this script afterward. A better solution would be to find a way to prevent root from starting gvfsd at all. As always, suggestions are welcome.