Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to synchronize two directories using Unison, however if it encounters a file with an error, then it skips the entire directory! I don't believe it should skip the whole directory, and instead should just skip that file. I'm OK with that. How do I tell it to ignore the error and continue to copy the rest of the files?

The Unison is a Windows executable, not Cygwin. I can read the file with Cygwin. Unison does in fact encounter an error on the file, and I'm OK with skipping them.

Version 2.32 works better than 2.40. Version 2.40 won't even start.

I've tried adding -ignore, but that doesn't help. Here is what I tried:

$ unison 'c:\cygwin' 'socket://xps:4321/c:/cygwin'
UNISON 2.32.52 started propagating changes at 02:53:35 on 27 Feb 2013
[ERROR] Skipping etc
  [root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
[ERROR] Skipping home
  [root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
Saving synchronizer state
Synchronization complete at 02:53:39  (3 items transferred, 2 skipped, 0 failed)
  skipped: etc
  skipped: home




$ unison 'c:\cygwin' 'socket://xps:4321/c:/cygwin' -ignore 'Path etc\ssh_host_dsa_key' -ignore 'Path home\SYSTEM\.bash_history'
Contacting server...
Connected [//dumbopc/c:/cygwin -> //xps/c:/cygwin]
Looking for changes
  Waiting for changes from server
Reconciling changes
local          xps
         error            etc
[root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
         error            home
[root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
Proceed with propagating updates? [] g
Propagating updates    
UNISON 2.32.52 started propagating changes at 04:11:26 on 27 Feb 2013
[ERROR] Skipping etc
  [root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
[ERROR] Skipping home
  [root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
UNISON 2.32.52 finished propagating changes at 04:11:28 on 27 Feb 2013
Saving synchronizer state
Synchronization complete at 04:11:30  (6 items transferred, 2 skipped, 0 failed)
  skipped: etc
  skipped: home



# Version 2.40
C:\Program Files\Unison>"Unison-2.40.102 Text.exe"  'c:\cygwin' 'socket://xps:4321/c:\cygwin'
Contacting server...
Fatal error: Wrong number of roots: 2 expected, but 4 provided ('c:\cygwin', 'socket://xps:4321/c:\cygwin', , )
(Maybe you specified roots both on the command line and in the profile?)


@REM DOS
C:\cygwin\etc>type ssh_host_dsa_key
Access is denied.

# Cygwin
$ ls -l /etc/ssh_host_dsa_key
-rw------- 1 SYSTEM None 668 Aug 30  2010 /etc/ssh_host_dsa_key

$ cat /etc/ssh_host_dsa_key
-----BEGIN DSA PRIVATE KEY-----

Command line reference:

http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#prefs

share|improve this question
up vote 0 down vote accepted

I gave up on Unison. I switched to Synchronize It, which preserves modification times and is 10x faster. However, it doesn't propagate deletes both ways.

Synchronize It: http://www.grigsoft.com/wndsync.htm

Also, regarding the error

Wrong number of roots: 2 expected, but 4 provided

Look at $HOME/.unison/default.prf or %HOME%\.unison\default.prf, check if there are lines starting withroot= and remove them or move them to another profile. If there are other lines, you may review them to check if they are suitable in your case. (Apart from some far-fetched cases where one is pretty sure that they ever only synchronize one set of directory trees, default.prf should only contain options, not root specifications.)

That said, you may create and use profiles (.prf files in .unison directory) that specify directory tree roots to synchronize. Any profile may include others and even include default. The latter case comes handy to share a set of options that you want applied to all your profiles and even when unison is launched without specifying a profile on command line. For details see Unison documentation - Profiles.

share|improve this answer
1  
Unison is not dumb. Probably you have mis-configured it. Try entering just "unison" without any arguments in command. Probably you have unison already running. Also check here alliance.seas.upenn.edu/~bcpierce/wiki/… – fat_mike Mar 22 '15 at 23:40
    
Unison has very good performance and safety, and tries hard to make the changes as atomic as possible. Windows is weaker in this regard than Unix so by default unison takes the safe (though slower) option. Things are by default much faster on Linux. You can instruct Unison on Windows to take a faster path, see Fast Update Detection, it will work in most situations. See also Unison FAQ - Tips and Tricks. – Stéphane Gourichon Jan 16 at 22:05
    
There's a reason why unison does not synchronize file times by default: to avoid confusing programs that rely on time (for example any situation where some files are rebuild from others based on time of last change). Also, I guess that "Synchronize It" does not propagate deletes because it does not actually maintain a state between invocations (which unison does, and can even keep backups of changed files in a safe place). – Stéphane Gourichon Jan 16 at 22:10
    
Grigsoft "synchronize it" wasn't updated since 2009, claims Windows 7 compatibility, while unison is still maintained as of 2016 and claims compatibility with Windows, OSX, Linux, Android, FreeBSD, OpenBSD. Unison works on many platforms, is free software which means that you can use it, change it, distribute it. With fastcheck=on unison is probably as fast (if not better) than Synchronize It. – Stéphane Gourichon Jan 16 at 22:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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