This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Dolphin can't move deleted files to .trash-1000 on ntfs

Tags: None
(comma "," separated)
fmeier
Registered Member
Posts
36
Karma
0
hi,

i've a multi boot system with kubuntu and windows 7 and the most files are stored on a ntfs partition that is mounted via fstab:

UUID=2480A38132885004 /media/ntfs ntfs defaults,uid=1000,gid=1000 0 0

my uid and gid is 1000.

for me dolphin is the best file manager. the problem is, that dolphin is the only file manager that can't move deleted files on ntfs partitions to the folder .trash-1000. dolphin copies the files to the trash-folder on my home partition. with thunar and others the files are moved to .trash-1000. so it works - but not with dolphin. is this a known problem? i've read in a thread from 2014 in an other forum that this is a problem with the 'kio'.

fmeier
fmeier
Registered Member
Posts
36
Karma
0
no idea? does no one use dolphin with ntfs partitions?
User avatar
toad
Global Moderator
Posts
1258
Karma
7
OS
I'm sorry but I don't quite understand the problem here. Could you post the different paths of where thunar and dolphin chuck their rubbish? Perhaps that makes things clearer.


Debian testing
fmeier
Registered Member
Posts
36
Karma
0
The problem is that dolphin don't use the folder .Trash-1000 and Thunar does. There is no different path for the both programs. I have to create the folder '.Trash-1000' (when 1000 is the uid) and then this folder is used as trash on the ntfs partition. when i doesn't exist the 'trash folder' in home is used (that means, after deleting a file/folder on ntfs the file/folder is moved to home). the problem is: this works with thunar but not with dolphin. both should use the same folder (ntfs-mountpoint/.Trash-1000).

but i don't like thunar and there is no other file manager than dolphin (for me).
User avatar
toad
Global Moderator
Posts
1258
Karma
7
OS
I still don't understand. If there is no different path to trash for both programmes, then by definition they use the same one.

The difference between the two file managers is probably the fact that Dolphin uses KIO slaves, whereas the GTK based Thunar uses GVFS. Unfortunately I am not too familiar with the use KIO slaves but perhaps google may be helpful.


Debian testing
fmeier
Registered Member
Posts
36
Karma
0
I still don't understand. If there is no different path to trash for both programmes, then by definition they use the same one.


That is the problem. Dolphin should use the folder .Trash-1000, but it doesn't. The folder exists but Dolphin is moving deleted files and folders to the trash in the home dir and not in .trash-1000.
wolfi323
Registered Member
Posts
1129
Karma
11
OS
fmeier wrote:That is the problem. Dolphin should use the folder .Trash-1000, but it doesn't. The folder exists but Dolphin is moving deleted files and folders to the trash in the home dir and not in .trash-1000.

That works fine with removable media.

But apparently for a fixed mount (via fstab) it (KIO) doesn't detect that it's a different partition and moves it to the standard trash in the home directory.
fmeier
Registered Member
Posts
36
Karma
0
How can i fix that?
wolfi323
Registered Member
Posts
1129
Karma
11
OS
fmeier wrote:How can i fix that?

Download the source code, look and understand what it does, and change it accordingly. Then compile and install it... ;)

Or don't mount the drive via fstab, but via the device manager. Though I don't know if that would change it in this case.

Personally I prefer to avoid the trash completely anyway.
If I delete something, I do so to free the space.
User avatar
toad
Global Moderator
Posts
1258
Karma
7
OS
One possibility would be to run a cron job to move everything in your home trash to the desired location on your other hard drive every other hour or so.


Debian testing
fmeier
Registered Member
Posts
36
Karma
0
Or don't mount the drive via fstab, but via the device manager. Though I don't know if that would change it in this case.


I#ve tested this with an usb stick, but doesn't work.
wolfi323
Registered Member
Posts
1129
Karma
11
OS
fmeier wrote:
Or don't mount the drive via fstab, but via the device manager. Though I don't know if that would change it in this case.


I#ve tested this with an usb stick, but doesn't work.

How are you mounting it?

It works fine here, when I "delete" a file on an USB stick, it gets moved to the folder ~/.Trash-1000 on this USB stick.
fmeier
Registered Member
Posts
36
Karma
0
wolfi323 wrote:How are you mounting it?


I don't know exactly. i've disabled kde-automount and there is no entry in fstab for the usb stick. but after plugin in the stick i can mount it by clicking on the entry i can see in dolphin / devices. so i think dolphin mounts the stick, but i'm not sure.
martytheo
Registered Member
Posts
2
Karma
0
In hope it can still help.

There is a bug report about this in https://bugs.kde.org/show_bug.cgi?id=76380 . Comments 59 and 62 explain what is going on. It seems there is a work around for Debian and Ubuntu in comment 62. I'm using Manjaro and it didn't work directly.

KDE expects that the permission of the directory .Trash-1000 is 0700 (read, write and executable for the owner only), but by default permission is 0777 (that is everything to everybody) . Thus we can change the permission when mounting (or automounting) the device. This is done by modifying the file /etc/fstab. Apparently we can only change permissions when mounting the device, so chown or the gui tools seem to not work. I'm new to this so I might be wrong in what follow.

Advice: read about file permission, fstab options and ntfs-3g options.

The step I used to find a work around (might not be working if something else than ntfs-3g is used to mount ntfs devices):
- open KSystemLog, where logs of KDE are listed.
- plug the removable device, or mount it.
- search for the new logs emitted by ntfs-3g about the mount options (or search/scroll for it if the device is use on boot I guess).
- You should find two logs: one for "CmdLine options" and one for "Mount options".
- add to the file /etc/fstab a line for your device (or modify an already existing line). You need sudo right to modify this file. More on this after.
- add umask=0077 (which hopefully should disable permission for non-user).
- I believe using ntfs-3g insteed of ntfs is needed for the file system file (else were some options might not be reconized).

After mounting the device, you should be able to verify that the permissions are correct by doing
Code: Select all
 stat /path/mountFolder
or
Code: Select all
 ls -l /path
where /path is the absolute path to the mount point. If it is 0700, the suppression should move the file to the right trash.


Details for editing the fstab file:
- if the device is a removable device, you should add in the option. nofail,x-systemd.device-timeout=1ms They allow to boot without the device.
- The line I add to the file fstab is
Code: Select all
 UUID=(find the UUID of you device)                     (Absolute path to your mount point)  ntfs-3g nofail,x-systemd.device-timeout=1ms,rw,nodev,nosuid,windows_names,uid=1000,gid=1000,uhelper=udisks2,umask=0077


I'm absolutely not sure that every of these options are needed (I don't even understand some of them), but they were in the log. I will probably investigate to find which options are needed. Especially if the device is used on boot and a line listing its options already exists, probably this need to be adapted.


There is a variation of this, according to the source code, that I didn't not test. One can use a directory .Trash (or .Trashes ?) with full permission for the owner and with sticky bit (an alternating permission so that a user can only delete folders and files he created, not the one created by other users). This permission can probably be achieved with the file fstab, but I don't know how. It might be more adapted for non removable devices.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]