Naked Science Forum

Non Life Sciences => Geek Speak => Topic started by: Karen W. on 23/09/2009 08:33:10

Title: Can someone help me find my trash on my Ubuntu toolbar ?
Post by: Karen W. on 23/09/2009 08:33:10
The icon is there but when I click on it it says this!

(https://www.thenakedscientists.com/forum/proxy.php?request=http%3A%2F%2Fi17.photobucket.com%2Falbums%2Fb73%2Fkarenw44%2FScreenshot-1.png&hash=7e9eff8e5b1cbf4cfdfa8ccf3287bf02)


Title: Can someone help me find my trash on my Ubuntu toolbar ?
Post by: RD on 23/09/2009 16:28:59
I've never used Ubuntu, but I did find this forum ...

http://ubuntuforums.org/showthread.php?t=1255477&highlight=trash+file


Title: Can someone help me find my trash on my Ubuntu toolbar ?
Post by: LeeE on 23/09/2009 19:57:47
When you say that the icon is there, are you referring to the little orange coloured one up in the top right corner on the black panel bar?

If so then it seems that something has got out of kilter here.  At one point the trash folder just used to be called .Trash/, and was located in your home folder i.e. ~/.Trash/ (where ~/ is equivalent to /home/karen/), but it now seems to have been moved to .local/share/Trash/ i.e. ~/.local/share/Trash/, so I'm wondering if this might be something to do with it.

So, the first thing to do is to see which of these trash folders actually exists.  You'll need to tell Nautilus (the file manager) to display hidden files to see anything that starts with a '.', and it might be easier to use a list or detailed list view instead of an icon view while you check this out.

One thing that's going to make it a bit tricky to resolve this is the 'trash:///' handler.  Although we can see that Nautilus seems to be expecting to find a file named '2009-06-18-193749.ogv' in trash:/// we don't know exactly where it's expecting to find it because the actual folder path prefix is hidden by that 'trash:///' prefix; it comes back to whether it's ~/.Trash/ or ~/.local/share/Trash/

I suspect that Nautilus is actually expecting to find this file in ~/.local/share/Trash/, rather than in ~/.Trash/ because the scheme for managing trash seems to have changed too.  I believe that the old scheme, where trash was simply stored in ~/.Trash/, didn't use any metadata to manage the trash; when you looked at your trash the file browser simply looked in the ~/.Trash/ folder and obtained the file info directly from the files in there.  This meant that only files that actually existed in the ~/.Trash/ folder would be shown or considered for trash management.

The new scheme though, seems to use metadata to manage trash.  If you have a ~/.local/share/Trash/ folder, and I strongly suspect that you do, then you'll find that it'll contain two sub-folders, named 'files/' and 'info/'.  The reason I suspect that you have a ~/.local/share/Trash/ folder is that Nautilus has got that '2009-05-18-193749.ogv' filename from somewhere, even though the actual file doesn't seem to exist, and this points to the filename being held in metadata somewhere.

Now I use KDE instead of Gnome, so this might be different, but I just deleted (moved to trash) a test file and found that on my (Debian) system I ended up with the file itself being moved to ~/.local/share/Trash/files/ whilst at the same time, a new file was created in ~/.local/share/Trash/info/ having the same name as the real file but with a '.trashinfo' suffix added to it: this is a plaintext metadata file that contains the original path to the file i.e. where you deleted it from, and the date and time that it was deleted.

I'm guessing then, that when you click on the trash icon, Nautilus is looking in the ~/.local/share/Trash/info/ folder and finding a file called 2009-06-18-193749.ogv.trashinfo but when it then looks in ~/.local/share/Trash/files/ for the file named 2009-6-18-193749.ogv it can't find it.

Now you may have stumbled across that 2009-06-18-193749.ogv file whilst checking out where your trash folder is located, but if not, try searching for it.  I think you can do this either from Nautilus or from the menu, but you need to make sure that you're starting your file search from the top level of your home folder i.e. ~/ or /home/karen/, and that you search all sub-folders recursively.

If you manage to find this file you can either move it into the ~/.local/share/Trash/files/ folder, which should stop that particular error (but other files might turn out to be missing as well), or if you wanted to recover it, move it to where you want to keep it and then delete the file called 2009-06-18-193749.ogv.trashinfo from the ~/.local/share/Trash/info folder instead, so Nautilus no longer looks for it.

If you can't find the 2009-06-18-193749.ogv file anywhere, then it looks like it has been permanently deleted and can't be recovered, and your only option is to remove the 2009-06-18-193749.ogv.trashinfo file to stop Nautilus from complaining.

The most worrying thing is how the trash metadata has managed to become inconsistant and get out of step with the actual trash files.  If you've been using the built-in trash handling interfaces to manage your trash then the metadata should have been consistant.  One possibility however, is that you've had a system crash at some point and when the filesystem was checked on restart, fsck found a problem with the 2009-06-18-193749.ogv file in the ~/.local/share/Trash/files/ folder and moved it to /lost+found.  Therefore, if the file hasn't turned up anywhere else, you could try having a look there for it.  Note though, that I think you'll need root privileges to access /lost+found and if the file has been moved there it will have been renamed, probably just to a sequence of numbers.  This isn't ideal, of course, but when a file is moved to /lost+found it is precisely because the system can't tell what it should be called and where it should be.  If you do find any files in /lost+found you can either try opening them with the appropriate application to see if they work, or have a look at them with a hex editor to see if there's anything in the file itself that gives a clue as to what it is.
Title: Can someone help me find my trash on my Ubuntu toolbar ?
Post by: Karen W. on 25/09/2009 06:47:58
I've never used Ubuntu, but I did find this forum ...

http://ubuntuforums.org/showthread.php?t=1255477&highlight=trash+file




Thanks for the link.... I have scanned the questions and if I cannot fix it I will post there.. Thanks RD.
Title: Can someone help me find my trash on my Ubuntu toolbar ?
Post by: Karen W. on 25/09/2009 07:17:09
When you say that the icon is there, are you referring to the little orange coloured one up in the top right corner on the black panel bar?

Yes I am



If so then it seems that something has got out of kilter here.  At one point the trash folder just used to be called .Trash/, and was located in your home folder i.e. ~/.Trash/ (where ~/ is equivalent to /home/karen/), but it now seems to have been moved to .local/share/Trash/ i.e. ~/.local/share/Trash/, so I'm wondering if this might be something to do with it.

OK

So, the first thing to do is to see which of these trash folders actually exists.  You'll need to tell Nautilus (the file manager) to display hidden files to see anything that starts with a '.', and it might be easier to use a list or detailed list view instead of an icon view while you check this out.

So Nautilus is the file manager eh? How do I access it? When I find it what do I type in? The hyphen, period, hyphen, comma, like this?  '.',  or what?

One thing that's going to make it a bit tricky to resolve this is the 'trash:///' handler.  Although we can see that Nautilus seems to be expecting to find a file named '2009-06-18-193749.ogv' in trash:/// we don't know exactly where it's expecting to find it because the actual folder path prefix is hidden by that 'trash:///' prefix; it comes back to whether it's ~/.Trash/ or ~/.local/share/Trash/

OK..

I suspect that Nautilus is actually expecting to find this file in ~/.local/share/Trash/, rather than in ~/.Trash/ because the scheme for managing trash seems to have changed too.  I believe that the old scheme, where trash was simply stored in ~/.Trash/, didn't use any metadata to manage the trash; when you looked at your trash the file browser simply looked in the ~/.Trash/ folder and obtained the file info directly from the files in there.  This meant that only files that actually existed in the ~/.Trash/ folder would be shown or considered for trash management.

Yes I believe that that was how it worked for months before this new problem!

The new scheme though, seems to use metadata to manage trash.  If you have a ~/.local/share/Trash/ folder, and I strongly suspect that you do, then you'll find that it'll contain two sub-folders, named 'files/' and 'info/'.  The reason I suspect that you have a ~/.local/share/Trash/ folder is that Nautilus has got that '2009-05-18-193749.ogv' filename from somewhere, even though the actual file doesn't seem to exist, and this points to the filename being held in metadata somewhere.

How do I find "metadata"?

Now I use KDE instead of Gnome, so this might be different, but I just deleted (moved to trash) a test file and found that on my (Debian) system I ended up with the file itself being moved to ~/.local/share/Trash/files/ whilst at the same time, a new file was created in ~/.local/share/Trash/info/ having the same name as the real file but with a '.trashinfo' suffix added to it: this is a plaintext metadata file that contains the original path to the file i.e. where you deleted it from, and the date and time that it was deleted.

A bit confusing but ok...

I'm guessing then, that when you click on the trash icon, Nautilus is looking in the ~/.local/share/Trash/info/ folder and finding a file called 2009-06-18-193749.ogv.trashinfo but when it then looks in ~/.local/share/Trash/files/ for the file named 2009-6-18-193749.ogv it can't find it.

That sounds about right!

Now you may have stumbled across that 2009-06-18-193749.ogv file whilst checking out where your trash folder is located, but if not, try searching for it.  I think you can do this either from Nautilus or from the menu, but you need to make sure that you're starting your file search from the top level of your home folder i.e. ~/ or /home/karen/, and that you search all sub-folders recursively.

Could you explain how to do this search?

If you manage to find this file you can either move it into the ~/.local/share/Trash/files/ folder, which should stop that particular error (but other files might turn out to be missing as well), or if you wanted to recover it, move it to where you want to keep it and then delete the file called 2009-06-18-193749.ogv.trashinfo from the ~/.local/share/Trash/info folder instead, so Nautilus no longer looks for it.
Ok I will try it when I find out how to do the search...

If you can't find the 2009-06-18-193749.ogv file anywhere, then it looks like it has been permanently deleted and can't be recovered, and your only option is to remove the 2009-06-18-193749.ogv.trashinfo file to stop Nautilus from complaining.

Ok That makes sense...

The most worrying thing is how the trash metadata has managed to become inconsistant and get out of step with the actual trash files.  If you've been using the built-in trash handling interfaces to manage your trash then the metadata should have been consistant.  One possibility however, is that you've had a system crash at some point and when the filesystem was checked on restart, fsck found a problem with the 2009-06-18-193749.ogv file in the ~/.local/share/Trash/files/ folder and moved it to /lost+found.  Therefore, if the file hasn't turned up anywhere else, you could try having a look there for it.  Note though, that I think you'll need root privileges to access /lost+found and if the file has been moved there it will have been renamed, probably just to a sequence of numbers.  This isn't ideal, of course, but when a file is moved to /lost+found it is precisely because the system can't tell what it should be called and where it should be.  If you do find any files in /lost+found you can either try opening them with the appropriate application to see if they work, or have a look at them with a hex editor to see if there's anything in the file itself that gives a clue as to what it is.

I did have a bit of a crash during a battery failure and had a hard time rebooting and when it came back up is when I noticed a day or so later when I went to use the trash that it was gone!!
Now for some reason I have seen the lost and found thing you are showing in my search and it seemed that it was full of files.. but don't quote me... I don't know how I found them but I did.... I do not know how to get back there now.. but will try!
Thank you so much Lee!

Oh Yeah.. I also lost my Tomboy notes at the same time!
Title: Can someone help me find my trash on my Ubuntu toolbar ?
Post by: LeeE on 25/09/2009 18:23:19
Quote
So Nautilus is the file manager eh? How do I access it? When I find it what do I type in? The hyphen, period, hyphen, comma, like this?  '.',  or what?

Nautilus is very similar and sort of equivalent to Windows Explorer.  It runs in the background during Gnome sessions and is the program that puts the icons on your desktop.  When you click on the trash icon, a Nautilus window opens up and that's what you're actually looking at in that screen-grab.  Similarly, if you click on your home folder icon, or browse/explore files from the menu, it'll be a Nautilus window that starts up.

The only versions of Gnome I've still got running are pretty old, so some of the menu items etc. might have slightly different names, but let's see how we get on...

To see 'hidden' files and folders click on the 'View' menu, and select/tick the Show Hidden Files item.

To change to a list view, click on the button towards the top right of the window that says icon view (on my system it's called 'View as icons') and change it to list view.  It will also help for now if you show the navigation side pane too: click on the View menu and select the Side Pane item.  This will open a side pane to the window.  If the menu bar at the top of the side pane doesn't say Tree, click on it and select Tree from the drop-down menu.

At this point, you should now be seeing a lot more files and folders in the main window than you did before, and included in them should be the .Trash/ and/or the .local/ folders.

If you've got both folders, have a look inside .Trash/ to see if it contains anything: if it does then you should either delete it again, or move it to where you want to keep it, because it seems likely that your trash is now being handled via the .local/ folder scheme.

Next, have a look in .local/share/Trash/info/ to see if the 2009-06-18-193749.ogv.trashinfo file exists in it (I suspect that it will).  If it does, then have a look in .local/share/Trash/files/ to see if the 2009-06-18-193749.ogv exists there (I suspect that it won't).  If this is so then that's why you're getting that error.

Quote
How do I find "metadata"?

The metadata is held in that 2009-06-18-193749.ogv.trashinfo file stored in .local/share/Trash/info/.  If you really want to have a look at it you should be able to open it with the text editor.  You don't really need to do this though; the point about metadata is that it's stuff that the system uses to manage things.

Quote
Could you explain how to do this search?

From Nautilus, you should click on the Go menu and then select the Search item.  From the main panel (my panel layout is completely different to yours) you should have a menu under one of the icons that includes a Places item, and then from that you should be able to see a Search for Files item.  You might also spot a Find Files item under the Utilities menu.  Because Linux panels tend to be highly user-configurable, these may be anywhere - I don't have a Ubuntu installation I can check.

Quote
I did have a bit of a crash during a battery failure and had a hard time rebooting and when it came back up is when I noticed a day or so later when I went to use the trash that it was gone!!
Now for some reason I have seen the lost and found thing you are showing in my search and it seemed that it was full of files.. but don't quote me... I don't know how I found them but I did.... I do not know how to get back there now.. but will try!

Aha!  This sounds as though we might be getting there.

If you look back at the Tree side pane in your Nautilus window, there should be an item called File System.  If you click on this you should see the list of top-level system files and folders in your system, and one of them should be called lost+found.  Depending on how the security and your user has been set up, you may not be able to open this folder, but I'm guessing that you might be prompted for the root (administrator) password before it'll allow you to look in there.  If there are any files or folders in /lost+found/ then these will be files and folders that got 'lost' in the crash, and which were subsequently 'found' when the system did a disk check when it restarted.

What I would do at this point is to create a new folder in your home folder, called recoverytemp, or something similar, so you don't forget what it was for at a later date, and copy (don't move them) all the files and folders from /lost+found/ in to it so that you can check them out without risk of damaging anything.

Once you've copied the files and folders over, you may have to change the file permissions on them to be able to read them as a 'normal' non-root (non-administrator) user.

Once you've got a copy of the files and folders that were lost in the crash in one of your home folders you can start trying to figure out what they all are.  Some of them will be binary i.e. pictures, movies, or even programs, and others will be plain text and you'll be able to look at them with the text editor.  If you look at them with Nautilus in icon mode, I think you'll actually get previews of the files, which will help.

It's quite probable that if you lost your Tomboy notes at the same time then it was due to the same crash and the files may be included amongst those in /lost+found/.  Figuring out how to restore them might be tricky though, if Tomboy uses a complicated database, with lots of different files.  Just as Nautilus can get upset when its metadata gets out of step with the real files it's trying to manage, you might run into similar problems with restoring your Tomboy data.  If you can actually identify and extract the tomboy data your best bet might be to just copy and paste it into new Tomboy entries (I don't know or use Tomboy, so I've no idea what facilities it has for importing data or for checking its database integrity and fixing database errors, so I'm afraid you're on your own there).