Cannot move files between SMB shared folders with Dolphin

Every time I try to move a file between two shared folders on the same server using Dolphin I get the same error:

“Could not rename file smb://192.168.137.100/data/e…top_1600x1000_hd-wallpaper-1035271.png.”

It doesn’t matter if I use the mouse to drag it, context menu or copy and paste keyboard shortcuts, am I missing something?

Dolphin
Version 23.04.1

Operating System: Manjaro Linux
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9
Kernel Version: 5.15.114-2-MANJARO (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-3740QM CPU @ 2.70GHz
Memory: 31.0 GiB of RAM

If I understand your issue correct

  • shared folder a → smb://server/a
  • shared folder b → smb://server/b

Dragging a file from ab results in the error message - am I correct?

The message could not rename implies moving - as in copy the file to b then remove it from a?

Plasma will usually pop a message on drop - asking whether you want to copy or move the object.

The message may be thrown if the shared folders are registered as favorites in dolphin but only folder a is mounted and when you drop a file from a onto b - dolphin throws and error because b is not mounted.

To avoid that you may benefit from using systemd mount with and automount unit to ensure the share is mounted on access.

1 Like

I think a few things has to be established here.

Do you understand a word of what above wrote? I love the guy, but I think I read between the lines that @mluna is not an extremely experienced user here. If I’m wrong, I apologize.

What you probably have to do is mount the network server (samba share) to a folder on your computer and THEN you can make folders “favorites” in dolphin and move between them.

I agree with above that you should make a systemd service to mount it.
He even wrote a guide about it, maybe he is shy, so I’ll post it for him. xD

Edit
Do the “SMB network share” part, including the credentials file and edit to fit your setup (workgroup can normally be excluded). I recomend creating it in your /home:
nano /home/YOURUSERNAME/.smb.cred and use that path instead of /etc/smb.cred (file becomes hidden in your home directory) in the .mount file. ie, if your username on your computer is mluna the path would be /home/mluna/.smb.cred

To change the credentials:
chmod 600 ~/.smb.cred

The systemd files are to go in:
/etc/systemd/system/YOUR_MOUNT_PATH.mount
Ie if you want to mount it at /media/yourshare, create a directory in /media called yourshare and the filename of the file will be media-yourshare.mount and .automount.

Create the directory:
sudo mkdir /media/yourshare

Edit/create the mount and automount files:
sudo nano /etc/systemd/system/media-yourshare.mount
ctrl+x then “y” and press “enter” to save.
Do the same to the .automount file.

Then activate the automount with:
sudo systemctl enable --now media-yourshare.automount

This means the network drive will not mount at boot but rather when ANYTHING is trying to access it, so if you f ex open dolphin directly after boot, the drive will be mounted and you can see it appear in the dolphin interface (make sure to remove your previous favorites connected to the “old” network drive before doing anything)

Edit 2
Add the uid=USERNAME,gid=USERNAME (with your username) to the options part of the .mount file (or it will belong to root), I have NO IDEA what they are talking about when stating “setting the ownership”, it’s a samba share, how would you chown that??
Blindly following that guide will not solve your problem, only solve one and implement another.
But if you do above modifications, it will work.
Feel a bit like an a** to just trow that tutorial at you now, hence the infinite number of edits. xD

Let’s say I have the file ‘foo.txt’ that I want to move between to folders that are located in the samba server I mounted through Dolphin file manager, no terminal involved.

When I try to move foo.txt from:

smb://192.168.137.100/folderA
to
smb://192.168.137.100/folderB

Dolphin throws an error with the following message:
“Could not rename file smb://192.168.137.100/folderA/foo.txt.”

No problem with any other method that does not involve Dolphin file manager. No problem doing that with another OS.

I actually found out that this was reported back in 2012. Can’t believe it’s still not fixed.
bugs(dot)kde(dot)org/show_bug.cgi?id=302448

Replace (dot) with dots as I can’t post links.

@bedna thank you for your reply and your help. I apologize for my extremely poor attempt of explaining or detailing stuff in the most useful manner. Please check this reply and let me know if you’re still confused as to what’s happening here.

What other method is that?

As we both wrote, you have to mount the network drive or you will get that error.

Any other method meaning I can move files without issues using MS Windows for example.

Network drive was already mounted by Dolphin file manager. I can access all the files, and even move them between samba and a local path. The problem is between folders in the same server.

See the command line:
[user@arch linux]$ cat /run/user/1000/kio-fuse-mgqNKS/smb/192.168.137.100/folderA/foo.txt
this is a test file

[user@arch linux]$ mv /run/user/1000/kio-fuse-mgqNKS/smb/192.168.137.100/folderA/foo.txt /run/user/1000/kio-fuse-mgqNKS/smb/192.168.137.100/folderB

mv: cannot move ‘foo.txt’ to ‘/run/user/1000/kio-fuse-mgqNKS/smb/192.168.137.100/folderB/foo.txt’: Input/output error

You see it as a simple move between two network folders but technically it is more complicated than that.

I think your issue comes from a limitation in the kio modules.

Unfortunately I see no simple waving a hand and it works … that is how it is with Linux.

You can try to solve it in three ways - neither is straight forward - that is the way.

The first is to use gvfs which is a framework similar to what Plasma tries to do but more reliable and accessible as it is not hidden deep down in Plasma depths.

The second is to use systemd units to do the lifting - when the units are created and activated - it will work in the background ensuring a seamless experience. This one is linked by @bedna in a previous comment - it actually consist of two parts - the first with the technical details, the why, what, where etc. while the second is some example units

  1. [root tip] [How To] Use systemd to mount ANY device
  2. [root tip] [How To] systemd mount unit samples

The third option is a package called smb4k - the reason I mention it last is because I have not had much success with it - but alas - you should know it exist.

sudo pacman -Syu smb4k
1 Like

Thank you so much for your help. Definitely will be taking a look at it when I have the chance. It’s so shocking to me that this bug has been floating around for so long in the FOSS community no nobody has done anything to fix that considering that samba is much more used than NFS.

I keep looking deeper and it’s been reported many times for a long time now.
Also see this at the bottom:
bugs(dot)kde(dot)org/show_bug.cgi?id=98886

Thanks again @linux-aarhus

That bug is related to cpying/moving from one server to ANOTHER, witch is not what you are trying to do, at all.

Maybe other distros would mount it for you directly more like windows, I actually don’t know, but in manjaro you have to mount it for this to work.
Simple operations (like editing a file, creating a directory, copying between OTHER locations and the server etc) can be done by just "mounting it in dolphin"each time, but if you want do do what you are trying and also have a stable connection to the server, that is always the same, not changing the temporary path, then mounting is what you have to do (or use smb4k, witch I didn’t even know about until it was mentioned in this thread).

Edit.
Arguably reading the bug report and others around it there is something underlying that might be related to this, but if I were to guess, nobody really cares because everybody mounts what they want to use anyway. And its also arguably a KDE thing, not a Manjaro thing. xD
As someone in one of the reports wrote in 2013

We aren’t fans of “show stoppers”, but unless anyone with Samba knowledge volunteers to debug and fix this, I’m afraid that nothing will change.

That is probably still the case, I guess nobody cares. Sorry

1 Like

I tried to duplicate this issue on my Manjaro KDE setup, but was unable to. Copying files between Folders worked correctly.

There may be some additional information we need.

Are those shared folders on the same server?

If that was aimed at me… Yes

I currently have 2 HDDs on the server, and have no issues copying between folders on the same HDD or to folders on a different HDD.

My Samba Server is running on a Linux Server.

I can reproduce this issue when using Dolphin with two different samba shared folders, any files can’t be moved from samba folder A to samba folder B in the same Dolphin.

If I open two separate Dolphins, I move any files from Dolphin with samba folder A to other Dolphin with samba folder B. That works!

Can you open two separate Dolphins, try to move any files from Dolphin A to Dolphin B?
Other solution is also possible that you open two separate tabs in the same Dolphin, try to move any files from tab A to tab B in the same Dolphin.


tl:dr

In my experience:

:x: Move file from Samba folder A to Samba folder B in the same Dolphin.
:white_check_mark: Move file from Dolphin A with Samba folder A to Dolphin B with Samba folder B.
:white_check_mark: Move file from Tab A with Samba folder A to Tab B with Samba folder B in the same Dolphin.

3 Likes

Is your test using pre-mounted shares or bookmarked network locations?

That is bookmarked network locations. I did not test pre-mounted shares.

1 Like

My Samba Shares are explicitly mounted.

That’s interesting. How did you mount your shared folder?, because mine was a matter of typing smb://ip_address on Dolphin address bar.
Also, it’s not like I have two shares mounted, it’s just one mounted folder with many folders inside, the problem comes when I try moving files between those folders inside that unique share.

My samba server is running Truenas scale which Debian based.

You have the answer in this thread.
Either in my post:

Or in linux-aarhus response:

Edit
If you find all of those explanations confusing you can use the absolute easiest way of mounting it by follwing this:

I mount my smb shares in the following manner.

sudo mount -t cifs -o noauto,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=10,credentials=/root/mediacred,uid=<username>,gid=<username> --source //192.168.1.4/books --target /run/media/<username>/Books

The above is included in a bash script that is called by Sytemd on start up, but I can close also explicitly close the shares when not connected to my file server.

The additional commands in the bash script are…

sudo mkdir /run/media/<username>
sudo chown <username>:<username> /run/media/<username>

and


sudo mkdir /run/media/<username>/Books
sudo chown <username>:<username> /run/media<username>/Books

This is to ensure that the directories exists under /run (it’s a tempfs directory), so there is no guarantee the required directories are there at run time.

I store the credentials for the Samba user in /root

I use the bash script because I can optionally call it manually, if at anytime I have explicityly closed those with the following commands… also in another bash script.

sudo umount /run/media/<username>/Books

All of that can be done with one command if using systemd, one time.

Depending on how you want to mount them, you use .automount or .mount
The --now tag is optional, it also starts/stops the unit.

If you for some reason want the mount to be in a directory that might not exist when mounting, add x-mount.mkdir to the mount options in the .mount file.

If you want your user to own the directories, add uid=USERNAME and gid=USERNAME to the mount options.

sudo systemctl enable --now path-to-mountpoint.automount

Then If you want to unmount (will still mount again after reboot if accessing it):
sudo systemctl stop path-to-mountpoint.automount

To mount again:
sudo systemctl start path-to-mountpoint.automount

To disable the mount completely:
sudo systemctl disable --now path-to-mountpoint.automount