Bug 1082496

Summary: socket activation for rsync doesn't work
Product: Red Hat Enterprise Linux 7 Reporter: Karel Srot <ksrot>
Component: rsyncAssignee: LuboŇ° Uhliarik <luhliari>
Status: CLOSED ERRATA QA Contact: Jaroslav Aster <jaster>
Severity: high Docs Contact: Jana Heves <jsvarova>
Priority: high    
Version: 7.0CC: amahdal, bancinco, bugzilla, jaster, ksrot, ovasik, rhel, riehecky, thozza
Target Milestone: rcKeywords: EasyFix
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 12:20:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1104634, 1110706, 1191020, 1205796, 1247270    

Description Karel Srot 2014-03-31 07:58:58 UTC
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 08:00:47 UTC
broken package: rsync-3.0.9-15.el7

Comment 3 Pavel ҆imerda (pavlix) 2014-03-31 08:28:26 UTC
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 04:28:12 UTC
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.0.1:873-10.1.1.1:19886.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19887.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19888.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19889.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19898.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19899.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19903.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19905.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19907.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19912.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19914.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19915.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19916.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19917.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19918.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19919.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19922.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19924.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19934.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19935.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19937.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19938.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19942.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19944.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19945.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19959.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19960.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19961.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19962.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19963.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19964.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19965.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19967.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19968.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19969.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19970.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19971.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19972.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19973.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19974.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19975.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19976.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19977.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19978.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19979.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19980.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19981.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19982.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19983.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.0.1:873-10.1.1.1:19984.service                                    loaded failed failed    fast remote file copy program daemon
rsyncd.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 12:35:43 UTC
postponing to 7.2

Comment 10 Karel Srot 2015-04-20 14:35:46 UTC
*** Bug 1180317 has been marked as a duplicate of this bug. ***

Comment 11 Jaroslav Aster 2015-06-03 12:39:56 UTC
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 12:20:43 UTC
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