How to sync "symbolic links" in linux?
- Posts: 4
- Joined: 9 Sep 2020
Hi there!
I've just installed FFS and it seems really great. However, I'm trying to sync two linux machines and I cannot find, for my life, a way to sync symbolic links (which I want to be identical in both machines). I always get the error message "Operation not supported between different devices."
I've ticked "Direct" in "Include symbolic links" in the Synchronizing Settings.
Can someone, please, advice? Many thanks!
I've just installed FFS and it seems really great. However, I'm trying to sync two linux machines and I cannot find, for my life, a way to sync symbolic links (which I want to be identical in both machines). I always get the error message "Operation not supported between different devices."
I've ticked "Direct" in "Include symbolic links" in the Synchronizing Settings.
Can someone, please, advice? Many thanks!
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
What is the full error message?
- Posts: 4
- Joined: 9 Sep 2020
Hi Zenju,
The full message is:
Cannot copy symbolic link "sftp://server/folder/link" to "/folder/link".
Operation not supported between different devices.
Any ideas?
The full message is:
Cannot copy symbolic link "sftp://server/folder/link" to "/folder/link".
Operation not supported between different devices.
Any ideas?
- Posts: 4
- Joined: 9 Sep 2020
More details, in case it helps: I'm using FreeFileSync 11.1 on Linux Mint 20 Cinnamon...
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
FreeFileSync should support this. => ToDo
- Posts: 4
- Joined: 9 Sep 2020
Thank you , Zenju!
Just for reference, in case some one else is in the same situation, I'm syncing the symbolic links in the meanwhile using rsync:
rsync -avzu -e ssh "remotehost:/path/remotesymlink" "/path/localsynmlink"
(see rsync man page for details...)
Just for reference, in case some one else is in the same situation, I'm syncing the symbolic links in the meanwhile using rsync:
rsync -avzu -e ssh "remotehost:/path/remotesymlink" "/path/localsynmlink"
(see rsync man page for details...)
- Posts: 2
- Joined: 13 Jan 2021
Hello,
Any update about this issue? I'm trying to copy symbolic links between 2 devices and the error message is :
Info : Creating symbolic link "/mnt/whatever"
Error : Cannot copy symbolink link
"sftp://mnt/whatever to /mnt/whatever".
Operation not supported between different devices.
I'm using FreeFileSync 11.5 on Debian 10 with "Direct" box ticked
Thank you for your wonderfull software !
Any update about this issue? I'm trying to copy symbolic links between 2 devices and the error message is :
Info : Creating symbolic link "/mnt/whatever"
Error : Cannot copy symbolink link
"sftp://mnt/whatever to /mnt/whatever".
Operation not supported between different devices.
I'm using FreeFileSync 11.5 on Debian 10 with "Direct" box ticked
Thank you for your wonderfull software !
- Posts: 65
- Joined: 7 Nov 2020
I second this request to be able to sync symbolic links from (in my case) Linux to Windows. A Linux symbolic link should result at Windows in the file the link is pointing to.
Thanks a lot!
Thanks a lot!
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
This should already work. See "Symbolic Link Handling": https://freefilesync.org/manual.php?topic=comparison-settingsI second this request to be able to sync symbolic links from (in my case) Linux to Windows. A Linux symbolic link should result at Windows in the file the link is pointing to. mdrmdr, 15 Jan 2021, 11:17
- Posts: 65
- Joined: 7 Nov 2020
Unfortunately not. I get "Operation not supported between different devices." I included symbolic links as "direct". I use FFS 11.5 on Windows and access Linux via ftp.
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
So this is also SFTP => Windows?Unfortunately not. I get "Operation not supported between different devices." I included symbolic links as "direct". mdrmdr, 15 Jan 2021, 12:25
- Posts: 65
- Joined: 7 Nov 2020
Not SFTP, standard FTP.
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
You need to set symlink handling to "follow".
- Posts: 65
- Joined: 7 Nov 2020
No success. Then I get many errors like
CURLE_FTP_COULDNT_RETR_FILE: RETR response: 550
550 '/opt/automation/config_links/000-default-ssl.conf' is not a directory [curl_easy_perform]
- Posts: 2
- Joined: 13 Jan 2021
Syncing symbolic links between 2 linux boxes would be very nice :)
- Posts: 65
- Joined: 7 Nov 2020
FileZilla also shows the 550 error:
But then it does not stop and just copies the linked file....
Command: CWD 000-default-le-ssl.conf
Answer: 550 000-default-le-ssl.conf: Not a directory
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
Indeed. The FTP protocol is very limited compared to SFTP regarding symlinks but FreeFileSync might be able to do something about this => ToDoFileZilla also shows the 550 error:But then it does not stop and just copies the linked file.... mdrmdr, 15 Jan 2021, 12:51Command: CWD 000-default-le-ssl.conf
Answer: 550 000-default-le-ssl.conf: Not a directory
- Posts: 65
- Joined: 7 Nov 2020
:-)
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
Implemented! FreeFileSync now handles symbolic links pointing to files via FTP (before it only supported links pointing to directories)The FTP protocol is very limited compared to SFTP regarding symlinks but FreeFileSync might be able to do something about this => ToDo Zenju, 15 Jan 2021, 16:06
https://www.mediafire.com/file/o9m2m2y0c61al7w/FreeFileSync_11.6_%255BBeta%255D_Windows_Setup%25284%2529.exe
- Posts: 65
- Joined: 7 Nov 2020
Installed 11.6 Beta and still the same error "Operation not supported between different devices". German error message attached.
- Attachments
-
- FFS.jpg (38.68 KiB) Viewed 7077 times
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
You still need to set symlink handling to "follow".
- Posts: 65
- Joined: 7 Nov 2020
If I set it to "follow", I get this error for each linked file:
- Attachments
-
- FFS2.jpg (40.9 KiB) Viewed 7073 times
- Posts: 65
- Joined: 7 Nov 2020
In the affected directory on my Raspberry, I have links to files and directories. I'd like to only sync the linked files, not the directories. Excluding the directories still gives the above error.
Actually I would expect the following behaviour:
• "direct": sync linked files and ignore linked directories
• "follow": sync the whole tree of a linked directory (possibly with a "depth" parameter?) and sync linked files
Therefore I'd prefer "direct" with the above behaviour or "follow" with "depth=0"
Actually I would expect the following behaviour:
• "direct": sync linked files and ignore linked directories
• "follow": sync the whole tree of a linked directory (possibly with a "depth" parameter?) and sync linked files
Therefore I'd prefer "direct" with the above behaviour or "follow" with "depth=0"
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
It seems "fullchain.pem" is incorrectly considered a directory. Here's a debug version of FreeFileSync, which error details do you get?If I set it to "follow", I get this error for each linked file: mdrmdr, 16 Jan 2021, 13:06
https://www.mediafire.com/file/t7mj94453u3zbs5/FreeFileSync_11.6_%255BBeta%255D_Windows_Setup%25285%2529.exe
- Posts: 65
- Joined: 7 Nov 2020
Same "is not a directory" error during "compare" as before for any linked file with "follow". No further details. Where should I see more details?
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
Did you run the same test case? I've added code if the item name is "fullchain.pem" and FreeFileSync will show a different error message. Also check you're really running the correct beta and not some other version.
- Posts: 65
- Joined: 7 Nov 2020
Now, the only link to be synced is:
cert -> /etc/letsencrypt/live/dyn.xxx.de/ (link)
Within "/etc/letsencrypt/live/dyn.xxx.de/":
fullchain.pem -> ../../archive/dyn.xxx.de/fullchain450.pem (file)
This gives:
If (for debugging only):
cert -> fullchain.pem (file)
it works and FFS syncs the the path "cert -> fullchain.pem"
So it seems that FFS only is able to follow 1 level?
if (for debugging only):
fullchain.pem -> /etc/letsencrypt/live/dyn.xxx.de/fullchain.pem (file)
I get:
cert -> /etc/letsencrypt/live/dyn.xxx.de/ (link)
Within "/etc/letsencrypt/live/dyn.xxx.de/":
fullchain.pem -> ../../archive/dyn.xxx.de/fullchain450.pem (file)
This gives:
If (for debugging only):
cert -> fullchain.pem (file)
it works and FFS syncs the the path "cert -> fullchain.pem"
So it seems that FFS only is able to follow 1 level?
if (for debugging only):
fullchain.pem -> /etc/letsencrypt/live/dyn.xxx.de/fullchain.pem (file)
I get:
- Posts: 65
- Joined: 7 Nov 2020
Upate: Now the attachments of the above post are correct...
--
(There seems to be an attachment inlining problem at your board. The second picture after "I get" should be
FFS4 not FFS3 again...)
--
(There seems to be an attachment inlining problem at your board. The second picture after "I get" should be
FFS4 not FFS3 again...)
- Posts: 65
- Joined: 7 Nov 2020
But again: My standard case is to follow links down just by one level to exactly one file. If a link points to a directory, the danger under Linux is, that a huge tree is affected. Therefore I'd exclude links to directories and only let FFS sync links which directly points to a file. For the above debugging example, I had to move some files out of "/etc/letsencrypt/live/dyn.xxx.de" so that FFS only finds "fullchain.pem".
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
This is either:Now, the only link to be synced is:
cert -> /etc/letsencrypt/live/dyn.xxx.de/ (link)
Within "/etc/letsencrypt/live/dyn.xxx.de/":
fullchain.pem -> ../../archive/dyn.xxx.de/fullchain450.pem (file)
This gives: [SIZE: 550] mdrmdr, 16 Jan 2021, 14:49
1. an issue with the FTP server: it cannot find the file at /opt/automation/config_links/cert/fullchain.pem although it should, or...
2. /opt/automation/config_links/cert/fullchain.pem is a broken symlink
This is FFS's new file-symlink support => okayIf (for debugging only):
cert -> fullchain.pem (file)
it works and FFS syncs the the path "cert -> fullchain.pem"
So it seems that FFS only is able to follow 1 level? mdrmdr, 16 Jan 2021, 14:49
This is also FFS's new file-symlink support => okayif (for debugging only):
fullchain.pem -> /etc/letsencrypt/live/dyn.xxx.de/fullchain.pem (file)
I get: [SIZE: 213] mdrmdr, 16 Jan 2021, 14:49
(the error message only comes up because it is the debug version)
- Posts: 65
- Joined: 7 Nov 2020
Don't think so, since e.g. FileZilla has no problems following the 2 links and copying the resulting file. And e.g. "ls" shows that it's a valid link:This is either:
1. an issue with the FTP server: it cannot find the file at /opt/automation/config_links/cert/fullchain.pem although it should, or...
2. /opt/automation/config_links/cert/fullchain.pem is a broken symlink
PI_PROD$ ls -l /opt/automation/config_links/cert/fullchain.pem
lrwxrwxrwx 1 root root 41 Jan 15 00:00 /opt/automation/config_links/cert/fullchain.pem -> ../../archive/dyn.xxx.de/fullchain450.pem
Sounds great :-) So I'll wait, until the new final 11.6 (donation) version is online.This is FFS's new file-symlink support => okay
This is also FFS's new file-symlink support => okay
Thanks a lot for your efforts so far and your great FFS...
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
FreeFileSync issues a SIZE /opt/automation/config_links/cert/fullchain.pem which fails with 550. You can test this by manually entering this command with FileZilla. You should see the same 550 error (if not we have something interesting to investigate)Don't think so, since e.g. FileZilla has no problems following the 2 links and copying the resulting file. And e.g. "ls" shows that it's a valid link: mdrmdr, 16 Jan 2021, 17:44This is either:
1. an issue with the FTP server: it cannot find the file at /opt/automation/config_links/cert/fullchain.pem although it should, or...
2. /opt/automation/config_links/cert/fullchain.pem is a broken symlink
Assuming "fullchain.pem" is not broken this indicates an FTP server bug and FileZilla just got lucky to not trigger it.
- Posts: 65
- Joined: 7 Nov 2020
I wrote already, that FileZilla does see the error but continues:
Status: Retrieving directory listing of "/etc/letsencrypt/live/dyn.xxx.de/fullchain.pem"...
Command: CWD fullchain.pem
Response: 550 fullchain.pem: Not a directory
Error: Failed to retrieve directory listing
Status: Connecting to 10.0.0.10:21...
Status: Connection established, waiting for welcome message...
Status: Initializing TLS...
Status: Retrieving directory listing of "/etc/letsencrypt/live/dyn.xxx.de"...
Status: Directory listing of "/etc/letsencrypt/live/dyn.xxx.de" successful
Status: Verifying certificate...
Status: TLS connection established.
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Starting download of /etc/letsencrypt/live/dyn.xxx.de/fullchain.pem
Status: File transfer successful, transferred 3.761 bytes in 1 second
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
That's not what I was talking about. FileZilla let's you enter FTP commands manually (right-click on the log window).I wrote already, that FileZilla does see the error but continues:
mdrmdr, 16 Jan 2021, 18:01Status: Retrieving directory listing of "/etc/letsencrypt/live/dyn.xxx.de/fullchain.pem"...
Command: CWD fullchain.pem
Response: 550 fullchain.pem: Not a directory
Error: Failed to retrieve directory listing
Status: Connecting to 10.0.0.10:21...
Status: Connection established, waiting for welcome message...
Status: Initializing TLS...
Status: Retrieving directory listing of "/etc/letsencrypt/live/dyn.xxx.de"...
Status: Directory listing of "/etc/letsencrypt/live/dyn.xxx.de" successful
Status: Verifying certificate...
Status: TLS connection established.
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Starting download of /etc/letsencrypt/live/dyn.xxx.de/fullchain.pem
Status: File transfer successful, transferred 3.761 bytes in 1 second
- Posts: 65
- Joined: 7 Nov 2020
Sorry, I did execute the FileZilla command before, but did not post it, as it also gave a 550 error:
And don't ask me why, but STAT works:
Weird, that "/opt/automation/archive/dyn.xxx.de/fullchain450.pem" is an invalid path... FileZilla seems to combine the containing path of the 1st symlink with the resulting path the 2nd symlink. See the full path path resolution above.
Command: SIZE /opt/automation/config_links/cert/fullchain.pem
Response: 550 /opt/automation/config_links/cert/fullchain.pem: No such file or directory
Command: STAT /opt/automation/config_links/cert/fullchain.pem
Response: 213-Status of /opt/automation/config_links/cert/fullchain.pem:
Response: 213-lrwxrwxrwx 1 root root 41 Jan 16 16:56 /opt/automation/config_links/cert/fullchain.pem -> /opt/automation/archive/dyn.xxx.de/fullchain450.pem
Response: 213 End of status
- Posts: 65
- Joined: 7 Nov 2020
Found an explanation how FileZilla does it:
[https://forum.filezilla-project.org/viewtopic.php?t=30485]The directory listings returned by the server may contain information about symbolic links, though this is not covered by neither the FTP specifications nor the SFTP specifications. If FileZilla encounters a symbolic link, it first tries to treat it like a directory, and if that fails, treats it like a file. To prevent endless loops during recursive operations, symlink targets must be within the root of the operation. There is no option to control how symlinks are handled.
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
fullchain.pem -> ../../archive/dyn.xxx.de/fullchain450.pem (file)
and fullchain.pem is located in "/etc/letsencrypt/live/dyn.xxx.de/",
so the resolved path is
/etc/letsencrypt/archive/dyn.xxx.de/fullchain450.pem
If this is an existing file, then the SIZE FTP command should return its size, if not => FTP server bug
The STAT command seems to return successfully (213), but the shown resolved path (/opt/automation/config_links/cert/fullchain.pem) is incorrect => FTP server bug
The problem with FileZilla's approach is that treating a file symlink like a folder by traversing it does not always fail. e.g. Pure-FTPd returns garbage data with success code for MLSD (e.g. "/<symlink name>" with a bogus / at the beginning of a nonexistent file at <parent path>/<symlink name>//<symlink name>)
and fullchain.pem is located in "/etc/letsencrypt/live/dyn.xxx.de/",
so the resolved path is
/etc/letsencrypt/archive/dyn.xxx.de/fullchain450.pem
If this is an existing file, then the SIZE FTP command should return its size, if not => FTP server bug
The STAT command seems to return successfully (213), but the shown resolved path (/opt/automation/config_links/cert/fullchain.pem) is incorrect => FTP server bug
FreeFileSync does the reverse: it checks if the path points to a file (via SIZE) and assume a folder symlink on failure (550).Found an explanation how FileZilla does it: mdrmdr, 16 Jan 2021, 22:29
The problem with FileZilla's approach is that treating a file symlink like a folder by traversing it does not always fail. e.g. Pure-FTPd returns garbage data with success code for MLSD (e.g. "/<symlink name>" with a bogus / at the beginning of a nonexistent file at <parent path>/<symlink name>//<symlink name>)
- Posts: 65
- Joined: 7 Nov 2020
Yes, this path is correct! I'll check if I can install a better/newer ftp server on my Raspberry. Currently it's the latest available ProFTPD Version 1.3.6/etc/letsencrypt/archive/dyn.xxx.de/fullchain450.pem
If this is an exising file, then the SIZE FTP command should return its size, if not => FTP server bugZenju, 16 Jan 2021, 23:03
- Posts: 65
- Joined: 7 Nov 2020
ProFTPD v1.3.7a seems to solve it. I'll try to compile it myself... (tomorrow - it's late now :-)
- Posts: 65
- Joined: 7 Nov 2020
After having some issues with building ProFTPD V1.3.7a from source, I finally managed it. And voilà, it works with your initially provided FFS beta version. Direct links to files are now properly synced. And the size is properly shown in the Size column.
One strange thing: There is "sometimes" an issue with the link: I've to further check under what circumstances this happens, so that the problem is reproducible...
One strange thing: There is "sometimes" an issue with the link:
apache2.conf -> /etc/apache2/apache2.conf
- Posts: 65
- Joined: 7 Nov 2020
I can't see a pattern. "Compare" usually works. But sometimes with 2-3 links to normal ASCII files error 550 (is not a directory) is displayed. Very strange...
If i do in FileZilla, it works now all time.
If i do
size /opt/automation/config_links/apache2.conf
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
If comparison works ("usually" => not always?), then this is probably an unrelated issue. What is the full error message?
- Posts: 65
- Joined: 7 Nov 2020
It's always the same error on random 2-3 files out of 21 files in the directory containing all the symlinks. I'll try to enable a full debug log of ProFTPD and check if I can see something. It's funny, that most of the time "apache2.conf" and "crontab" shows the problem.
- Attachments
-
- FFS5.jpg (63.24 KiB) Viewed 4582 times
- Posts: 65
- Joined: 7 Nov 2020
One finding from the detailled ProFTPD logfile: For each failing file a is in the log. Any idea?
SIZE not allowed in ASCII mode
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
Perfect, you found the issue! FFS needs to set "TYPE I" before "SIZE". Will see to post an update tomorrow.
- Posts: 65
- Joined: 7 Nov 2020
For both, compare and sync, what rules does FFS apply to select either ASCII or binary mode?
-
- Site Admin
- Posts: 7505
- Joined: 9 Dec 2007
Fixed (FFS never uses ASCII, only binary mode)
https://www.mediafire.com/file/snuj27yy3ndyamx/FreeFileSync_11.6_%255BBeta%255D_Windows_Setup%25287%2529
https://www.mediafire.com/file/snuj27yy3ndyamx/FreeFileSync_11.6_%255BBeta%255D_Windows_Setup%25287%2529
- Posts: 65
- Joined: 7 Nov 2020
Can confirm, that it works now. Also following (compare & sync) of a directory tree works well. Will make more tests tonight, but looks good so far :-)
Update Jan 22nd: Found no further errors. Works as expected :-)
Update Jan 22nd: Found no further errors. Works as expected :-)