My *nix world

Fix the "Unable to find or create trash directory" in Thunar

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:
unable to find or create trash directory

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 .

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:

unable to find or create trash directory

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
unable to find or create trash directory

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:

unable to find or create trash directory
So, problem solved. Happy trashing! 🙂

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

 
The following two tabs change content below.
Fix the "Unable to find or create trash directory" in Thunar

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
Tagged on: ,

2 thoughts on “Fix the "Unable to find or create trash directory" in Thunar

  1. kozaki

    Hi, that's interesting --and should become a more common case (think of SSD market share, chromebooks with awfully limited internal SSDs for ex.). ALso I like how you present the background --for those of us curious as you seem to be 😉 Note that CSS has made his way through your commadn line example.

    Am on a live distro (excellent Porteus) as user Ω and have symlinked the Desktop to user's Ø Desktop on my babe's laptop. The two users share a common gid but have different uid. User Ø dirs have a 770 umask.

    Created the /user/Trash... dir structure at the root of user Ø's partition, chmod'ed 700 but still cannot delete via Porteus' XFCE GUI. Is that because of the different users?

    Cheers!
    Kozaki

Leave a Reply

Your email address will not be published. Required fields are marked *