LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cannot empty Trash folder (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-empty-trash-folder-916794/)

passegua 12-02-2011 12:36 PM

Cannot empty Trash folder
 
Since I installed Ubuntu 11.10 on a 8GB pendrive, I need free disk space, but I Cannot empty Trash folder!

sudo rm -r /root/.local/share/Trash/files
rm: impossible remove "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache/7/9A/85658d01": input/output error
rm: impossible remove "/root/.local/share/Trash/files/danieluvi/.cache/dconf/user": is a directory

MTK358 12-02-2011 02:34 PM

Code:

rm -rf /root/.local/share/Trash/*

passegua 12-02-2011 02:51 PM

Quote:

Originally Posted by MTK358 (Post 4540464)
Code:

rm -rf /root/.local/share/Trash/*


Doesn't work.

The folder is still full.

Code:

~$ sudo rm -rf /root/.local/share/Trash/*
~$ sudo dir /root/.local/share/Trash/
files  info

Thanks.

MTK358 12-02-2011 02:59 PM

And it didn't show any error messages?

passegua 12-02-2011 03:07 PM

No! Any error message.
That's strange, isn't it?

MTK358 12-02-2011 03:09 PM

I have no idea what's wrong, then. Maybe someone else has an idea of what might be wrong?

passegua 12-02-2011 03:29 PM

An italian forum told me this:

Code:

sudo -s
 rm -r /root/.local/share/Trash/*

it works for all but still something left:

Code:

~#  rm -r /root/.local/share/Trash/*
rm: impossible remove "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache/7/9A/85658d01": Error input/output
rm: impossible rimove "/root/.local/share/Trash/files/danieluvi/.cache/dconf/user": is a directory


Hevithan 12-02-2011 03:32 PM

Here's an idea: Delete .trash


Is it possible to just do that, and make a new functioning .trash afterwards?

Sorry if I am making more problems then solving, But that seems like the simplest to me.

passegua 12-02-2011 03:35 PM

Quote:

Originally Posted by Hevithan (Post 4540505)
Here's an idea: Delete .trash


Is it possible to just do that, and make a new functioning .trash afterwards?

Sorry if I am making more problems then solving, But that seems like the simplest to me.

I am looking for answers, not for questions :-)

Brains 12-02-2011 05:05 PM

In Debian, I cannot do the same from command line as sudo. The thing is, this is in the /root home directory. From what I remember, you cannot operate as root in Ubuntu, at least not from command line, sudo just gives the user superuser rights. So how does files end up in the root's home directory?
Probably by using software as superuser.
For instance, I have KDE, and kdesudo installed, by issueing command: kdesudo dolphin, the kde file manager appears after entering my user password. When I delete a file from the file manager as my user with superuser rights, the file will be in /root/.local/share/Trash/files. To empty it, I start the file manager dolphin as superuser again and navigate to the /root/.local/share/Trash/files directory, right click on the file and delete it and it disappears along with the corresponding text file in /root/.local/share/Trash/info folder.
Because this is Debian, I can also just su to root and remove them from command line, but I don't think you can do that in Ubuntu. Use nautilus as superuser. gksudo nautilus

Hevithan 12-02-2011 05:19 PM

You can totally use root in ubuntu ... Easiest thing ever (just not recommended for most purposes):

Open a terminal an type: sudo passwd
You will get this in return:
Code:

enter sudo password for user
password:
Enter New Unix Password:
Re-Enter Unix Password:
Password Changed ...
#

After that, Log out then select OTHER... at the login screen
For username put in root. for the password, whatever you chose at Enter New Unix Password:

I'm not 100% but I would guess the trash gets stored under Root because it is a SYSTEM folder, and root is in charge of the system ... Giving it jurisdiction if you will. Of course this is just a guess ... but sounds logical to me :)

edit: not saying everyone should change the fact they can't be root, you can do what needs to be done with sudo just fine ... Just stating it is possible.

passegua 12-03-2011 03:11 AM

Quote:

Originally Posted by MTK358 (Post 4540464)
Code:

rm -rf /root/.local/share/Trash/*

I am still here trying to delete the whole Trash folder.

In an italian forum I found this "partial" solution, but there are still error messages and undeletable files or directory:

Code:

sudo find /root/.local/share/Trash/files -mindepth 1 -exec rm -ri {} \;
Code:

$ sudo find /root/.local/share/Trash/files -mindepth 1 -exec rm -ri {} \;rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi"? S
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.mozilla"? S
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox"? S
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default"? S
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache"? S
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache/7"? S
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache/7/9A"? S
rm: impossibile rimuovere "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache/7/9A/85658d01": Errore di input/output
rm: rimuovere directory "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache/7/9A"? S
rm: impossibile rimuovere "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache/7/9A": Directory non vuota
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.cache"? S
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.cache/dconf"? S
rm: rimuovere directory "/root/.local/share/Trash/files/danieluvi/.cache/dconf/user"? S
rm: impossibile rimuovere "/root/.local/share/Trash/files/danieluvi/.cache/dconf/user": È una directory
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.mozilla"? S
rm: entrare nella directory "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox"?

Please HELP deleting ALL Trash content. Thanks.

MTK358 12-03-2011 07:57 AM

Maybe you don't have permission to remove them? Try posting the "ls -l" output on the files that have error messages above.

Also, it would be helpful to know what the error messages actually say (I don't know that language, and I can't use a translator without knowing what it is).

passegua 12-03-2011 12:41 PM

Quote:

Originally Posted by MTK358 (Post 4540969)
Maybe you don't have permission to remove them? Try posting the "ls -l" output on the files that have error messages above.

Also, it would be helpful to know what the error messages actually say (I don't know that language, and I can't use a translator without knowing what it is).

Translation:

entrare=enter
impossibile=impossible
rimuovere=remove
directory=directory
accedere=access

Here the output of ls -l

non esistente=not existing

Code:

sudo ls -l /root/.local/share/Trash/files/danieluvi/.cache/dconf/user
ls: impossibile accedere a /root/.local/share/Trash/files/danieluvi/.cache/dconf/user/85658d01: Errore di input/output
totale 0
-????????? ? ? ? ?                ? 85658d01

sudo dir /root/.local/share/Trash/files/danieluvi/.cache/dconf/user
85658d01

Moreover:
Code:

:~$ sudo find /root/.local/share/Trash/files/danieluvi/.cache/dconf/user -mindepth 1 -exec rm -ri {} \;
rm: impossible remove "/root/.local/share/Trash/files/danieluvi/.cache/dconf/user/85658d01":input/output error


segmentation_fault 12-03-2011 02:39 PM

Could the "input/output error" indicate a corruption in filesystem or a bad disk?

passegua 12-03-2011 02:48 PM

Quote:

Originally Posted by segmentation_fault (Post 4541201)
Could the "input/output error" indicate a corruption in filesystem or a bad disk?

may be.

Any solution?

I've read something about fsck, fdisk, debugfs but I don't know how use those command, do you?

Thanks.

segmentation_fault 12-03-2011 03:13 PM

To run fsck (File System ChecK) on your root (/) partition, first of all you need to mount in read-only. In order to do that, I first enter runlevel 1. Type on a terminal
Code:

# telinit 1
as root, or using sudo. Then login as root, if necessary and mount your root partition read-only:
Code:

# mount / -o remount,ro
Next step, force a fsck on that (assuming your root partition is sda1):
Code:

# fsck -f -v /dev/sda1
When the check is done, mount it read-write and either reboot or enter your previous runlevel with telinit:
Code:

# mount / -o remount,rw
# shutdown -r now


passegua 12-03-2011 03:27 PM

Quote:

Originally Posted by segmentation_fault (Post 4541227)
To run fsck (File System ChecK) on your root (/) partition, first of all you need to mount in read-only. In order to do that, I first enter runlevel 1. Type on a terminal
Code:

# telinit 1
as root, or using sudo. Then login as root, if necessary and mount your root partition read-only:
Code:

# mount / -o remount,ro
Next step, force a fsck on that (assuming your root partition is sda1):
Code:

# fsck -f -v /dev/sda1
When the check is done, mount it read-write and either reboot or enter your previous runlevel with telinit:
Code:

# mount / -o remount,rw
# shutdown -r now


Thank you very much for your help, but I suppose being too newbie to understand all those "mount" "unomunt" stuff.

For instance, how could I know "my root partition is sda1" ?

If I call mount:

Code:

mount
/cow on / type overlayfs (rw,commit=0,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
/dev/sdb1 on /cdrom type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/loop0 on /rofs type squashfs (ro,noatime)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/passegua/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=passegua)


I do not understand where is root mounted.

I try this:

Code:

~$ df -h
File system            Dim. Usati Disp. Uso% Mounted on
/cow                  2,0G  1,6G  299M  85% /
udev                  494M  4,0K  494M  1% /dev
tmpfs                201M  812K  200M  1% /run
/dev/sdb1            7,9G  2,7G  5,3G  34% /cdrom
/dev/loop0            668M  668M    0 100% /rofs
tmpfs                501M  8,0K  501M  1% /tmp
none                  5,0M    0  5,0M  0% /run/lock
none                  501M  116K  501M  1% /run/shm

So I suppose my root partition is /cow isn't it?

Thanks.

passegua 12-03-2011 04:22 PM

I tried.

telinit 1

and then

mount / -o remount,ro

then

fsck -f -v /cow

I got error: fsck.ext2 in /cow not exist
or something like this since I was in terminal out of ubuntu could not copy the output.

I tried also

fsck -f -v /

and got: fsck.overlayfs not exist

yancek 12-03-2011 04:38 PM

Open a terminal and enter this: gksu nautilus or gksudo nautilus. Navigate to your Trash folder and open the files and info folders separately or whatever you want to delete. You can Select All or select individually to highlight files. When you have them highlighted, hold down the Shift and Delete keys and you will be prompted and asked if you want to delete whatever files are highlighted. I've done this on Ubuntu 10.10 and 11.10 and I think I found this solution on the Ubuntu forums after trying several of the standard methods suggested above which didn't work either??

passegua 12-03-2011 05:37 PM

Quote:

Originally Posted by yancek (Post 4541267)
Open a terminal and enter this: gksu nautilus or gksudo nautilus. Navigate to your Trash folder and open the files and info folders separately or whatever you want to delete. You can Select All or select individually to highlight files. When you have them highlighted, hold down the Shift and Delete keys and you will be prompted and asked if you want to delete whatever files are highlighted. I've done this on Ubuntu 10.10 and 11.10 and I think I found this solution on the Ubuntu forums after trying several of the standard methods suggested above which didn't work either??

Impossible.

This is the error message:

Error finding file stat "/root/.local/share/Trash/files/danieluvi/.mozilla/firefox/irndj1vf.default/Cache/7/9A/85658d01": input/output error

nigelc 12-04-2011 06:04 AM

Hello,
Maybe the file is in use. Go into single user mode, then try it. init 1 will goto into single user mode.

cheers

passegua 12-04-2011 08:46 AM

Quote:

Originally Posted by nigelc (Post 4541563)
Hello,
Maybe the file is in use. Go into single user mode, then try it. init 1 will goto into single user mode.

cheers

Indeed I thought the same as in windows some times you cannot delete a file in use.
But I restarted as single user and the input-output error is still there, impossible remove.

Well ubuntu is keeping well hidden its secrets :-)

segmentation_fault 12-04-2011 01:43 PM

Indeed your root partition is /cow, although I would expect /dev/something. Maybe
Code:

# fdisk -l
give some more light, but if it realy is an overlayfs I don't know if it can be checked. In fact, I don't even know what is overlayfs.

Brains 12-04-2011 06:00 PM

Another suggestion.
I just ran another test and put a photo called "Wolf.jpg" in the trash through my file manager dolphin. Based on the test I did from command line posted below, I had to specify the name of the file, using a wild card did not work.
Code:

jo@jo:~$ sudo rm /root/.local/share/Trash/files/*
[sudo] password for jo:
rm: cannot remove `/root/.local/share/Trash/files/*': No such file or directory
jo@jo:~$ sudo rm /root/.local/share/Trash/files/Wolf.jpg
jo@jo:~$

I have had similar issues in Windows, where I could not delete certain files, but rebooting into Linux or Mac OSX and deleting from there most often would do the trick. There was the odd time where I could not do it from any OS, probably because there was an error in Windows MFT where it still reported an existing file that actually did not exist anymore. If this is your case, even if the file does not exist, the space will not be marked as free space and cannot be written to.

VDP76 12-04-2011 07:39 PM

Quote:

Originally Posted by passegua (Post 4540387)
Since I installed Ubuntu 11.10 on a 8GB pendrive

Since your Ubuntu is on a pendrive, have you considered the idea of just mounting the disk into another OS to delete those files!?!?
it's not an "elegant solution", but it might be a workaround... ;)

good luck! :)

amilo 12-06-2011 08:01 AM

what is the answer of lsattr 'filename'


All times are GMT -5. The time now is 07:50 PM.