Fix the “Unable to find or create trash directory” in Thunar


Please note that this blog has been moved.

Now it has its own domain: mynixworld.info 🙂

If you want to read the latest version of this article (recommended) please click here and I open the page for you.

If you get the following error when you are deleting a file within Thunar then it should be the right moment to check few things, if you want it to be fixed:

  • check if you have gvfs installed
  • check if you have a ~/.local/share/Trash folder (with the file mod 700) on the same volume as the file/folder that you want to delete

I had the following situation:

  • the ~/Documents and the ~/Downloads folders that exists in my ~/ are not located physically on the same partition like the rest of the ~/ folder; instead, I keep them on a different partition (which is a logical volume on a stripe-set physical volume) mostly because I want them to move fast:

click to zoom

So anytime I want to delete something within the Documents/Downloads folders I got an error like: “Unable to find or create trash directory”.

The error came actually from the gvfs-trash because basically Thunar has gnome-base/gvfs as a dependency, so anytime when you are moving something to Trash can within Thunar, you actually call the command : gvfs-trash <my-folder>.

Anyway, what is worth to remember is that according with Thunar home page:

The trash implementation, which was introduced with the first release candidate of Thunar (0.4.0 RC1), was initially limited to the home trash, and therefore not a fully compliant implementation of the Desktop Trash Can Specification. This release finally adds support for the so-called trashing to “top directories”, which means that files can be trashed into special folders on removable volumes to avoid costly copying to the home folder. Xfce is thereby the second desktop which fully complies with the Desktop Trash Can Specification.

This means that if you have Thunar 0.8.0 (or later) you can take the advantage of using a Trash folder at the top level of any volume you might have.

So what I did: I went to the volume-root directory (mounted at /home/eugen/lvhome/) where I have a folder called /<my-profile> where I keep my Documents/Downloads folders:

the root of my volume

and I have created a Trash directory structure with the right permissions inside the <volume-root>/<my-profile>/.local/share:

mkdir -p /home/eugen/lvhome/eugen/.local/share/Trash/{files,info}
chmod -R 700 /home/eugen/lvhome/eugen/.local/share/Trash

the Trash folder on my volume

Now, when I am trying to delete a file/folder that exists on this volume (in Documents/Downloads folder for instance) I don’t get anymore an error message but a confirmation message box:


So, problem solved. Happy trashing! 🙂

Advertisement

About Eugen Mihailescu

Always looking to learn more about *nix world, about the fundamental concepts of arithmetic, algebra and geometry. I am also passionate about programming, database and systems administration.
This entry was posted in linux, xfce and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s