I'm using unison 2.52.1
both on my linux machine (Ubuntu version 20.04) and my Mac (MacOS version 11.7).
I want to use unison
to back up my entire linux filesystem (excluding a few specific directories via "ignore") to a directory on the Mac via an ssh connection.
I know how to set up this ssh-based unison
transfer except for one key point: it seems that unison
is not permitting the initial "root" of the source machine to be /
. However, since I want to back up everything on the linux machine, I need to start at the root of the linux filesystem tree.
Does anyone know of a way to get unison
to allow the source "root" to be /
under linux?
Thank you very much in advance.
UPDATE: Here is the preferences file which fails, and the error message that I receive ...
root = /
root = ssh://[email protected]//Users/useronmac/backups
force = /
sshargs = -p 6543
[ "ignore" commands go here ]
This is the error I get ...
[ ... etc. ... ]
Looking for changes
Waiting for changes from server
Reconciling changes
error /
The path / is a root directory
No updates to propagate
If I use any other name for the first "root" and for "force", it works fine. For example ...
root = /usr
root = ssh://[email protected]//Users/useronmac/backups
force = /usr
That works with no problem.
ANOTHER UPDATE
Per @Edward's suggestion, I tried running with -debug all
. Nothing particularly meaningful was printed beyond what I listed above. Here are the significant stdout lines at the end of the -debug all
output ...
[ ... etc. ... ]
[update] Updating archives
[update] Saving archive in /root/.unison/scb96ed4facff65e2345cb97206c90f055
[server: update] Saving archive in /Users/useronmac/Library/Application Support/Unison/scce5852e4685b7e41685f5f8f38d86e90
[update] Copying archive /root/.unison/tmb96ed4facff65e2345cb97206c90f055 to /root/.unison/arb96ed4facff65e2345cb97206c90f055
[server: update] Copying archive /Users/useronmac/Library/Application Support/Unison/tmce5852e4685b7e41685f5f8f38d86e90 to /Users/useronmac/Library/Application Support/Unison/arce5852e4685b7e41685f5f8f38d86e90
[update] Removing archive /root/.unison/tmb96ed4facff65e2345cb97206c90f055
[server: update] Removing archive /Users/useronmac/Library/Application Support/Unison/tmce5852e4685b7e41685f5f8f38d86e90
error /
The path / is a root directory
No updates to propagate
Synchronization complete at 18:48:20 (0 items transferred, 1 skipped, 0 failed)
skipped: (The path / is a root directory)
[server: remote] Connection closed by the client
Also, I opened an issue on the unison
github site, and soon thereafter, they closed it, telling me to read the entire unison
docs and then to post any further questions on their mailing list. This implies to me that this root = /
behavior is some sort of documented "feature", although I haven't yet found it mentioned in the docs ... although I haven't had time to read the entire documentation yet.
And I requested access to their mailing list, but I haven't been approved yet.
Anyway, I'll post whatever I find out from the unison
docs and/or from their mailing list.
YET ANOTHER UPDATE
I couldn't find anything in the unison
docs about /
being prohibited as a "root". However, I started looking through the latest unison
source code on their github site (https://github.com/bcpierce00/unison). It turns out that /
is indeed hard-coded to be an illegal "root" under linux.
To see why I am making that claim, go to that unison
github site and look at the src/fspath.ml
file there. First of all, starting on line 45 of that file, we have this:
let isRootDir d =
(* We assume all path separators are slashes in d *)
d="/" ||
(Util.osType = `Win32 && Rx.match_string winRootRx d)
This says that on a non-Win32 OS, the isRootDir
function returns "true" if the file in question is /
, and it returns "false" otherwise.
Then, look at the isRootDirLocalString
function starting on line 50 of that same file:
let isRootDirLocalString d =
let d =
if Util.osType = `Win32 then Fileutil.backslashes2forwardslashes d else d
in
isRootDir ((Fileutil.removeTrailingSlashes d) ^ "/")
This function also will return "true" on non-Win32 OS's for the /
pathname.
Then, look at lines 380-382 of that same file:
if isRootDirLocalString realpath then
raise (Util.Transient(Printf.sprintf
"The path %s is a root directory" abspath));
This code will raise an exception if the "realpath" variable is /
, and you can see that the text of this exception is the exact error message that I get when I try to specify root = /
in my tests.
There is no other place in the source code where this error message is printed.
Therefore, I am concluding that the prohibition of root = /
is indeed some sort of intentional feature of unison
.
Once I get onto the unison
mailing list, I will ask if they would be willing to relax that prohibition if the "root" in question is tagged with "force".
/
. Could you share the error message you're getting?The path / is a root directory
... that's an intriguing message. Is it an error message? Does unison think it shouldn't sync/
for your own good? I'm not sure here. I'd recommend you open an issue on GitHub, asking what the intent here is. Be sure to come back here with an answer. I'm quite curious about this./
is a root directory, unison says, "No updates to propagate", and it does nothing. So indeed it seems like unison doesn't want to deal with root as/
. But yes, I'll go to github and raise that issue, and then report back.-force
? (You will still have the option to abort unison before it starts making any changes.). And have you used-debug all
?