Created attachment 354994 [details] systemd unit file for tincd net-misc/tinc does not currently provide a systemd unit file. Attached you will find such a unit file that I took and adjusted from arch linux. I have tested and it works correctly. It provides a template service that can be instantiated for each tinc vpn.
I will review, test and commit it in a week if nobody disagrees. Thanks
(In reply to Pacho Ramos from comment #1) > I will review, test and commit it in a week if nobody disagrees. Thanks @pacho, I don't use systemd but have no objections to adding systemd files. Feel free to add without my ack to my packages, but please test first. Thanks.
How can I test it? (how should I launch this @ service?) Thanks
(In reply to Pacho Ramos from comment #3) > How can I test it? (how should I launch this @ service?) Thanks Yeah, tinc is a server client vpn so its hard to test. If you can launch this as any network daemon, then just put it in and let's see what bugs come back. I would revbump, drop keywords to ~ and let the community that uses both systemd and tinc report any issues.
If you really want to test this you have to create a vpn between two (or more) computers (see [1] or [2] for that) and then start it by issuing systemctl start tincd@NAMEOFVPN on both of them. I for one have been using this unit file for over a month now and have not experienced any issues. http://www.vanheusden.com/linux/tinc_mini_howto.html http://blogs.operationaldynamics.com/andrew/software/research/using-tinc-vpn
Created attachment 357464 [details] tinc-1.0.22-r1.ebuild
Created attachment 357466 [details] tincd_at.service This are the files I have prepared and installed, locally, can you confirm they work as intended?
I did consider using the -D (--no-detach) switch when I wrote my proposed unit file, but tincd(8) says that "this will also disable the automatic restart mechanism for fatal errors". I am not exactly sure what they mean by that and I am not sure whether this is desirable.
systemd can take care of restarting it too... but I guess it will be better to let tinc handle it as it wants (and, then, letting it daemonize)
(In reply to Pacho Ramos from comment #7) > Created attachment 357466 [details] > tincd_at.service > > This are the files I have prepared and installed, locally, can you confirm > they work as intended? I added these to the tree for testing. Let me know if there's any problem, else just close this bug as resolved.
I tested it from the tree and I found a problem: tincd fails because it tries to create a pidfile in the /var/lib/run/ directory. The same issue exists for the unit file I proposed as well. I had tested that in a different computer that happened to have that directory by accident. Therefore, a pidfile has to be explicitly specified just like the openrc init script does. Additionally, I had a look at the source code to see what the switch -D does, aside from disabling forking to the background. It appears that without it, tincd installs signal handlers for SIGSEGV, SIGBUS and SIGILL that cause tincd to restart itself. Thus, if we are to use the -D switch (which is the preferred mode for systemd) I would recommend to add a "Restart=on-failure" in the [Service] section as Pacho implicitly suggested.
Created attachment 357482 [details] systemd unit file for tincd A unit file based on my above remarks.
(In reply to redneb from comment #12) > Created attachment 357482 [details] > systemd unit file for tincd > > A unit file based on my above remarks. I assume this unit file addresses both issues, correct?
(In reply to Anthony Basile from comment #13) > I assume this unit file addresses both issues, correct? Yes.
(In reply to redneb from comment #14) > (In reply to Anthony Basile from comment #13) > > I assume this unit file addresses both issues, correct? > > > Yes. I added the updated unit file to the tree with a rev bump to -r2. Let me know if everything is okay now.
Looks good now