The environment file /etc/conf.d was removed from the systemd service and ExecStart appears with hardcoded "--datadir=/var/lib/znc". I just changed the znc.service into the following that works as expected: # /lib/systemd/system/znc.service [Unit] Description=ZNC, an advanced IRC bouncer After=network.target [Service] EnvironmentFile=/etc/conf.d/znc ExecStart=/usr/bin/znc -f User=znc [Install] WantedBy=multi-user.target
Just realized that the user is also defined in /etc/conf.d/znc file. So znc.service could be like this: # /lib/systemd/system/znc.service [Unit] Description=ZNC, an advanced IRC bouncer After=network.target [Service] EnvironmentFile=/etc/conf.d/znc ExecStart=/usr/bin/znc -f [Install] WantedBy=multi-user.target
Referring to conf.d files in systemd units is prohibited. https://wiki.gentoo.org/wiki/Project:Systemd/Ebuild_policy#Unit_file_guidelines
I understand the reasons presented there for distribution and administration management, trying to keep things more clear. But regarding znc, the software is not prepared to manage their configurations the same way. I would need to add a systemd drop-in to add the Environment=ZNC_DATADIR="/var/lib/znc", since when service is started this way creates .znc directory inside /var/lib/znc. When starting znc with the flag as it is being done now, znc reads configuration file directly from /var/lib/znc directory. So maybe we have here an upstream bug to report, since to comply with current Gentoo management policies we need to use daemon flags and not environment files.
Created the following bug report: https://github.com/znc/znc/issues/1837
It seem that the environment variable is defined by the ebuild and not from upstream https://gitweb.gentoo.org/repo/gentoo.git/tree/net-irc/znc/files/znc.confd-r1 This broke the setup for systemd unit configuration.
Hi, As I replied on your upstream issue, I don't see how we "broke" anything. Our systemd service never supported an environment file. At some point, upstream changed the default datadir so I added a check to warn users in the ebuild. Overriding unit files is quite easy and the conf.d file is only meant for OpenRC users so I'm not sure what you would like for us or upstream to change.
It seems that this issue was solved in upstream since it was not a common behavior to have a service with its configurations files loaded from .znc. This was already reviewed on previous issue that Louis just pointed out on github issue. *** This bug has been marked as a duplicate of bug 743856 ***