Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 521916 - ZNC systemd unit tries to load znc config from /dev/null
Summary: ZNC systemd unit tries to load znc config from /dev/null
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Alex Alexander (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-01 22:45 UTC by Chandler Paul
Modified: 2016-03-21 13:37 UTC (History)
1 user (show)

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


Attachments
Patch for upstream systemd unit to honor the environment file (znc-1.4-r2-honor-environment-in-systemd-unit.patch,814 bytes, patch)
2014-09-01 22:45 UTC, Chandler Paul
Details | Diff
Updated ebuild (znc-1.4-r2-honor-environment-in-systemd-unit.patch,814 bytes, patch)
2014-09-01 22:45 UTC, Chandler Paul
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chandler Paul 2014-09-01 22:45:04 UTC
Created attachment 384080 [details, diff]
Patch for upstream systemd unit to honor the environment file

The systemd unit that comes with the ebuild for znc 1.4.1-r1 doesn't actually work. This is because the unit doesn't load the environment file from /etc/conf.d/znc, and as a result znc doesn't know where to load it's configuration from and tries to load it from /dev/null. I've updated the ebuild and added a patch that fixes the systemd unit.
Comment 1 Chandler Paul 2014-09-01 22:45:25 UTC
Created attachment 384082 [details, diff]
Updated ebuild
Comment 2 Chandler Paul 2014-09-01 22:46:13 UTC
Comment on attachment 384080 [details, diff]
Patch for upstream systemd unit to honor the environment file

>From 1ffc6293da1d8bf74273f6d4cd7b51a9a57a56cf Mon Sep 17 00:00:00 2001
>From: Stephen Chandler Paul <thatslyude@gmail.com>
>Date: Mon, 1 Sep 2014 18:01:41 -0400
>Subject: [PATCH] znc.service: Respect user enviornment
>
>By default the znc.service file provided doesn't load any environment
>file, leaving it broken on Gentoo systems (it tries to load the
>configuration from /dev/null)
>---
> znc.service | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/znc.service b/znc.service
>index 2f862bf..abbbbf0 100644
>--- a/znc.service
>+++ b/znc.service
>@@ -3,8 +3,9 @@ Description=ZNC, an advanced IRC bouncer
> After=network.target
> 
> [Service]
>-ExecStart=/usr/bin/znc -f
>+ExecStart=/usr/bin/znc -f -d $ZNC_CONF
> User=znc
>+EnvironmentFile=/etc/conf.d/znc
> 
> [Install]
> WantedBy=multi-user.target
>-- 
>1.8.5.5
>
Comment 3 Chandler Paul 2014-09-01 22:47:10 UTC
Apologies, I tried to fix a typo in the patch with the "edit as comment" feature and I guess it doesn't do what I had thought it does.

(In reply to Chandler Paul from comment #2)
> Comment on attachment 384080 [details, diff] [details, diff]
> Patch for upstream systemd unit to honor the environment file
> 
> >From 1ffc6293da1d8bf74273f6d4cd7b51a9a57a56cf Mon Sep 17 00:00:00 2001
> >From: Stephen Chandler Paul <thatslyude@gmail.com>
> >Date: Mon, 1 Sep 2014 18:01:41 -0400
> >Subject: [PATCH] znc.service: Respect user enviornment
> >
> >By default the znc.service file provided doesn't load any environment
> >file, leaving it broken on Gentoo systems (it tries to load the
> >configuration from /dev/null)
> >---
> > znc.service | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> >diff --git a/znc.service b/znc.service
> >index 2f862bf..abbbbf0 100644
> >--- a/znc.service
> >+++ b/znc.service
> >@@ -3,8 +3,9 @@ Description=ZNC, an advanced IRC bouncer
> > After=network.target
> > 
> > [Service]
> >-ExecStart=/usr/bin/znc -f
> >+ExecStart=/usr/bin/znc -f -d $ZNC_CONF
> > User=znc
> >+EnvironmentFile=/etc/conf.d/znc
> > 
> > [Install]
> > WantedBy=multi-user.target
> >-- 
> >1.8.5.5
> >
Comment 4 Louis Sautier (sbraz) gentoo-dev 2016-03-21 13:37:59 UTC
Hi, this is fixed in the ebuild for version 1.6.3 https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=942dfd926c80e680f564099f0b9535a2777c0245
The Environment approach is apparently frowned upon (see https://wiki.gentoo.org/wiki/Project:Systemd/conf.d_files) so I simply changed the znc user's home to /var/lib/znc without patching the systemd unit.
I have not tested this but it should make the files go to /var/lib/znc/.znc. While I agree that this looks a big redundant, this is what the upstream unit does.
If you want the systemd unit to be changed, I suggest you file a bug upstream (or edit the unit locally).