{"id":66,"date":"2014-08-19T04:57:24","date_gmt":"2014-08-19T04:57:24","guid":{"rendered":"https:\/\/blog.johnny-lin.com\/?p=66"},"modified":"2014-08-19T05:24:21","modified_gmt":"2014-08-19T05:24:21","slug":"fixing-a-really-weird-rsync-problem","status":"publish","type":"post","link":"https:\/\/blog.johnny-lin.com\/?p=66","title":{"rendered":"Fixing a Really Weird Rsync Problem"},"content":{"rendered":"<p>I&#8217;ve been trying to do an rsync copy from a remote machine (Mac 10.6.x) to my local machine (Ubuntu 12.04.x).  I&#8217;ve been doing dry runs (<code>-n<\/code> option) using something similar to this:<\/p>\n<p><code>rsync -ani username1@hostname.local:\/Users\/username1\/Dropbox\/ \/home\/username2\/Dropbox\/<\/code><\/p>\n<p>(I&#8217;ve changed the hostname and usernames to be generic.) <!--more-->  For hours, I was getting errors. I don&#8217;t have the messages, but they looked like:<\/p>\n<p><code>rsync: connection unexpectedly closed (24 bytes read so far)<br \/>\nrsync error: error in rsync protocol data stream (code 12) at io.c(342)<\/code><\/p>\n<p>which I have copied from <a href=\"http:\/\/rsync.samba.org\/issues.html\">here<\/a>.<\/p>\n<p>So, how did it go away?  All I did was put in the following basic rsyncd.conf file in \/etc (the file did not exist before):<\/p>\n<p><code>#maximum allowed connections<br \/>\nmax connections = 2<br \/>\n#where to log<br \/>\nlog file = \/var\/log\/rsync.log<br \/>\ntimeout = 300<\/code><\/p>\n<p>Other weird things I discovered:<\/p>\n<ul>\n<li>Adding the rsyncd.conf file that specified a log file doesn&#8217;t actually result in that log file being written to.  Maybe only error messages are written to that file, and only when you&#8217;re running rsyncd instead of rsync, but I kinda thought if creating this configuration file fixed my problem that something would be written to the log file.<\/li>\n<li>When I try to recreate the problem by removing rsyncd.conf, the problem doesn&#8217;t come back.<\/li>\n<li>The <code>--log-file<\/code> option creates a log file that doesn&#8217;t have every line that comes out of stdout.  Thus, if you want the full output of <code>--itemize-changes<\/code> (<code>-i<\/code> option), you won&#8217;t get it.  Better to go with tee:\n<p><code>rsync -ani username1@hostname.local:\/Users\/username1\/Dropbox\/ \/home\/username2\/Dropbox\/ | tee logfile<\/code><\/p>\n<p>which sends a copy of the output to logfile, in addition to stdout.<\/li>\n<li>You can get a:\n<p><code>rsync error: some files\/attrs were not transferred (see previous errors) (code 23) at main.c(1536) [generator=3.0.9]<\/code><\/p>\n<p>error if the filenames are too long.  This is problem on the Mac end, I think, so if you create filenames that are really long on the Linux end, if you copy it to the Mac end, you&#8217;ll have problems.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been trying to do an rsync copy from a remote machine (Mac 10.6.x) to my local machine (Ubuntu 12.04.x). I&#8217;ve been doing dry runs (-n option) using something similar to this: rsync -ani username1@hostname.local:\/Users\/username1\/Dropbox\/ \/home\/username2\/Dropbox\/ (I&#8217;ve changed the hostname and usernames to be generic.)<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-mac-os-x","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66"}],"version-history":[{"count":10,"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":77,"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions\/77"}],"wp:attachment":[{"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.johnny-lin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}