View Full Version : [ubuntu] Cannot delete trash (at all)

May 6th, 2009, 03:10 PM
On my desktop (running ubuntu 9.04) I cannot empty trash. I hear you think, yet another one, read the forum and do

sudo rm -rf ~/.local/share/Trash/files/*
Well, that doesn't work. I don't get any permission errors when I try to delete as well.
The weird thing is, there are several file is trash, I can even open them from there, but when I go to ~/.local/share/Trash/files nothing is there. When I hit empty trash nothing happens. When I select a file and choose delete permanently from the context menu I get:

Error while deleting.
There was an error deleting [some file I try to delete]

And when I click on show more details it says:

Failed to delete the item from the trash
I'm really stuck here, hope someone can help

May 6th, 2009, 03:12 PM

I think we all have this problem on occasion.

Just delete the files folder and see what happens.

Good luck. :-)

May 6th, 2009, 03:15 PM
does nothing I'm afraid... The files remain in the trash...

May 6th, 2009, 03:25 PM
is the file from ur portal hard disk? or ur pendrive?

May 6th, 2009, 03:25 PM
Hmmm.... :-k

How about trying the same procedure in nautilus?

So, Alt+F2, then

gksu nautilus
Then, navigate to your home directory, and of course press Ctrl+h, and navigate to /.local/share/Trash

and delete /files there.

Again, good luck. :-)

I'll be curious as to whether or not it will work.

May 6th, 2009, 03:36 PM
It's a local hard drive, not a pen/stick

When I browse the folder with gksu nautilus I get the same result. The folder files is still gone since I just deleted it.

When I click on the trash icon I get the following error:

The folder contents could not be displayed.

Sorry, could not display all the contents of "trash": Operation not supported

May 6th, 2009, 03:48 PM
Well, first, if there's anything in the /Trash folder, delete it. If that doesn't work, then it's most likely a problem with root's trash. So, in the terminal

gksudo nautilus

then in the address bar:


Also, if you're on Ibex, I remember a workaround for not being able to remove trash, if neither of these work.

Good luck. :-)

May 6th, 2009, 03:50 PM
I think I found what's went wrong. All of the files in the trash folder came from another partition (than the one my home is on). In the root of this partition was a .Trash folder with folders files and info. I deleted this .Trash folder and now the files are finaly gone.
Although this particular case is solved I think this i s a serious problem in ubuntu. What do you think, is this a bug?

May 6th, 2009, 03:56 PM
Well, I mean, there are definitely reasons why it may seem like a bug.

I think, however, that it does what it was meant to do. It deletes the files from a certain directory.

Things go wrong here when the trash is located somewhere other than what is specified in the code.

I suppose a good workaround for you is to rewrite the code, and make it delete the trash from /.local/share/Trash, as well as /root/.local/share/Trash, and the path where you found your trash in the separate partition. This way, it will all be covered whenever you hit "empty trash."

May 6th, 2009, 04:01 PM
I'm not sure I agree with 'it does what it's supposed to do', because when I see files in the trash I expect them to be deleted when I hit empty trash. By the way, if it can display the files as being trash, why can't they be deleted. In my opinion it should not be necessary to edit code in an os t make it work as you'd expect.
Anyway, it works...

May 6th, 2009, 04:05 PM
I had this type of problem once before. YES! I agree completely, if it is trash then it should trashable.
Perhaps It ought to at least tell you why it cant delete the trash files. In a way that people can understand.

May 6th, 2009, 04:18 PM
Well, I mean, trash is sent to a certain path. When you empty trash, the trash program deletes all files in the folder it's been directed to by the program.

If there are no files in that folder, the trash is just as confused as you are.

You are right in the sense that, no, it makes absolutely no sense that emptying the trash doesn't empty the trash. It's like a piece of gum being stuck to your trash can, and no matter how hard you try to empty it, it just stays in there.

The only workaround is to reach in there are pull it out, and nobody wants to do that.

So, yes, I believe it can be improved upon, greatly. But my opinion still stands that it is not a bug, necessarily.

May 7th, 2009, 06:16 PM
Thank you, HandleWithCare, for discovering what was wrong and reporting how you fixed it. I had exactly the same problem with a folder that appeared in the trash after a re-install of Hardy 8.0.4. In my case the culprit folder was /.Trash-1000/, which was apparently owned by me, not root. (I rm'd it as root, anyway, since I was there at the time.)

**** Silbar

May 7th, 2009, 07:26 PM
well, lets mark it as solved then. Thanks everybody for your input!

eehm, how do I mark it as solved, can't find the option...

January 25th, 2011, 03:45 PM
I have this same problem but I could not understand how to solve it.
Could you clarify please?

December 26th, 2012, 04:42 PM
Just wanted to thank the poster here, and confirm the fix!

I, too, had a phantom file in the .Trash of my home partition which was somehow a trace of the trash left in a flash drive, and deleting the file from the flash drive also removed it from my home trash.

The only (small, and possibly obvious) thing I would add, is that I had to first hit 'ctrl+h' in my empty flash drive from nautilus to reveal the trash folder and its lurking contents.

Thanks again!