Can't empty trash completely

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Can't empty trash completely

Post by gumby »

I had dozens of files in the trash can and when I did an empty trash command, most of them disappeared except for 5 files, most of them big, i.e., over 1 GB.

Now when I try to empty trash again nothing happens. The files are still there.

I right clicked on the files and selected "Delete Permanently" but got error message: "Error while deleting. Failed to delete the item from the trash."

These files are not connected to any running program that I am aware of. Can anyone suggest a way to delete them? Thanks.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
DrHu

Re: Can't empty trash completely

Post by DrHu »

gumby wrote:I right clicked on the files and selected "Delete Permanently" but got error message: "Error while deleting. Failed to delete the item from the trash."
Nautilus>Edit>Preferences>Behavior TAB Trash
  • [ ] Ask before emptying Trash or deleting files
    --if you leave this turned on you always get asked if you are sure you want to delete those file(s)
    [x]Include a delete command that bypasses Trash
The delete selection is supposed to bypass Trash, and simply delete the file, the second msg you see is what you say, delete permanently
--although that is misleading as it is not a wipe or shred of that file (a proper permanent deletion) , it simply dissociates the file (link) from the system, so that the system is not aware that it exists..
--in that way it is similar to windows.

https://bugzilla.redhat.com/show_bug.cgi?id=456035
http://ubuntuforums.org/showthread.php?t=785512
https://bugs.launchpad.net/ubuntu/+sour ... bug/366379
https://bugs.launchpad.net/ubuntu/+sour ... o_package=
  • Trash does not empty search..
Might be a nautilus bug or you might have some files moved as root into that trash directory or you are moving to trash across partitions; eg. an external drive..

In terminal, check Trash contents
  • ls -l /home/userID/.local/share/Trash
--where userID is your logged in user

Example removable for one of the directories in Trash (files, expunged, info)
  • sudo rm -r /home/userID/.local/share/Trash/files
http://www.ubuntugeek.com/empty-ubuntu- ... -line.html
--a shorter command for a similar result

Permanently delete files (shred and other methods)
http://ubuntuforums.org/showthread.php?t=868953
--use this location /home/userID/.local/share/Trash
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Re: Can't empty trash completely

Post by gumby »

Dr.Hu,

i Just tried checking "Include a delete command that bypasses trash." Trash still won't empty. When I open trash I see the 5 big files (several GB each) When I try to "delete permanently" one of them, I get the error message:

Error while deleting:
There was an error getting information about [name of file]
Show more details:
No such file or directory

When I try deleting permanently the other 4, I get this message:

Error while deleting:
There was an error deleting [name of file]
Show more details:
Failed to delete the item from the trash.

I still haven't tried your other suggestions. Will do so soon. Thanks.
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Re: Can't empty trash completely

Post by gumby »

by the way, I wondered if maybe a different file manager could delete the files, so I downloaded a few like Gnome Commander and Beesoft Commander. But I can't get either of them to even display the trash can. They don't seem to operate like the Windows file managers that show everything on the desktop, i.e., xplorer2
DrHu

Re: Can't empty trash completely

Post by DrHu »

gumby wrote:by the way, I wondered if maybe a different file manager could delete the files, so I downloaded a few like Gnome Commander and Beesoft Commander. But I can't get either of them to even display the trash can.

...But I can't get either of them to even display the trash can.
  • My first reply..
    Example removable for one of the directories in Trash (files, expunged, info)
    sudo rm -r /home/userID/.local/share/Trash/files
The Trash folder is under /home/userID/.local/share/
--and should be able to be seen under Gnome-commander if you open .local
  • In Gnome-commander check the Settings>Options>Filters, see if you are hiding (Filetypes to Hide, Also Hide) hidden files, in which case the .local file (directory) won't show in the display..
You will probably have to end up doing it with root privilege, open a terminal in Gnome-commander when you are at the correct directory (folder)
  • /home/userID/.local/share/Trash
--and delete,
sudo rm -r /home/userID/.local/share/Trash/
sudo rm -r ~/.local/share/Trash
--shortcut for /home for the logged in user ( ~/ )

ls /home/userID/.local/share/Trash/files
ls: cannot access /home/userID/.local/share/Trash/files: No such file or directory

If you get this msg when you check the subdir (subdirectory) of Trash (files, info, expunged),
--it means the Trash (files) is emptied
hernando

Re: Can't empty trash completely

Post by hernando »

I had that same problem. The problem was the permission, or user privileges.
I finally manage to totally delete the files opening the .Trash folder as root (right click --> open as root ... I love this option). There you have a few folders "Files", "expunged" and something else... I just Shift+Del to permanently delete the files, and voilà !

Or you could log out, and log in as root ...

Hope this can help.
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Re: Can't empty trash completely

Post by gumby »

DrHu wrote:
gumby wrote:by the way, I wondered if maybe a different file manager could delete the files, so I downloaded a few like Gnome Commander and Beesoft Commander. But I can't get either of them to even display the trash can.

...But I can't get either of them to even display the trash can.
  • My first reply..
    Example removable for one of the directories in Trash (files, expunged, info)
    sudo rm -r /home/userID/.local/share/Trash/files
The Trash folder is under /home/userID/.local/share/
--and should be able to be seen under Gnome-commander if you open .local
  • In Gnome-commander check the Settings>Options>Filters, see if you are hiding (Filetypes to Hide, Also Hide) hidden files, in which case the .local file (directory) won't show in the display..


Thanks DrHu, I now can see the trash folder in Gnome Commander.
DrHu wrote: You will probably have to end up doing it with root privilege, open a terminal in Gnome-commander when you are at the correct directory (folder)
  • /home/userID/.local/share/Trash
--and delete,
sudo rm -r /home/userID/.local/share/Trash/
sudo rm -r ~/.local/share/Trash
--shortcut for /home for the logged in user ( ~/ )


Gnome Commander did not show any files in Trash or in Expunged.

THen I did as you instruct:

gumby@Saturn ~/.local/share/Trash $ sudo rm -r /home/gumby/.local/share/Trash/
[sudo] password for gumby:
gumby@Saturn ~/.local/share/Trash $ sudo rm -r ~/.local/share/Trash
sudo: cannot get working directory
rm: cannot remove `/home/gumby/.local/share/Trash': No such file or directory
gumby@Saturn ~/.local/share/Trash $

and now my Trash folder has disappeared in Gnome Commander although it is still visible in Nautilus. Nautilus trash still shows the undeleted files I am trying to get rid of.
DrHu wrote: ls /home/userID/.local/share/Trash/files
ls: cannot access /home/userID/.local/share/Trash/files: No such file or directory

If you get this msg when you check the subdir (subdirectory) of Trash (files, info, expunged),
--it means the Trash (files) is emptied
Okay, maybe the files are not there, but they are still showing in my trash on Nautilus.
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Re: Can't empty trash completely

Post by gumby »

hernando wrote:I had that same problem. The problem was the permission, or user privileges.
I finally manage to totally delete the files opening the .Trash folder as root (right click --> open as root ... I love this option). There you have a few folders "Files", "expunged" and something else... I just Shift+Del to permanently delete the files, and voilà !

Or you could log out, and log in as root ...

Hope this can help.
Thanks for the suggestion, Hernando, but there is no "open as root" option in my right click menu. I remember a few months ago I installed something to try to get this option, but it didn't work.
pluraldave

Re: Can't empty trash completely

Post by pluraldave »

Try just right clicking in your home folder. If you do it in the Trash you won't get the option.

If that fails open a terminal and use

Code: Select all

gksu nautilus &
igorzwx

Re: Can't empty trash completely

Post by igorzwx »

I had sometimes similar problems in Ubuntu 6.10

Case 1: Symbolic links
This is easy to solve:
1. Create an empty folder.
2. Move it to Trash in a usual way (Right Click -> Trash)
3. Move links to that folder
4. Delete that folder in a usual way

Case 2: Files owned by root

gksu nautilus

This kind of nautilus is red like tomato in Mint.
You can change permissions of those files (Right Click -> Properties -> Permissions), and then remove them in a usual way.

If somebody likes Midnight Commander, he can use it too for many purposes

sudo apt-get install mc

sudo mc
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Re: Can't empty trash completely

Post by gumby »

pluraldave wrote:Try just right clicking in your home folder. If you do it in the Trash you won't get the option.

If that fails open a terminal and use

Code: Select all

gksu nautilus &
Thanks Dave. I did as you said and did get the option to open as root. I also tried gksu nautilus &. Unfortunately it did not solve my problem. When I try to open trash as root i get "The folder contents could not be displayed. Sorry, could not display all the contents of 'trash.' Operation not supported."
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Re: Can't empty trash completely

Post by gumby »

igorzwx wrote:I had sometimes similar problems in Ubuntu 6.10

Case 1: Symbolic links
This is easy to solve:
1. Create an empty folder.
2. Move it to Trash in a usual way (Right Click -> Trash)
3. Move links to that folder
4. Delete that folder in a usual way

Case 2: Files owned by root

gksu nautilus

This kind of nautilus is red like tomato in Mint.
You can change permissions of those files (Right Click -> Properties -> Permissions), and then remove them in a usual way.

If somebody likes Midnight Commander, he can use it too for many purposes

sudo apt-get install mc

sudo mc
Hi Igorzwx.

I tried your empty folder suggestion and it didn't work. When I try to move the problem files into the folder I get the familiar "are you sure you want to permanently delete the file from the trash?" Yes. "Error while deleting." The odd thing is I'm not deleting the file, I'm trying to move it into an empty folder in the trash.

Just tried to change permissions but could not do it. It seems that the "Owner", Gumby, has read and write permission, but the "Group", Gumby, and "Others" have only read permission. Whether that matters or not I have no idea.
igorzwx

Re: Can't empty trash completely

Post by igorzwx »

"Whether that matters or not I have no idea."

it does not matter. You permissions are most important

It might be a bug in Ubuntu/Mint

It is an innovation

Trash is now "trash:///"

Type on Terninal

nautilus trash:///

nautilus ~/

In Ubutu 6.10, Trash was "~/.Trash"

EDIT: Trash is not Trash anymore. It now a kind of "pulseaudio" :roll:
Last edited by igorzwx on Tue Sep 22, 2009 4:15 pm, edited 1 time in total.
DrHu

Re: Can't empty trash completely

Post by DrHu »

gumby wrote:The odd thing is I'm not deleting the file, I'm trying to move it into an empty folder in the trash.
Watch for file names with spaces, Linux can't move (mv) or cp(copy) them, and might not be even able to see the files
--you need to escape the file name character that is unusable by the OS or quote it as in 'mv _ MrData.txt'
--notice the space character after the underscore _ M, as well as letter case being significant (capitalized or lower case characters)

Move means copy and delete original
--otherwise how would a move be different from a copy operation
One trick using mv is to mv a file in its original position, a method of renaming a file
Last edited by DrHu on Tue Sep 22, 2009 4:00 pm, edited 3 times in total.
igorzwx

Re: Can't empty trash completely

Post by igorzwx »

This should work:

sudo apt-get install mc

Then type on terminal:

EDIT: This is universal command for any boxes:

mc ~/.local/share/Trash/files

*********************************************

mc /home/<your user name>/.local/share/Trash/files

EXAMPLE:

mc /home/igor/.local/share/Trash/files

Navigate to that file in Trash

Click on "Delete"

***************
EDIT: Fantastic! You can open your Trash with Nautilus as ordinary file in this way:

nautilus ~/.local/share/Trash/files
igorzwx

Re: Can't empty trash completely

Post by igorzwx »

Hi DrHu !

I believe MC will delete for sure.
It was always helpful in such cases.
Let us see.
Very interesting indeed.
igorzwx

Re: Can't empty trash completely

Post by igorzwx »

Corrected version:

sudo apt-get install mc

Then type on terminal:

mc ~/.local/share/Trash/files

This will open MC window inside the Terminal.

Navigate to that file in Trash.
Mark that file, which you want to delete.
Simply click on it, and it will be marked.

Click on the button "Delete" on the bottom of the Terminal window.
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Re: Can't empty trash completely

Post by gumby »

Thanks Igor, but I think I've decided to reinstall a new iso of Mint, as I have too many other problems, including bizarre spontaneous shutdowns and restarts. The reinstall should certainly wipe the trash can I would think!
igorzwx

Re: Can't empty trash completely

Post by igorzwx »

QUOTE: "including bizarre spontaneous shutdowns and restarts."

It was, perhaps, restarts of Xorg, not of the system.
You have to login once more. Right?
I had this too.
It is the drivers problem.
You should fix your drivers in some way, perhaps.
A new installation makes sense, of course.
gumby
Level 3
Level 3
Posts: 161
Joined: Sun Feb 15, 2009 12:57 pm

Re: Can't empty trash completely

Post by gumby »

Igor,

MC didn't work. I can't even find the Trash file. It's not there. I looked under local/share. No trash.

But in Nautilus, it's still there. Right now I'm preparing to do a reinstall and having big problems because I'm trying to move a lot of files onto a different partition so I can reformat the first data partition as NTFS, but I don't have room because all the big multi-GB files I deleted are taking up too much space in the TRASH which I can't empty. Until the trash is emptied, the space is still regarded as occupied on the data partition.

I moved more big files to the trash to make room for this move and can't delete them from the trash, also can't delete them permanently.

I'm also worried that the system is behaving so bizarrely that it won't backup my data to DVD accurately. But I have more stuff than I can backup to dvd, which is why I wish I could delete these damn files from the trash.
Locked

Return to “Beginner Questions”