19

I've used from some time rsync/ssh to backup my shared host contents to my personal Synology NAS (212j for that matter), and it worked quite well. For information, I use a password-less ssh connection.

3 days ago, I updated my NAS software and since (or at least I believe it's since that), the backup won't work anymore. I get the following error on the host:

rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32)
ERROR: module is read only 

..which I do not understand. beside that nothing changed that I know of in both source and destination that can be related to rsync or ssh, I did check a few things and all seems to be alright:

  • I can still connect through ssh from the host to my NAS with the good user, so ssh stuff like keys haven't changed.
  • I also have the correct file permissions on the NAS (I checked, and also tried to create files, directories, .. with the user used by rsync through ssh).

I read here and there that the error means that I have to ensure that my rsyncd.conf have the right read only = no in it, but as far as I know, I never used rsyncd as well as I never configured anything for it and until now it worked like a charm..

I use the following command to do the backup:

rsync -ab --recursive \
--files-from="$FILES_FROM" \
--backup-dir=backup_$SUFFIX \
--delete \
--filter='protect backup_*' \
$WDIRECTORY/ \
remote_backup:$REMOTE_BACKUP/

So I'm stuck and really can't figure out what happened.


Edit:

As suggested in comments, I also tried passing commands to ssh (but not from inside a ssh session), that worked as expected, and also tried a single rsync command, which didnt worked, failing just like the complete backup command.

(sharedHost):hostuser:~ > touch test.txt
(sharedHost):hostuser:~ > rsync test.txt remote_backup:backups/test.txt
ERROR: module is read only
rsync error: syntax or usage error (code 1) at main.c(1034) [Receiver=3.0.8]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]

and

(sharedHost):hostuser:~ > ssh remote_backup 'touch /abs_path_to_backups/backups/test2.txt && echo "ProoF" > /abs_path_to_backups/backups/test2.txt'
(sharedHost):hostuser:~ > ssh remote_backup 'cat /abs_path_to_backups/backups/test2.txt'
ProoF
2
  • Try doing the remote update tests, but with commands given to ssh on the command line instead of through a ssh login session. Also be sure the target space is not full.
    – Skaperen
    Sep 8, 2012 at 17:23
  • Thanks for your suggestions. I edited the question with their result. Also, the target space is not full at all (I was already sure, but I checked again)
    – user978548
    Sep 10, 2012 at 12:41

6 Answers 6

21

I had the same problem after updating my Synology NAS to DSM 4.1. I also do rsync over SSH. In my situation using rsync user root@ip also worked but left the files on the server with owner root which I did not want.

I found in the NAS admin userinterface, that for some reason in ControlPanel->Users->MyRSyncUser->Edit->"Priviliges setup" there was no read/write access to the homes. My RSYNC destination is under the homes.

Setting this to privilidge worked for me. I hope this helps.

7
  • Thank you so much ! That worked ! Next time I update DSM, I'll double-check the permissions..
    – user978548
    Oct 11, 2012 at 22:39
  • 12
    This seems to work if I use full path names (i.e., rsync something nas:/volume2/homes/foo/bar/ instead of rsync something nas:bar/). Dec 14, 2013 at 22:37
  • full path was the last step for me in annoying bout of debugging. thanks! Jun 5, 2014 at 15:30
  • 1
    The problem with this solution (I've not found a better one) is that it gives the user privileges on all user homes, not just their own. Jun 18, 2015 at 7:30
  • 2
    I had this problem, but it wasn't caused by permissions, but simply by misspelling the remote path. the Synology rsync will not tell you that -- just that the path you specify is "read only"
    – dovetalk
    Nov 9, 2021 at 0:47
14

I got rid of ERROR: module is read only by changing the remote path from /var/services/homes/rsync to /volume2/homes/rsync

DSM 5.1

1
  • 1
    Yes this worked for me too: You definitely need the volume in the DiskStation path: USERNAME@DiskStation:/volume1/somebackupDir works, USERNAME@DiskStation:/somebackupDir gives error receiving incremental file list ERROR: module is write only rsync error: syntax or usage error (code 1) at main.c(782) [sender=3.0.9]
    – Paulus
    Feb 25, 2021 at 10:01
5

I encountered the same problem after upgrading a synology ds1010+ to dsm 4.1-2661.

I don't have the time to understand what happened to the rsync provided by synology but it does not seem standard. So here is my workaround...

I didn't want to hack the privileges (multi-user setup), so I've recompiled rsync in static on my laptop, then I've transfered the binary on the sinology nas.

wget https://rsync.samba.org/ftp/rsync/rsync-3.0.9.tar.gz
tar xzvf rsync-3.0.9.tar.gz
cd rsync-3.0.9
export CFLAGS=--static
./configure
make

scp rsync <login>@<nas_hostname>:

You can tell rsync to use your new binary instead of the default one, with this parameter:

--rsync-path=<myhome>/rsync

Now I can continue using duplicity with rsync, by adding the following parameter to duplicity:

--rsync-options="--rsync-path=<myhome>/rsync"
2
  • This is what I did with my DS212j, except I used ipkg to install the new rsync. Synology's directions for installing ipkg are here.
    – Jason
    Jun 9, 2013 at 19:42
  • I couldn't find anything on ipkg for DSM 5.2, so for my DS215j I did as follows to compile (I already had the cross-compiler arm-unknown-eabi-gcc lying around) ./configure --host=armv7 CFLAGS=-static EXEEXT=-static --prefix=/opt CC=arm-unknown-linux-gnueabi-gcc && make && arm-unknown-linux-gnueabi-strip rsync && make DESTDIR=$PWD/../prefix install. Put the binary in /opt/bin/ on the NAS. Also have to give my backup user a shell in /etc/passwd by changing /sbin/nologin to /bin/sh (There should be some more secure options).
    – thomasa88
    Feb 10, 2016 at 8:36
1

I had the same kind of issue, but I wasn't using a dedicated user for rsync.

I had to fix privileges in Control Panel -> Shared folders.

0

I had similar issue while connecting to Synology 211j over Putty's ssh. I had to enable

"Control Panel -> Network backup -> Enable network backup service".

It is working now.

-1

I got it working by logging in as root instead of admin or regular user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .