LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sudo rm -rfv ~.Trash-1000 can't delete (https://www.linuxquestions.org/questions/linux-newbie-8/sudo-rm-rfv-%7E-trash-1000-cant-delete-4175465333/)

andrew.comly 06-09-2013 12:01 PM

sudo rm -rfv ~.Trash-1000 can't delete
 
I would like to empty my trash can. I am signed on as the only user of this Lubuntu 13.04 OS, but even though I use: "sudo rm -rfv ~/.Trash-1000", sudo shred -fuz, chmod -x filename and even sudo chown -R a 2067508202, the system never lets me delete. And when I navigate to this file and ls -la, the innermost jpg files are all in pink. Part of the log as below:

a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged/2067508202$ ls -la
總計 1276
drwx------ 1 a a 4096 12月 26 23:46 .
drwx------ 1 a a 4096 5月 19 22:57 ..
-rw------- 1 a a 97559 5月 21 2004 Sammi_2012 09 28.jpg
-rw------- 1 a a 82785 5月 21 2004 TeacherReviews-Vanessa0803.jpg
-rw------- 1 a a 71366 5月 21 2004 TeacherReviews-Vanessa0824.jpg

a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged/2067508202$ shred -fuz TeacherReviews-Vanessa0803.jpg
shred: TeacherReviews-Vanessa0803.jpg:無法移除: 沒有此一檔案或目錄
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged/2067508202$ shred -fuz 學生外師課程建異表_CA20120908.jpg
shred: 學生外師課程建異表_CA20120908.jpg:無法移除: 沒有此一檔案或目錄
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged/2067508202$ cd ..
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged$ sudo chown -R a 2067508202
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged$ sudo rm -Rf /media/a/AC/.Trash-1000/expunged/2067508202
rm: 無法移除 ‘/media/a/AC/.Trash-1000/expunged/2067508202’: 目錄不是空的
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged$

GlennsPref 06-09-2013 10:04 PM

Hi, This has happend to me, but the trash was on a usb stick.

Eventually, I used the filemanager to restore the files, and then changed the files permissions, etc

sent them to the trash again and was able to empty the trash and delete the trash folder.

Maybe it will work for you.

Glenn

lleb 06-10-2013 09:04 AM

what is the error you are getting?

rtmistler 06-10-2013 01:53 PM

I was going to recommend that you rename the files using command completion or something. Or do
Quote:

ls -l > t.sh
and then edit the t.sh to make it a bash script where you take the file names from the ls output and rename them to be normally named files like 1.txt, 2.txt, and so forth. However, I can't figure out what's up here, instead of having bad file names, you have bad data in the result of your ls command.

1.) Recommend you restart if you haven't done so.
2.) If those files were from a removable drive which is no longer mounted, place it back in; if possible and try to delete them that way.

thedaver 06-10-2013 02:21 PM

You can try to manually clean house by using the inode references to the files that have the problematic characters.

1) Go to your folder with a problem file.

2) 'ls -il' (( ell ess space dash eye ell ))

This lists the files with their inode reference, on my system the inode is the first column.
[ example: assume inode you want to remove is 7832263 ]

3) find . -inum 7832263 -exec rm -i {} \;

4) Rinse and repeat.

andrew.comly 06-25-2013 12:28 AM

Translation for Chinese error messages
 
Quote:

Originally Posted by lleb (Post 4968881)
what is the error you are getting?

Pardon me for not translating this earlier:
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged/2067508202$ ls -la
Total 1276
drwx------ 1 a a 4096 12 26 23:46 .
drwx------ 1 a a 4096 5 19 22:57 ..
-rw------- 1 a a 97559 5 21 2004 Sammi_2012 09 28.jpg
-rw------- 1 a a 82785 5 21 2004 TeacherReviews-Vanessa0803.jpg
-rw------- 1 a a 71366 5 21 2004 TeacherReviews-Vanessa0824.jpg
-rw------- 1 a a 0 6月 10 00:07 ForeignTeacherTraineeClassSuggestionSheet_CA20120908.jpg
-rw------- 1 a a 99572 5月 21 2004 ForeignTeacherTraineeClassSuggestionSheet_CA20120926.jpg
-rw------- 1 a a 78082 5月 22 2004 ForeignTeacherTraineeClassSuggestionSheet_Ca20121031.jpg
-rw------- 1 a a 78082 5月 22 2004 ForeignTeacherTraineeClassSuggestionSheet_Can20120921.jpg
-rw------- 1 a a 89501 5月 22 2004 ForeignTeacherTraineeClassSuggestionSheet_Ei20120924.jpg
-rw------- 1 a a 95546 5月 22 2004 ForeignTeacherTraineeClassSuggestionSheet_Ei20121022.jpg
-rw------- 1 a a 79424 5月 23 2004 ForeignTeacherTraineeClassSuggestionSheet_Ma20121128.jpg
-rw------- 1 a a 69347 5月 23 2004 ForeignTeacherTraineeClassSuggestionSheet_MA20121214.jpg
-rw------- 1 a a 106965 5月 23 2004 ForeignTeacherTraineeClassSuggestionSheet_Q20120904.jpg
-rw------- 1 a a 72037 5月 23 2004 ForeignTeacherTraineeClassSuggestionSheet_Qu20121022.jpg
-rw------- 1 a a 96888 5月 23 2004 ForeignTeacherTraineeClassSuggestionSheet_Qu20121030.jpg


a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged/2067508202$ shred -fuz TeacherReviews-Vanessa0803.jpg
shred: TeacherReviews-Vanessa0803.jpg:Cannot remove: No such file or directory exists.
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged/2067508202$ shred -fuz ForeignTeacherTraineeClassSuggestionSheet_CA20120908.jpg
shred: ForeignTeacherTraineeClassSuggestionSheet_CA20120908.jpg:Cannot remove: No such file or directory exists.
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged/2067508202$ cd ..
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged$ sudo chown -R a 2067508202
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged$ sudo rm -Rf /media/a/AC/.Trash-1000/expunged/2067508202
rm: Cannot remove: ‘/media/a/AC/.Trash-1000/expunged/2067508202’: Directory not empty
a@a-NC210-NC110:/media/a/AC/.Trash-1000/expunged$

andrew.comly 06-25-2013 12:44 AM

How to you use the file manager to restore?
 
Quote:

Originally Posted by GlennsPref (Post 4968615)
Hi, This has happend to me, but the trash was on a usb stick.

Eventually, I used the filemanager to restore the files, and then changed the files permissions, etc

sent them to the trash again and was able to empty the trash and delete the trash folder.

Maybe it will work for you.

Glenn

I am running gksudo nautilus via terminal. In both situations I right click, then for nautilus I select the "move to..." option, then thy to move it to the folder "a" of the removable hard disk. I encounter the error: "Error encountered when trying to move file to /media/a/AC/a directory." with a "No such file or directory exists" under "Display more .." option below.

GlennsPref 06-25-2013 06:31 PM

Midnightcommander, dolphin and konqueror have this, "restore trash to original folder" (or something like that).

open the waste bin as a folder, right click file, select restore(dolphin)

andrew.comly 06-26-2013 06:18 PM

Quote:

Originally Posted by GlennsPref (Post 4978646)
Midnightcommander, dolphin and konqueror have this, "restore trash to original folder" (or something like that).

open the waste bin as a folder, right click file, select restore(dolphin)

pcmanfm & nautilus don't have the restore option when right clicking. On a previous installation of Lubuntu I tried installing and using dolphin, but then the whole system crashed and I had to conduct a new installation. I searched for Midnightcommander in synaptic package manager, but the search for such a program turned up nothing. Actually due to the previous crash I don't think installing KDE fm managers is a good idea. Thanks anyway!

GlennsPref 06-27-2013 02:19 AM

lmgtfy
Code:

midnight commander ubuntu 12.10
Code:

Midnight Commander — Ubuntu Apps Directory
apps.ubuntu.com › All Apps › Accessories‎
GNU Midnight Commander is a text-mode full-screen file manager. ... 2012 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.
UbuntuUpdates - Package "mc" (quantal 12.10)
www.ubuntuupdates.org/package/core/quantal/universe/base/mc‎
Midnight Commander - a powerful file manager ... Release: quantal (12.10) ... Save this URL for the latest version of "mc": http://www.ubuntuupdates.org/mc ...
Install Midnight Commander (MC) 4.7.3 In Ubuntu ~ Web Upd8 ...
www.webupd8.org/2010/.../install-midnight-commander-mc-473-in.htm...‎
Jul 7, 2010 – Install Midnight Commander (MC) 4.7.3 In Ubuntu ~ Ubuntu / Linux blog. ... How To Get A Complete GNOME 3 Desktop In Ubuntu 12.10, ...
[ubuntu] midnight commander - Ubuntu Forums
ubuntuforums.org/showthread.php?t=1663139‎
Jan 9, 2011 – Thread: midnight commander ... http://ubuntuforums.org/showthread.php?t=2147295. Advanced reply ... Distro: Ubuntu 12.10 Quantal Quetzal ...

I think the package is called mc

Cheers

andrew.comly 08-02-2013 09:58 AM

"mc" results
 
cool program!

Unfortunately, midnight commander can only restore files that are on ext2 filesystem, I always like HDD that are compatible with windows, mac and linux in case of an emergency; thus this file is currently on NTFS.

Andrew

andrew.comly 09-21-2013 10:23 AM

Below is another attempt after I learned about deleting files via their inode numbers. Notice how some files don't even have inode numbers:
a@a-NC210-NC110:/media/a/Seagate Expansion Drive/20130921/AC/媒体/音乐/pouch1$ ls -lia
ls: cannot access 百度歌词搜索_独一无二.htm: Input/output error
ls: cannot access 百度歌词搜索_说清楚.htm: Input/output error
ls: cannot access 眉飞色舞.mp3: Input/output error
ls: cannot access 说清楚.mp3: Input/output error
total 5500
324777 drwx------ 1 a a 4096 9月 21 21:47 .
324145 drwx------ 1 a a 16384 9月 21 20:58 ..
74 -rw------- 1 a a 638855 9月 21 21:47 a236.txt
325882 -rw------- 1 a a 2959360 8月 29 02:22 炫耀美丽.mp3
325883 -rw------- 1 a a 33792 8月 8 14:22 独一无二.mp3
325884 -rw------- 1 a a 1334319 8月 21 18:07 百度歌词搜索_天衣无缝.htm
325885 -rw------- 1 a a 638855 9月 21 21:27 百度歌词搜索_炫耀美丽.htm
? -????????? ? ? ? ? ? 百度歌词搜索_独一无二.htm
? -????????? ? ? ? ? ? 百度歌词搜索_说清楚.htm
? -????????? ? ? ? ? ? 眉飞色舞.mp3
? -????????? ? ? ? ? ? 说清楚.mp3
a@a-NC210-NC110:/media/a/Seagate Expansion Drive/20130921/AC/媒体/音乐/pouch1$ sudo find . -inum 325885 -exec rm -i {} \;
[sudo] password for a:
rm: remove regular file ‘./百度歌词搜索_炫耀美丽.htm’? y
rm: cannot remove ‘./百度歌词搜索_炫耀美丽.htm’: No such file or directory
find: `./百度歌词搜索_独一无二.htm': Input/output error
find: `./百度歌词搜索_说清楚.htm': Input/output error
find: `./眉飞色舞.mp3': Input/output error
find: `./说清楚.mp3': Input/output error
a@a-NC210-NC110:/media/a/Seagate Expansion Drive/20130921/AC/媒体/音乐/pouch1$

[My external HDD is not ext2, it's NTFS, thus mc won't work]

I also try chmod, as below, but the system just hangs.
chmod +x BaiduLyrics_flauntingbeauty.htm (this is a translation of 325885 above)

John VV 09-21-2013 06:38 PM

Quote:

My external HDD is not ext2, it's NTFS
now you inform us as to this

chmod will NOT work
ntfs dose NOT support file permissions

depending on how you are mounting this
fstab or a udev rule and NTFS-3g are responsible for mounting a ntfs drive
and simulating !!! the file permissions

so how is this drive mounted

Habitual 09-21-2013 07:01 PM

Quote:

Originally Posted by John VV (Post 5032222)
now you inform us as to this

chmod will NOT work
ntfs dose NOT support file permissions

depending on how you are mounting this
fstab or a udev rule and NTFS-3g are responsible for mounting a ntfs drive
and simulating !!! the file permissions

I finally had to fix something with my ntfs perms also. I went with
Code:

/dev/sdbX /path/to/mountpoint ntfs-3g    rw,uid=1000,gid=100,dmask=022,fmask=133 0 0
in my fstab.
Now I have correct Linux-style file perms for my rysnc backups

Why not just delete Trash-1000 from the usb drive instead of emptying it?

andrew.comly 09-29-2013 12:04 PM

RE: how external ntfs HDD is mounted
 
Quote:

Originally Posted by John VV (Post 5032222)
depending on how you are mounting this
fstab or a udev rule and NTFS-3g are responsible for mounting a ntfs drive
and simulating !!! the file permissions

so how is this drive mounted

John VV,

In case you mean what directory it's mounted under, it's under /media/a/AC, where “AC” is the name of the HDD. It mounts automatically as soon as I plug it into the USB port.

In case you mean directories: I don't have anything under /etc/fstab but I do have a /etc/fstab.d directory, however this is empty, even after I hit “Ctrl + h”. I looked at the wikipedia entry, and it said that some other versions of linux(like solarus) this might be under /etc/vfstab, but my directory doesn't have vfstab either. About udev: I do have this directory, and it has the following files: “applications.d(directory), sysctl.conf, ufw.conf, after.rules, after6.rules, before.rules, before6.rules”. The applications.d directory only has one file named cups (Common UNIX Printing System) in it. Finally about NTFS-3g, I don't have any directory like this in /etc.

Concerning man pages for commands, all 3 commands, as the man pages were output for all(see below)
a@a-NC210-NC110:~$ man udev
a@a-NC210-NC110:~$ man fstab
a@a-NC210-NC110:~$ man NTFS-3g
This shows that these commands are already installed on my system.

Concerning your suggestion to just delete “.Trash-1000” rather than emptying it”: some of the unremovable files are in the “.Trash-1000 folder”, but others are just in regular folders that when I ran a new rsync it just couldn't delete the files/folders on the ntfs drive like it naturally can on the internal ext4 formatted HDD. Concerning the “.Trash-1000” file, I do try to delete it, but I just get the error message “.Trash-1000: Unable to trash file: Invalid argument” when executing from pcmanfm. From terminal I'll execute “sudo rm -rfv .Trash-1000” then I get:
removed directory: ‘.Trash-1000/files’
removed ‘.Trash-1000/info/.Trash-1000.trashinfo’
removed ‘.Trash-1000/info/a.trashinfo’
removed ‘.Trash-1000/info/Sammi_2012 09 28.2.jpg.trashinfo’
removed ‘.Trash-1000/info/Sammi_2012 09 28.jpg.trashinfo’
removed directory: ‘.Trash-1000/info’
The above feedback from terminal is totally bogus since I'll go back into the .Trash-1000/expunged/2067508202 directory and those files are still there.

I'm not totally sure what you mean by how is the external portable HDD mounted.

Andrew


All times are GMT -5. The time now is 10:55 AM.