Different behavior when setting configuration directory #1015

Closed
opened 2026-10-05 04:58:37 +02:00 by adam · 3 comments
Owner

Gentoo changed its policy for loading configuration into systemd units. Referring to conf.d files in systemd units is prohibited:
https://wiki.gentoo.org/wiki/Project:Systemd/Ebuild_policy#Unit_file_guidelines

Previous configuration:

# /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

New configuration:

# /lib/systemd/system/znc.service
[Unit]
Description=ZNC, an advanced IRC bouncer
After=network.target

[Service]
ExecStart=/usr/bin/znc -f --datadir=/var/lib/znc
User=znc

[Install]
WantedBy=multi-user.target

This change broke the previous installation because, when using environment variables from conf.d, znc loads configuration files from /var/lib/znc/.znc, but, when using --datadir, znc loads configuration from /var/lib/znc. Maybe this happens because the environment file was never used.

I would ask for znc development team to advise the best solution for keeping systemd unit regarding those concerns.

Gentoo changed its policy for loading configuration into systemd units. Referring to conf.d files in systemd units is prohibited: https://wiki.gentoo.org/wiki/Project:Systemd/Ebuild_policy#Unit_file_guidelines Previous configuration: ``` # /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 ``` New configuration: ``` # /lib/systemd/system/znc.service [Unit] Description=ZNC, an advanced IRC bouncer After=network.target [Service] ExecStart=/usr/bin/znc -f --datadir=/var/lib/znc User=znc [Install] WantedBy=multi-user.target ``` This change broke the previous installation because, when using environment variables from conf.d, znc loads configuration files from /var/lib/znc/.znc, but, when using `--datadir`, znc loads configuration from /var/lib/znc. Maybe this happens because the environment file was never used. I would ask for znc development team to advise the best solution for keeping systemd unit regarding those concerns. <!-- github-sync-id:1368764319 -->
adam closed this issue 2026-10-05 04:58:37 +02:00
Author
Owner

It seems that the environment variable I mentioned before it is defined by the ebuild and not from upstream:
https://gitweb.gentoo.org/repo/gentoo.git/tree/net-irc/znc/files/znc.confd-r1

Also the following instructions are being provided by ebuild maintainer:
https://gitweb.gentoo.org/repo/gentoo.git/tree/net-irc/znc/znc-1.8.2-r2.ebuild#n158

It seems that the environment variable I mentioned before it is defined by the ebuild and not from upstream: https://gitweb.gentoo.org/repo/gentoo.git/tree/net-irc/znc/files/znc.confd-r1 Also the following instructions are being provided by ebuild maintainer: https://gitweb.gentoo.org/repo/gentoo.git/tree/net-irc/znc/znc-1.8.2-r2.ebuild#n158 <!-- github-comment-id:1242827960 -->
Author
Owner

Hi @samuelbernardo,

Previous configuration:

AFAICT there never was a systemd unit with EnvironmentFile=/etc/conf.d/znc, in Gentoo or znc upstream.

Have you read the bug mentioned in the ebuild? The one which is also mentioned in d4bfd143b4 (https://bugs.gentoo.org/743856).

Hi @samuelbernardo, > Previous configuration: AFAICT there never was a systemd unit with `EnvironmentFile=/etc/conf.d/znc`, in Gentoo or znc upstream. Have you read the bug mentioned in the ebuild? The one which is also mentioned in d4bfd143b4b12f6e6695878cc1b5168cc31c362c (https://bugs.gentoo.org/743856). <!-- github-comment-id:1242828635 -->
Author
Owner

Hi @sbraz
I wasn't aware of that bug... Going to close this issue. Thanks for pointing that out.

Hi @sbraz I wasn't aware of that bug... Going to close this issue. Thanks for pointing that out. <!-- github-comment-id:1242828927 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#1015