Fixing the Nautilus Garbage bin

I’ve recently bought a new 500GB hard drive and installed it on my home machine which is currently running Ubuntu 7.10, once installed, I’ve setup the new hard drive to be mounted under “/usr/local”, made a directory in there for my day-to-day regular user, and moved key large folders, such as my “incoming” folder, from my home directory to the new drive, placing symlinks in the home directory instead.

So far so good, I’ve been enjoying my new drive space without having to change my habits and place files in new locations, but this morning I encountered a weird problem: attempting to move a file in Nautilus, the Gnome file manager, from my “incoming” folder to the Garbage bin, yielded the following friendly but not very helpful error message:

Nautilus Error Message

Being quite certain I do not want to just delete the file but rather figure out if the problem could somehow be fixed, I hopped into Google and did some digging around.

The first relevant thing I could find was this discussion in the Ubuntu Users Mailing List, and while it includes posts from several users reporting similar problems, it doesn’t include any offer of solution other then simply deleting the file (apparently in previous versions Nautilus wouldn’t even offer to delete the file but yield a simple error message instead), I have no idea why someone decided to mark the problem as solved since in my view its definitely isn’t.

Digging some more I found this article discussing how the “Trash” folder works in Gnome, it mentions a rather ancient version of Gnome used on Sun Ray terminals, but the informations seems to still be relevant.

As it turns out, Nautilus always attempts to move the files to a Trash folder that resides on the same file-system as the original file, when the file resides in the user’s home directory, it is simply moved to the “.Trash” hidden directory within the home directory, however, when the file is on a different file-system, Nautilus attempts to move it to a directory called “.Trash-<username>” (where <username> is the name of the user running Nautilus), in that file-system’s root directory.

Since the root of the file-system on my new drive is “/var/local” and is owned by root, e.g. not writable by my normal user, nautilus wasn’t able to place files there or create the necessary directory.

The solution for the problem is rather simple, I used the following commands to create the required directory and assign it the proper permissions, following that moving files to trash worked seamlessly.

sudo mkdir /var/local/.Trash-ifireball
sudo chown ifireball:ifireball /var/local/.Trash-ifireball

A question begging to be asked here, why isn’t Nautilus providing a more useful error message? a simple “details” button displaying a more detailed error message could go a long way towards helping a knowledgeable user solve the problem, an even more user-friendly solution would be to ask for an administration password and simply create the needed directories automatically.

Update: I’ve opened bug #176755 requesting for the error message to be improved in Ubuntu (and hopefully upstream)

Update: As of Aug. 2008, this problem still occurs in the newest Gnome releases (2.22), the work-around, however, is different and is discussed here.

Advertisements

2 thoughts on “Fixing the Nautilus Garbage bin

    • Please note the updates at the bottom of the post, the solution is different for recent versions of Ubuntu (And I’ve posted and linked to a new blog-post detailing it)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s