4

Ubuntu 13.04 dual-booting next to Pre-installed Win 8.

I can only delete files to the trash can when I am in the home directory, even for files which belong to me (usually inside /var/www). Selecting the file in nautilus and hitting delete does nothing. Right clicking and selecting delete asks me if I want to delete permanently. Here's what I know:

  1. These are files owned by me. /var is owned by root, but www (and all files within) are owned by me.
  2. I have a Trash folder at /home/(name)/.local/share/Trash; it seems to work fine for files I want to delete from my home directory.
  3. This machine was a Win 8 Machine which gave me a lot of trouble getting Ubuntu to run alongside on; I am not sure if this is an issue. When I created the partitions, I made a home partition separate, so I am thinking this is probably my problem.

Here is my fstab.

This blog post looked like the exact problem I have, but I am not experienced enough with fstab to get this to work. I tried adding my UID to /:

UUID=bb3ada65-be09-4b18-b091-9b3c95534cfd / ext4 errors=remount-ro,uid=1000 0 1

But then fstab couldn't load when I rebooted, and I had some trouble getting my system to load back up - don't really want to experiment with this since it takes so much time just to try something out.

edit: after reading the man for fstab a bit, it looks like UID is an option for fat; / is ext3 so this isn't the problem, I am guessing.

edit2:

My permissions seem fine:

cd /var/www
touch test\ doc.txt
ls -la
...
-rw-rw-r--  1 tom  developers        0 Jun 12 16:55 test doc.txt
...
rm test\ doc.txt

Notice I don't need sudo for creating or deleting the file from the cli, nor do I need to be root to delete in nautilus - I just can't delete to my trash for some reason.

  • You have to have write permission in the containing folder. – belacqua Jun 12 '13 at 22:45
  • I can create files within www, and permissions for me and the group I am in (developers) are read and write: -rw-rw-r-- 1 tom developers 0 Jun 12 15:47 Test Doc Does /var, which is owned by root, need to be owned by me? /var/www is owned by me, and all files within - is this not enough? – d3vkit Jun 12 '13 at 22:49
  • No, that looks fine, so that's not it. – belacqua Jun 12 '13 at 22:55
  • 1
    The problem is that the /.Trash folder isn't owned by you. Because nautilus doesn't want to send files across different hard drives in order to trash something, it will try to put it into the trash folder on the current partition, which for '/', is '/.Trash'. But because it can't create / write to /.Trash, it won't trash things for you. – daboross Jun 13 '13 at 0:05
  • 1
    This isn't a problem on drives which don't have a seperate home partition because then nautilus isn't sending the files to a different partition by putting them in ~/.local/share/Trash – daboross Jun 13 '13 at 0:06
5

When nautilus trashes something, it doesn't want to have to move it across partitions. This is because it takes a lot longer to move between partitions, and then if you remove the partition then the trash has no place to restore to.

Anywhere that is on the same partitions as your home directory is sent to ~/.local/share/Trash. This works across the entire root partition on setups which only have one partition.

On any other partition nautilus will make a .Trash-1000 folder on the root of the partition, then send all trashed files into that. This works rather well on external drives that you have full read/write access to, though it won't work if you don't have write permission to the root of the drive.

Because your / partition isn't the same as your /home partition, and a .Trash-1000 doesn't exist with write permission at the root of your system, nautilus will fail to trash files. Thus the delete key won't work and a trash action won't be available in the menus.

You could try using a root nautilus and deleting one file so that the /.Trash-1000 folder is created correctly, then using sudo chmod -R 777 /.Trash-1000 to give yourself permission to access a trash on the / filesystem. I cannot confirm that this will work though you could give it a try.

  • 2
    another issue with deleting files in another partition is security related; if you move files to a trash in another partition (which is not owned by the user), other users can view the files. – Eliran Malka Mar 19 '15 at 15:57
  • 1
    Perhaps using mkdir might be a bit more straight forward: sudo mkdir /.Trash-1000 ; sudo chmod -R 777 /.Trash-1000 – TSJNachos117 Dec 11 '16 at 2:04
1

Perhaps you could try finding out what happens if you use Nemo instead of Natilus. Nemo is the default browser of the Cinnamon desktop. It has, among other features, the ability to "directly" delete files, bypassing the trash bin. Just right-click the file or folder you wish to remove, and select "Delete" (as opposed to "Move To Trash").

I think that most users get it by installing it as part of Cinnamon. However, you can easily install Nemo separately using:

sudo apt-get install nemo

Then, from your terminal, just type nemo to open nemo. Optionally, you can type

nemo '/directory/subdirectory/subdirectory2/'

to launch Nemo into whatever directory you wish.

If all this sounds too complicated for you, you might want to consider deleting from the Terminal. Just use "rm (file)" for files, or "rmdir (directory)" for directories. Or, there might be some way to add this option to Natilus, but I currently don't know how to accomplish this.

  • 1
    Nautilus can also directly delete files without using the trash, and in fact this was the problem I was having. In nautilus, one can directly delete without right click using shift+delete. But the problem here was one of the partitions. – d3vkit Jun 13 '13 at 16:37
  • I tried using nemo and found the same error as when using nautilus. – Antonios Hadjigeorgalis Oct 25 '16 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.