We are trying to create an rsyncd.service with fedora 16. We can get the process to start but it acts like it never opens the socket and exits a short time later. The two files we have are below.
rsyncd.socket: [Unit] Description=rsyncd Service Sockets
[Socket] ListenStream=873
[Install] WantedBy=sockets.target
rsyncd.service: [Unit] Description=rsyncd Rsync Daemon After=syslog.target network.target DefaultDependencies=no
[Service] EnvironmentFile=/etc/rsyncd/rsyncd.conf ExecStart=/usr/bin/rsync --config=/etc/rsyncd/rsyncd.conf --daemon
[Install] Also=rsyncd.socket WantedBy=multi-user.target
On Sun, Nov 27, 2011 at 8:35 PM, David Highley dhighley@highley-recommended.com wrote:
We are trying to create an rsyncd.service with fedora 16. We can get the process to start but it acts like it never opens the socket and exits a short time later. The two files we have are below.
rsyncd.socket: [Unit] Description=rsyncd Service Sockets
[Socket] ListenStream=873
rsyncd needs "Accept=yes" here. (It's the equivalent of "nowait" in inetd.)
[Install] WantedBy=sockets.target
rsyncd.service:
inetd-style services need an @ at the end of the service name, which signifies that more than one copy of the service can be started. So this needs to be renamed to "rsyncd@.service".
[Unit] Description=rsyncd Rsync Daemon After=syslog.target network.target DefaultDependencies=no
Why are you overriding default dependencies? It shouldn't be necessary for this.
[Service] EnvironmentFile=/etc/rsyncd/rsyncd.conf ExecStart=/usr/bin/rsync --config=/etc/rsyncd/rsyncd.conf --daemon
inetd-style services like rsyncd expect the socket to be connected to standard input and output. To accomplish that with systemd, add "StandardInput=socket" here. (stdout is inherited from stdin implicitly.)
[Install] Also=rsyncd.socket WantedBy=multi-user.target
For more information on converting inetd services to systemd units, see: http://0pointer.de/blog/projects/inetd.html
-T.C.
"T.C. Hollingsworth wrote:"
On Sun, Nov 27, 2011 at 8:35 PM, David Highley dhighley@highley-recommended.com wrote:
We are trying to create an rsyncd.service with fedora 16. We can get the process to start but it acts like it never opens the socket and exits a short time later. The two files we have are below.
rsyncd.socket: [Unit] Description=rsyncd Service Sockets
[Socket] ListenStream=873
rsyncd needs "Accept=yes" here. (It's the equivalent of "nowait" in inetd.)
[Install] WantedBy=sockets.target
rsyncd.service:
inetd-style services need an @ at the end of the service name, which signifies that more than one copy of the service can be started. So this needs to be renamed to "rsyncd@.service".
[Unit] Description=rsyncd Rsync Daemon After=syslog.target network.target DefaultDependencies=no
Why are you overriding default dependencies? It shouldn't be necessary for this.
Just followed another script that looked close.
[Service] EnvironmentFile=/etc/rsyncd/rsyncd.conf ExecStart=/usr/bin/rsync --config=/etc/rsyncd/rsyncd.conf --daemon
inetd-style services like rsyncd expect the socket to be connected to standard input and output. To accomplish that with systemd, add "StandardInput=socket" here. (stdout is inherited from stdin implicitly.)
[Install] Also=rsyncd.socket WantedBy=multi-user.target
Did a disable on service. Made the changes. Reloaded systemd. Re-enabled service. Now when attempt to start: systemctl start rsyncd@.service Failed to issue method call: Unit name rsyncd@.service is not valid.
For more information on converting inetd services to systemd units, see: http://0pointer.de/blog/projects/inetd.html
-T.C.
users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
"David Highley wrote:"
"T.C. Hollingsworth wrote:"
On Sun, Nov 27, 2011 at 8:35 PM, David Highley dhighley@highley-recommended.com wrote:
We are trying to create an rsyncd.service with fedora 16. We can get the process to start but it acts like it never opens the socket and exits a short time later. The two files we have are below.
rsyncd.socket: [Unit] Description=rsyncd Service Sockets
[Socket] ListenStream=873
rsyncd needs "Accept=yes" here. (It's the equivalent of "nowait" in inetd.)
[Install] WantedBy=sockets.target
rsyncd.service:
inetd-style services need an @ at the end of the service name, which signifies that more than one copy of the service can be started. So this needs to be renamed to "rsyncd@.service".
[Unit] Description=rsyncd Rsync Daemon After=syslog.target network.target DefaultDependencies=no
Why are you overriding default dependencies? It shouldn't be necessary for this.
Just followed another script that looked close.
[Service] EnvironmentFile=/etc/rsyncd/rsyncd.conf ExecStart=/usr/bin/rsync --config=/etc/rsyncd/rsyncd.conf --daemon
inetd-style services like rsyncd expect the socket to be connected to standard input and output. To accomplish that with systemd, add "StandardInput=socket" here. (stdout is inherited from stdin implicitly.)
[Install] Also=rsyncd.socket WantedBy=multi-user.target
Did a disable on service. Made the changes. Reloaded systemd. Re-enabled service. Now when attempt to start: systemctl start rsyncd@.service Failed to issue method call: Unit name rsyncd@.service is not valid.
For more information on converting inetd services to systemd units, see: http://0pointer.de/blog/projects/inetd.html
It appears that this example maybe out of date. Looks like the argument StandardInput is no longer valid, according to: http://0pointer.de/public/systemd-man/systemd.service.html
We also do not see where the "@" is being used in any of the scripts for the names. The supplied sshd.service looks different and does not have an accompanying sshd.socket file. So we really do not understand how this works at this point.
-T.C.
users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
On Mon, Nov 28, 2011 at 9:02 AM, David Highley dhighley@highley-recommended.com wrote:
"David Highley wrote:"
"T.C. Hollingsworth wrote:"
For more information on converting inetd services to systemd units, see: http://0pointer.de/blog/projects/inetd.html
It appears that this example maybe out of date. Looks like the argument StandardInput is no longer valid, according to: http://0pointer.de/public/systemd-man/systemd.service.html
StandardInput is explained in "man systemd.exec": http://0pointer.de/public/systemd-man/systemd.exec.html
Unit file syntax may have fields added, but should never have fields removed except in rare circumstances, at which point they will be subject to a long deprecation process.
We also do not see where the "@" is being used in any of the scripts for the names. The supplied sshd.service looks different and does not have an accompanying sshd.socket file. So we really do not understand how this works at this point.
The "@" syntax is described in detail here: http://0pointer.de/blog/projects/instances.html
Fedora's openvpn@.service and getty@.service use it, perhaps others too.
sshd supports being used both as an inetd-style daemon and a regular daemon. Fedora installs it as a regular daemon.
-T.C.
"T.C. Hollingsworth wrote:"
On Mon, Nov 28, 2011 at 9:02 AM, David Highley dhighley@highley-recommended.com wrote:
"David Highley wrote:"
"T.C. Hollingsworth wrote:"
For more information on converting inetd services to systemd units, see: http://0pointer.de/blog/projects/inetd.html
It appears that this example maybe out of date. Looks like the argument StandardInput is no longer valid, according to: http://0pointer.de/public/systemd-man/systemd.service.html
StandardInput is explained in "man systemd.exec": http://0pointer.de/public/systemd-man/systemd.exec.html
Unit file syntax may have fields added, but should never have fields removed except in rare circumstances, at which point they will be subject to a long deprecation process.
We also do not see where the "@" is being used in any of the scripts for the names. The supplied sshd.service looks different and does not have an accompanying sshd.socket file. So we really do not understand how this works at this point.
The "@" syntax is described in detail here: http://0pointer.de/blog/projects/instances.html
Fedora's openvpn@.service and getty@.service use it, perhaps others too.
sshd supports being used both as an inetd-style daemon and a regular daemon. Fedora installs it as a regular daemon.
When the name is changed to add the "@" we get the following error: systemctl start rsyncd@.service Failed to issue method call: Unit name rsyncd@.service is not valid
Looked at the openvpn@.service script and see the type=forking statement. We added this but with the above issue not able to tell if it helped. The document on systemd.exec still leaves us wondering where and which file to insert the StandardInput statement. Will look at more scripts to see if we can determine the correct location.
-T.C.
users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
"David Highley wrote:"
"T.C. Hollingsworth wrote:"
On Mon, Nov 28, 2011 at 9:02 AM, David Highley dhighley@highley-recommended.com wrote:
"David Highley wrote:"
"T.C. Hollingsworth wrote:"
For more information on converting inetd services to systemd units, see: http://0pointer.de/blog/projects/inetd.html
It appears that this example maybe out of date. Looks like the argument StandardInput is no longer valid, according to: http://0pointer.de/public/systemd-man/systemd.service.html
StandardInput is explained in "man systemd.exec": http://0pointer.de/public/systemd-man/systemd.exec.html
Unit file syntax may have fields added, but should never have fields removed except in rare circumstances, at which point they will be subject to a long deprecation process.
We also do not see where the "@" is being used in any of the scripts for the names. The supplied sshd.service looks different and does not have an accompanying sshd.socket file. So we really do not understand how this works at this point.
The "@" syntax is described in detail here: http://0pointer.de/blog/projects/instances.html
Fedora's openvpn@.service and getty@.service use it, perhaps others too.
sshd supports being used both as an inetd-style daemon and a regular daemon. Fedora installs it as a regular daemon.
When the name is changed to add the "@" we get the following error: systemctl start rsyncd@.service Failed to issue method call: Unit name rsyncd@.service is not valid
Looked at the openvpn@.service script and see the type=forking statement. We added this but with the above issue not able to tell if it helped. The document on systemd.exec still leaves us wondering where and which file to insert the StandardInput statement. Will look at more scripts to see if we can determine the correct location.
Just to be clear we now have: rsyncd@.service: [Unit] Description=rsyncd Rsync Daemon After=syslog.target network.target
[Service] Type=forking EnvironmentFile=/etc/rsyncd/rsyncd.conf ExecStart=/usr/bin/rsync --config=/etc/rsyncd/rsyncd.conf --daemon StandardInput=socket
[Install] Also=rsyncd.socket WantedBy=multi-user.target
-T.C.
users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
On Mon, Nov 28, 2011 at 10:42 AM, David Highley dhighley@highley-recommended.com wrote:
"David Highley wrote:"
Looked at the openvpn@.service script and see the type=forking statement. We added this but with the above issue not able to tell if it helped. The document on systemd.exec still leaves us wondering where and which file to insert the StandardInput statement. Will look at more scripts to see if we can determine the correct location.
"Type=forking" doesn't work with inetd-style daemons; by definition they cannot fork. openvpn isn't an inetd-style service, it uses the @ in a different manner, because it can be started with more than one configuration file, as opposed to more than one socket like rsyncd/inetd services.
StandardInput does go into the [Service] section of the .service file; that was done correctly.
Just to be clear we now have:
<snipped>
I double-checked a few details and there are some other things that need to be fixed:
EnvironmentFile is incorrect. EnvironmentFile is generally used for things in /etc/sysconfig, and can only contain a list of environment variables that are passed to the Exec lines. (e.g. you might have "PORT=8080" in /etc/sysconfig/foobar and "ExecStart=/usr/sbin/foobar -p $PORT"). This line can be removed.
inetd-style services don't need an [Install] section in the .service file at all; that's only necessary for services that use systemd's new socket activation features. So that section can also be removed.
"After=socket.target" is implicit in F16, it's a part of DefaultDependencies. So it can be safely removed, but doesn't hurt anything if it stays. (I mention this only because I removed it out of habit in my below example, it doesn't matter if it stays or goes.)
So, your final files should look like: https://gist.github.com/1401352
That should work just fine. Remember, you need to operate on the socket, not the service. systemd will start the service itself when users connect to it. So, to enable the socket to start when your computer starts, run: systemctl enable rsyncd.socket
To start the rsyncd socket so accepts connections right now, run: systemctl start rsyncd.socket
-T.C.
"T.C. Hollingsworth wrote:"
On Mon, Nov 28, 2011 at 10:42 AM, David Highley dhighley@highley-recommended.com wrote:
"David Highley wrote:"
Looked at the openvpn@.service script and see the type=forking statement. We added this but with the above issue not able to tell if it helped. The document on systemd.exec still leaves us wondering where and which file to insert the StandardInput statement. Will look at more scripts to see if we can determine the correct location.
"Type=forking" doesn't work with inetd-style daemons; by definition they cannot fork. openvpn isn't an inetd-style service, it uses the @ in a different manner, because it can be started with more than one configuration file, as opposed to more than one socket like rsyncd/inetd services.
StandardInput does go into the [Service] section of the .service file; that was done correctly.
Just to be clear we now have:
<snipped>
I double-checked a few details and there are some other things that need to be fixed:
EnvironmentFile is incorrect. EnvironmentFile is generally used for things in /etc/sysconfig, and can only contain a list of environment variables that are passed to the Exec lines. (e.g. you might have "PORT=8080" in /etc/sysconfig/foobar and "ExecStart=/usr/sbin/foobar -p $PORT"). This line can be removed.
inetd-style services don't need an [Install] section in the .service file at all; that's only necessary for services that use systemd's new socket activation features. So that section can also be removed.
"After=socket.target" is implicit in F16, it's a part of DefaultDependencies. So it can be safely removed, but doesn't hurt anything if it stays. (I mention this only because I removed it out of habit in my below example, it doesn't matter if it stays or goes.)
So, your final files should look like: https://gist.github.com/1401352
That should work just fine. Remember, you need to operate on the socket, not the service. systemd will start the service itself when users connect to it. So, to enable the socket to start when your computer starts, run: systemctl enable rsyncd.socket
It is now working, operating on rsyncd.socket was not obvious to us instead of the service. Made the last few changes as well to clean it up. We greatly appreciate the information and help in getting this to work.
To start the rsyncd socket so accepts connections right now, run: systemctl start rsyncd.socket
-T.C.
users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
"David Highley wrote:"
"T.C. Hollingsworth wrote:"
Thanks to T.C. Hollingsworth for helping us implement this service. Steps to creating an rsyncd service that works with systemd on fedora 16.
Create configuration for rsyncd server. - mkdir /etc/rsyncd - touch /etc/rsyncd.motd - touch /etc/rsyncd.secrets - edit /etc/rsyncd.conf pid file=/var/run/rsyncd.pid port=873 address=<server address> uid=root gid=root use chroot=yes read only=no
# limit access to from allowed hosts only hosts allow=<space separated host addresses> hosts deny=*
motd file=/etc/rsyncd/rsyncd.motd
log format=%t%a%m%f%b log file=/var/log/rsyncd.log timeout=300
[module name] path= list=yes #secrets file=/etc/rsysncd/rsyncd.secrets comment=<module comment string>
In the directory /lib/systemd/system create two files. - rsyncd@.service [Unit] Description=rsyncd Rsync Daemon After=syslog.target network.target
[Service] ExecStart=/usr/bin/rsync --config=/etc/rsyncd/rsyncd.conf --daemon StandardInput=socket
- rsyncd.socket [Unit] Description=rsyncd Service Sockets
[Socket] ListenStream=873 Accept=yes
[Install] WantedBy=sockets.target
Reload systemd daemon, enable and start the service. - systemctl --system daemon-reload - systemctl enable rsyncd.socket - systemctl start rsyncd.socket
On Mon, Nov 28, 2011 at 7:29 AM, David Highley dhighley@highley-recommended.com wrote:
Did a disable on service. Made the changes. Reloaded systemd. Re-enabled. service. Now when attempt to start: systemctl start rsyncd@.service Failed to issue method call: Unit name rsyncd@.service is not valid.
You can't start rsyncd this way. Remember, rsyncd used inetd; it wasn't a normal service. inetd only started it when something connected to its socket, and systemd will refuse to start it until something connects to its socket as well.
You need only start "rsyncd.socket" for the service to work.
-T.C.
On Mon, Nov 28, 2011 at 7:29 AM, David Highley dhighley@highley-recommended.com wrote:
"T.C. Hollingsworth wrote:"
On Sun, Nov 27, 2011 at 8:35 PM, David Highley dhighley@highley-recommended.com wrote:
[Unit] Description=rsyncd Rsync Daemon After=syslog.target network.target DefaultDependencies=no
Why are you overriding default dependencies? It shouldn't be necessary for this.
Just followed another script that looked close.
Definitely remove this, as with DefaultDependencies disabled systemd could theoretically try to start it before any disks are mounted!
-T.C.