Bug 1082496 - socket activation for rsync doesn't work
socket activation for rsync doesn't work
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rsync (Show other bugs)
7.0
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: Luboš Uhliarik
Jaroslav Aster
Jana Heves
: EasyFix
: 1180317 (view as bug list)
Depends On:
Blocks: 1205796 1104634 1110706 1191020 1247270
  Show dependency treegraph
 
Reported: 2014-03-31 03:58 EDT by Karel Srot
Modified: 2015-11-19 07:20 EST (History)
9 users (show)

See Also:
Fixed In Version: rsync-3.0.9-17.el7
Doc Type: Known Issue
Doc Text:
The rsync utility cannot be run as a socket-activated service because the rsyncd@.service file is missing from the rsync package. Consequently, the "systemctl start rsyncd.socket" command does not work. However, running rsync as a daemon by executing the "systemctl start rsyncd.service" command works as expected.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 07:20:43 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Karel Srot 2014-03-31 03:58:58 EDT
Description of problem:

rsync cannot be started via socket. This is already tracked in Fedora bug 1047236.

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. disable rsyncd.service and start rsyncd.socket
2. execute rsync command
3.

Actual results:
connection refused

Expected results:
rsync works
Comment 1 Karel Srot 2014-03-31 04:00:47 EDT
broken package: rsync-3.0.9-15.el7
Comment 3 Pavel Šimerda (pavlix) 2014-03-31 04:28:26 EDT
Looks like we basically need the rsyncd@.service file:

diff --git a/rsyncd@.service b/rsyncd@.service
new file mode 100644
index 0000000..89f9621
--- /dev/null
+++ b/rsyncd@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=fast remote file copy program daemon
+ConditionPathExists=/etc/rsyncd.conf
+
+[Service]
+EnvironmentFile=/etc/sysconfig/rsyncd
+ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"
+StandardInput=socket
Comment 4 Aaron Howell 2014-08-11 00:28:12 EDT
We have put this file in as a work around while waiting for this official fix:

$ cat /etc/systemd/system/rsyncd\@.service
[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf

[Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"
StandardInput=socket

We noticed that the whole system started crawling to a halt after a period of time - in troubleshooting there are a lot of failed rsync processes piling up
$ systemctl 
rsyncd@196279-10.0.0.1:873-10.1.1.1:19886.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196280-10.0.0.1:873-10.1.1.1:19887.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196281-10.0.0.1:873-10.1.1.1:19888.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196282-10.0.0.1:873-10.1.1.1:19889.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196283-10.0.0.1:873-10.1.1.1:19898.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196284-10.0.0.1:873-10.1.1.1:19899.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196285-10.0.0.1:873-10.1.1.1:19903.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196286-10.0.0.1:873-10.1.1.1:19905.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196287-10.0.0.1:873-10.1.1.1:19907.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196288-10.0.0.1:873-10.1.1.1:19912.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196289-10.0.0.1:873-10.1.1.1:19914.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196290-10.0.0.1:873-10.1.1.1:19915.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196291-10.0.0.1:873-10.1.1.1:19916.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196292-10.0.0.1:873-10.1.1.1:19917.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196293-10.0.0.1:873-10.1.1.1:19918.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196294-10.0.0.1:873-10.1.1.1:19919.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196295-10.0.0.1:873-10.1.1.1:19922.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196296-10.0.0.1:873-10.1.1.1:19924.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196297-10.0.0.1:873-10.1.1.1:19934.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196298-10.0.0.1:873-10.1.1.1:19935.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196299-10.0.0.1:873-10.1.1.1:19937.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196300-10.0.0.1:873-10.1.1.1:19938.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196301-10.0.0.1:873-10.1.1.1:19942.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196302-10.0.0.1:873-10.1.1.1:19944.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196303-10.0.0.1:873-10.1.1.1:19945.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196304-10.0.0.1:873-10.1.1.1:19959.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196305-10.0.0.1:873-10.1.1.1:19960.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196306-10.0.0.1:873-10.1.1.1:19961.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196307-10.0.0.1:873-10.1.1.1:19962.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196308-10.0.0.1:873-10.1.1.1:19963.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196309-10.0.0.1:873-10.1.1.1:19964.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196310-10.0.0.1:873-10.1.1.1:19965.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196311-10.0.0.1:873-10.1.1.1:19967.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196312-10.0.0.1:873-10.1.1.1:19968.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196313-10.0.0.1:873-10.1.1.1:19969.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196314-10.0.0.1:873-10.1.1.1:19970.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196315-10.0.0.1:873-10.1.1.1:19971.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196316-10.0.0.1:873-10.1.1.1:19972.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196317-10.0.0.1:873-10.1.1.1:19973.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196318-10.0.0.1:873-10.1.1.1:19974.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196319-10.0.0.1:873-10.1.1.1:19975.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196320-10.0.0.1:873-10.1.1.1:19976.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196321-10.0.0.1:873-10.1.1.1:19977.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196322-10.0.0.1:873-10.1.1.1:19978.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196323-10.0.0.1:873-10.1.1.1:19979.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196324-10.0.0.1:873-10.1.1.1:19980.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196325-10.0.0.1:873-10.1.1.1:19981.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196326-10.0.0.1:873-10.1.1.1:19982.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196327-10.0.0.1:873-10.1.1.1:19983.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196328-10.0.0.1:873-10.1.1.1:19984.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd@196329-10.0.0.1:873-10.1.1.1:19985.service                                    loaded failed failed    fast remote file copy program daemon

This is caused by this particular host not being on the "hosts allow = " line in /etc/rsyncd.conf causing rsync to exit with a nonzero status - which systemd then marks as failed.

The fix is to either use the systemd service file to acknowledge or ignore the return status code
Acknowledge - use "SuccessExitStatus" - however I'm not sure of the return codes that are fine to use as successful exits
So I have ignored it completely which you do by prefixing the command for ExecStart with a hyphen.
ExecStart=-/usr/bin/rsync --daemon --no-detach "$OPTIONS"

If you are going to start including this file, might want to make sure it does not cause issues with the exit codes of rsync.
Comment 5 Karel Srot 2015-01-27 07:35:43 EST
postponing to 7.2
Comment 10 Karel Srot 2015-04-20 10:35:46 EDT
*** Bug 1180317 has been marked as a duplicate of this bug. ***
Comment 11 Jaroslav Aster 2015-06-03 08:39:56 EDT
Hi,

I can confirm that rsyncd\@.service suggested by Aaron works. Exactly I used this:

[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf

[Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=-/usr/bin/rsync --daemon --no-detach "$OPTIONS"
StandardInput=socket

[Install]
WantedBy=multi-user.target

It is copy of rsyncd.service + StandardInput=socket and '-' before /usr/bin/rsync.
Comment 15 errata-xmlrpc 2015-11-19 07:20:43 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2120.html

Note You need to log in before you can comment on or make changes to this bug.