Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 479596 - net-misc/tinc- add a systemd unit file
Summary: net-misc/tinc- add a systemd unit file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: install-systemd-unit
  Show dependency tree
 
Reported: 2013-08-03 05:30 UTC by redneb
Modified: 2013-08-31 11:58 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
systemd unit file for tincd (tincd@.service,161 bytes, text/plain)
2013-08-03 05:30 UTC, redneb
Details
tinc-1.0.22-r1.ebuild (tinc-1.0.22.ebuild,1.26 KB, text/plain)
2013-08-30 21:16 UTC, Pacho Ramos
Details
tincd_at.service (tincd_at.service,151 bytes, text/plain)
2013-08-30 21:17 UTC, Pacho Ramos
Details
systemd unit file for tincd (tincd@.service,197 bytes, text/plain)
2013-08-31 02:57 UTC, redneb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description redneb 2013-08-03 05:30:04 UTC
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.
Comment 1 Pacho Ramos gentoo-dev 2013-08-20 09:32:12 UTC
I will review, test and commit it in a week if nobody disagrees. Thanks
Comment 2 Anthony Basile gentoo-dev 2013-08-20 11:36:42 UTC
(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.
Comment 3 Pacho Ramos gentoo-dev 2013-08-30 20:16:39 UTC
How can I test it? (how should I launch this @ service?) Thanks
Comment 4 Anthony Basile gentoo-dev 2013-08-30 20:51:15 UTC
(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.
Comment 5 redneb 2013-08-30 21:09:03 UTC
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
Comment 6 Pacho Ramos gentoo-dev 2013-08-30 21:16:27 UTC
Created attachment 357464 [details]
tinc-1.0.22-r1.ebuild
Comment 7 Pacho Ramos gentoo-dev 2013-08-30 21:17:03 UTC
Created attachment 357466 [details]
tincd_at.service

This are the files I have prepared and installed, locally, can you confirm they work as intended?
Comment 8 redneb 2013-08-30 21:56:31 UTC
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.
Comment 9 Pacho Ramos gentoo-dev 2013-08-30 21:59:24 UTC
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)
Comment 10 Anthony Basile gentoo-dev 2013-08-31 00:01:20 UTC
(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.
Comment 11 redneb 2013-08-31 02:54:41 UTC
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.
Comment 12 redneb 2013-08-31 02:57:16 UTC
Created attachment 357482 [details]
systemd unit file for tincd

A unit file based on my above remarks.
Comment 13 Anthony Basile gentoo-dev 2013-08-31 03:41:38 UTC
(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?
Comment 14 redneb 2013-08-31 03:49:26 UTC
(In reply to Anthony Basile from comment #13)
> I assume this unit file addresses both issues, correct?


Yes.
Comment 15 Anthony Basile gentoo-dev 2013-08-31 10:18:24 UTC
(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.
Comment 16 redneb 2013-08-31 11:56:01 UTC
Looks good now