znc.service.in only works with ~/.znc #627

Closed
opened 2026-10-05 04:34:19 +02:00 by adam · 43 comments
Owner

...which will fail on all systems where znc USER has its HOME set to /dev/null. of course one could override this with /etc/systemd/system/znc.service/override.conf but that's a just a workaround. that is "works out of box" for systemd is broken.

...which will fail on all systems where znc USER has its HOME set to /dev/null. of course one could override this with /etc/systemd/system/znc.service/override.conf but that's a just a workaround. that is "works out of box" for systemd is broken. <!-- github-sync-id:112851606 -->
adam closed this issue 2026-10-05 04:34:19 +02:00
Author
Owner

I believe znc.service.in is intended to be used by people who compile ZNC and create accounts etc. by themselves.

Debian-based distributions simply don't include the file and only Gentoo users seem to have issues (which result in ping-ponging users between #gentoo and #znc as happened a few weeks/months ago).

I believe `znc.service.in` is intended to be used by people who compile ZNC and create accounts etc. by themselves. Debian-based distributions simply don't include the file and only Gentoo users seem to have issues (which result in ping-ponging users between #gentoo and #znc as happened a few weeks/months ago). <!-- github-comment-id:150298743 -->
Author
Owner

that's an argument for it being broken.

archlinux in fact uses znc.service.in and users have to do ridiculous things like:

usermod -s /bin/sh znc

before proceeding with configuration; fedora and debian have given up on it all together and provide their own service file and so on.

you on the other hand have installed znc under ~/.local/bin with znc having /home/znc as its HOME and probably think that's just genius but could please just leave this issue alone and enjoy your own phenomenal system?

that's an argument for it being broken. archlinux in fact uses znc.service.in and users have to do ridiculous things like: usermod -s /bin/sh znc before proceeding with configuration; fedora and debian have given up on it all together and provide their own service file and so on. you on the other hand have installed znc under ~/.local/bin with znc having /home/znc as its HOME and probably think that's just genius but could please just leave this issue alone and enjoy your own phenomenal system? <!-- github-comment-id:150305884 -->
Author
Owner

you on the other hand have installed znc under ~/.local/bin with znc having /home/znc as its HOME and probably think that's just genius but could please just leave this issue alone and enjoy your own phenomenal system?

based on this I suggest you to read the documentation. $HOME/.local/ is recommended as not-root install location and if I did global installation, I would have to give root access to not-entirely-closed-out-future-ZNC-admins just so they could upgrade ZNC without me being there.

> you on the other hand have installed znc under ~/.local/bin with znc having /home/znc as its HOME and probably think that's just genius but could please just leave this issue alone and enjoy your own phenomenal system? based on this I suggest you to read [the documentation](http://wiki.znc.in/). `$HOME/.local/` is recommended as not-root install location and if I did global installation, I would have to give root access to not-entirely-closed-out-future-ZNC-admins just so they could upgrade ZNC without me being there. <!-- github-comment-id:150324360 -->
Author
Owner

right, we are talking about global installation; your personal setting doesn't apply here.

right, we _are_ talking about global installation; your _personal_ setting doesn't apply here. <!-- github-comment-id:150332467 -->
Author
Owner

When you install to $HOME/.local, znc.service reflects that by changing @bindir@ to /home/<user>/.local/bin/znc.

In case you need more accurate link:

When you install to `$HOME/.local`, znc.service reflects that by changing `@bindir@` to `/home/<user>/.local/bin/znc`. In case you need more accurate link: - http://wiki.znc.in/Installation#Source_Tarball <!-- github-comment-id:150451627 -->
Author
Owner

On Thu, Oct 22, 2015 at 08:35:41PM -0700, Mikaela Suomalainen wrote:

When you install to $HOME/.local, znc.service reflects that by changing
@bindir@ to /home/<user>/.local/bin/znc.

no, that's only you who installs under ~/.local. and in any events for that
case it works. in fact so says the title of this ticket; read it again; now give
it minute... how are we doing? not yet? well take a deep breath; repeat. and
please get off this topic; why does this bother you so much. apparently it works
just fine for you. that should be good news, no? this is for cases where
znc.service.in does cover (or is not general enough for). again this issue
doesn't apply to you... so, find something else to do and goodbye.

On Thu, Oct 22, 2015 at 08:35:41PM -0700, Mikaela Suomalainen wrote: > When you install to `$HOME/.local`, znc.service reflects that by changing > `@bindir@` to `/home/<user>/.local/bin/znc`. no, that's only _you_ who installs under ~/.local. and in any events for _that_ case it works. in fact so says the title of this ticket; read it again; now give it minute... how are we doing? not yet? well take a deep breath; repeat. and please get off this topic; why does this bother you so much. apparently it works just fine for you. that should be good news, no? this is for cases where znc.service.in does cover (or is not general enough for). again this issue doesn't apply to you... so, find something else to do and goodbye. <!-- github-comment-id:150468891 -->
Author
Owner

So... we should remove znc.systemd.in again, I guess, because there is no way for this file to be useful to the general public. Anyone who wants to use znc needs to configure it somehow and this systemd service doesn't provide any obvious/sane way to set up the config.

So... we should remove `znc.systemd.in` again, I guess, because there is no way for this file to be useful to the general public. Anyone who wants to use znc needs to configure it somehow and this systemd service doesn't provide any obvious/sane way to set up the config. <!-- github-comment-id:150496920 -->
Author
Owner

@nbebout Does Fedora use this file? If so, how?

2015-10-23 8:29 GMT+01:00 Uli Schlachter notifications@github.com:

So... we should remove znc.systemd.in again, I guess, because there is no
way for this file to be useful to the general public. Anyone who wants to
use znc needs to configure it somehow and this systemd service doesn't
provide any obvious/sane way to set up the config.

—
Reply to this email directly or view it on GitHub
https://github.com/znc/znc/issues/1165#issuecomment-150496920.

@nbebout Does Fedora use this file? If so, how? 2015-10-23 8:29 GMT+01:00 Uli Schlachter notifications@github.com: > So... we should remove znc.systemd.in again, I guess, because there is no > way for this file to be useful to the general public. Anyone who wants to > use znc needs to configure it somehow and this systemd service doesn't > provide any obvious/sane way to set up the config. > > — > Reply to this email directly or view it on GitHub > https://github.com/znc/znc/issues/1165#issuecomment-150496920. <!-- github-comment-id:150506278 -->
Author
Owner

There is also clone of that service at http://wiki.znc.in/Running_ZNC_as_a_system_daemon#Create_the_systemd_script with a little more instructions. I will change it a little as it seems to be missing some essential information:

  • where the unit should be put without root?
  • how do I start this unit?
  • how do I start this unit on boot?

Edit: Issues fixed: http://wiki.znc.in/Running_ZNC_as_a_system_daemon#systemd

There is also clone of that service at http://wiki.znc.in/Running_ZNC_as_a_system_daemon#Create_the_systemd_script with a little more instructions. I will change it a little as it seems to be missing some essential information: - where the unit should be put without root? - how do I start this unit? - how do I start this unit on boot? Edit: Issues fixed: http://wiki.znc.in/Running_ZNC_as_a_system_daemon#systemd <!-- github-comment-id:150561059 -->
Author
Owner

what is wrong with shipping a default setting under /etc ? passing that config file to znc in znc.service could be a start (just an idea).

however this is where things are headed as far as systemd is concerned:
http://0pointer.net/blog/projects/stateless.html

"In the long run we hope that packages can be fixed so that they always work correctly without configuration in /etc. Depending on the software this means that they should come with compiled-in defaults that just work should their configuration file be missing, or that they should fall back to static vendor-supplied configuration in /usr that is used whenever /etc doesn't have any configuration. Both the PAM and the D-Bus case are probably candidates for the latter. Given that there are probably many cases like this we are working with a number of folks to introduce a new directory called /usr/share/etc (name is not settled yet) to major distributions, that always contain the full, original, vendor-supplied configuration of all packages. This is very useful here, so that there's an obvious place to copy the original configuration from, but it is also useful completely independently as this provides administrators with an easy place to diff their own configuration in /etc against to see what local changes are in place."

what is wrong with shipping a default setting under /etc ? passing that config file to znc in znc.service could be a start (just an idea). however this is where things are headed as far as systemd is concerned: http://0pointer.net/blog/projects/stateless.html "In the long run we hope that packages can be fixed so that they always work correctly without configuration in /etc. Depending on the software this means that they should come with compiled-in defaults that just work should their configuration file be missing, or that they should fall back to static vendor-supplied configuration in /usr that is used whenever /etc doesn't have any configuration. Both the PAM and the D-Bus case are probably candidates for the latter. Given that there are probably many cases like this we are working with a number of folks to introduce a new directory called /usr/share/etc (name is not settled yet) to major distributions, that always contain the full, original, vendor-supplied configuration of all packages. This is very useful here, so that there's an obvious place to copy the original configuration from, but it is also useful completely independently as this provides administrators with an easy place to diff their own configuration in /etc against to see what local changes are in place." <!-- github-comment-id:150565057 -->
Author
Owner

Well, znc provides no services to the local system, but only to the network. So a static config would mean e.g. a login of "root" and "password". That's obviously a bad idea, because then everyone can log in (just as its bad for MySQL to have default logins...).

Edit: The only things that ZNC really needs is a port to listen on (we can easily provide a default here) and a valid login (nope, no default).
Also, having ZNC only reachable from localhost but then with a default login is likely a bad idea, too.

Well, znc provides no services to the local system, but only to the network. So a static config would mean e.g. a login of "root" and "password". That's obviously a bad idea, because then everyone can log in (just as its bad for MySQL to have default logins...). Edit: The only things that ZNC really needs is a port to listen on (we can easily provide a default here) and a valid login (nope, no default). Also, having ZNC only reachable from localhost but then with a default login is likely a bad idea, too. <!-- github-comment-id:150569189 -->
Author
Owner

On Fri, Oct 23, 2015 at 06:22:19AM -0700, Uli Schlachter wrote:

Well, znc provides no services to the local system, but only to the network.
So a static config would mean e.g. a login of "root" and "password".

no it doesn't. you do have a default USER; znc.

On Fri, Oct 23, 2015 at 06:22:19AM -0700, Uli Schlachter wrote: > Well, znc provides no services to the local system, but only to the network. > So a static config would mean e.g. a login of "root" and "password". no it doesn't. you do have a default USER; znc. <!-- github-comment-id:150588232 -->
Author
Owner

No, ZNC doesn't create any default user. That's up to the distro (and to
the human user)

2015-10-23 15:21 GMT+01:00 jrun notifications@github.com:

On Fri, Oct 23, 2015 at 06:22:19AM -0700, Uli Schlachter wrote:

Well, znc provides no services to the local system, but only to the
network.
So a static config would mean e.g. a login of "root" and "password".

no it doesn't. you do have a default USER; znc.

—
Reply to this email directly or view it on GitHub
https://github.com/znc/znc/issues/1165#issuecomment-150588232.

No, ZNC doesn't create any default user. That's up to the distro (and to the human user) 2015-10-23 15:21 GMT+01:00 jrun notifications@github.com: > On Fri, Oct 23, 2015 at 06:22:19AM -0700, Uli Schlachter wrote: > > > Well, znc provides no services to the local system, but only to the > > network. > > So a static config would mean e.g. a login of "root" and "password". > > no it doesn't. you do have a default USER; znc. > > — > Reply to this email directly or view it on GitHub > https://github.com/znc/znc/issues/1165#issuecomment-150588232. <!-- github-comment-id:150591314 -->
Author
Owner

On Fri, Oct 23, 2015 at 07:33:07AM -0700, Alexey Sokolov wrote:

No, ZNC doesn't create any default user. That's up to the distro (and to
the human user)

look into znc.service.in:

User = znc

On Fri, Oct 23, 2015 at 07:33:07AM -0700, Alexey Sokolov wrote: > No, ZNC doesn't create any default user. That's up to the distro (and to > the human user) look into znc.service.in: User = znc <!-- github-comment-id:150594749 -->
Author
Owner

On Fri, Oct 23, 2015 at 07:33:07AM -0700, Alexey Sokolov wrote:

No, ZNC doesn't create any default user. That's up to the distro (and to
the human user)

not technically; true. it's what package managers do... but there is an implicit
assumption that znc user will be created on the system.

On Fri, Oct 23, 2015 at 07:33:07AM -0700, Alexey Sokolov wrote: > No, ZNC doesn't create any default user. That's up to the distro (and to > the human user) not technically; true. it's what package managers do... but there is an implicit assumption that znc user will be created on the system. <!-- github-comment-id:150594959 -->
Author
Owner

there is an implicit assumption that znc user will be created on the system.

If and only if the znc.service file is installed. That 'znc.service.in' file doesn't get installed when you build/install ZNC from source, nor does it do that for a lot of the package managers (which don't ship ZNC as a service). You're grasping at straws which aren't issues at this point. The only implicit assumption is if you are reading this 'included service file' which may exist in the repository but it is not installed by the make or make install steps. It's included as an 'example', yes, but the example on its own does not make any implicit assumption. (I read all .in files typically as included examples, not actual for-use service files unless you know more about what you're doing, really.)

> there is an implicit assumption that znc user will be created on the system. If and only if the znc.service file is installed. That 'znc.service.in' file doesn't get installed when you build/install ZNC from source, nor does it do that for a lot of the package managers (which don't ship ZNC as a service). You're grasping at straws which aren't issues at this point. The only implicit assumption is if you are reading this 'included service file' which may exist in the repository but it **is not installed** by the `make` or `make install` steps. It's included as an 'example', yes, but the example on its own does not make any implicit assumption. (I read all `.in` files typically as included examples, not actual for-use service files unless you know more about what you're doing, really.) <!-- github-comment-id:150598942 -->
Author
Owner

On Fri, Oct 23, 2015 at 07:59:47AM -0700, Thomas Ward wrote:

If and only if the znc.service file is installed. That 'znc.service.in' file
doesn't get installed when you build/install ZNC from source, nor does it do
that for a lot of the package managers (which don't ship ZNC as a service).
You're grasping at straws which aren't issues at this point. The only
implicit assumption is if you are reading this 'included service file' which
may exist in the repository but it is not installed by the make or make install steps. It's included as an 'example', yes, but the example on its
own does not make any implicit assumption. (I read all .in files typically
as included examples, not actual for-use service files unless you know more
about what you're doing, really.)

sure, znc.service.in is just for illustration purposes; now how about shipping
one that's actually useful should distros downstream decide to use it. mind you
that some distros downstream do use znc.service.in. some, seems to me, have
given up and write their own.

On Fri, Oct 23, 2015 at 07:59:47AM -0700, Thomas Ward wrote: > If and only if the znc.service file is installed. That 'znc.service.in' file > doesn't get installed when you build/install ZNC from source, nor does it do > that for a lot of the package managers (which don't ship ZNC as a service). > You're grasping at straws which aren't issues at this point. The only > implicit assumption is if you are reading this 'included service file' which > may exist in the repository but it **is not installed** by the `make` or `make > install` steps. It's included as an 'example', yes, but the example on its > own does not make any implicit assumption. (I read all `.in` files typically > as included examples, not actual for-use service files unless you know more > about what you're doing, really.) sure, znc.service.in is just for illustration purposes; now how about shipping one that's actually useful should distros downstream decide to use it. mind you that some distros downstream do use znc.service.in. some, seems to me, have given up and write their own. <!-- github-comment-id:150606291 -->
Author
Owner

@257 What would a useful example look like? Which distros have useful examples?

The only thing that comes to my mind is adding --datadir /etc/znc to the command line, but that makes it IMO just harder to use this (users have to guess that they have to run sudo znc --datadir /etc/znc --makeconf). And something like ConditionPathIsDirectory=/etc/znc may make it more obvious that a config has to be created first, but still doesn't provide any hint on how to do that. (Or AssertPathIsDirectory?)

@257 What would a useful example look like? Which distros have useful examples? The only thing that comes to my mind is adding `--datadir /etc/znc` to the command line, but that makes it IMO just harder to use this (users have to guess that they have to run `sudo znc --datadir /etc/znc --makeconf`). And something like `ConditionPathIsDirectory=/etc/znc` may make it more obvious that a config has to be created first, but still doesn't provide any hint on how to do that. (Or `AssertPathIsDirectory`?) <!-- github-comment-id:150775443 -->
Author
Owner

It should be /var/lib/znc instead of /etc/znc, according to
https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

2015-10-24 9:30 GMT+01:00 Uli Schlachter notifications@github.com:

@257 https://github.com/257 What would a useful example look like?
Which distros have useful examples?

The only thing that comes to my mind is adding --datadir /etc/znc to the
command line, but that makes it IMO just harder to use this (users have to
guess that they have to run sudo znc --datadir /etc/znc --makeconf). And
something like ConditionPathIsDirectory=/etc/znc may make it more obvious
that a config has to be created first, but still doesn't provide any hint
on how to do that. (Or AssertPathIsDirectory?)

—
Reply to this email directly or view it on GitHub
https://github.com/znc/znc/issues/1165#issuecomment-150775443.

It should be /var/lib/znc instead of /etc/znc, according to https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard 2015-10-24 9:30 GMT+01:00 Uli Schlachter notifications@github.com: > @257 https://github.com/257 What would a useful example look like? > Which distros have useful examples? > > The only thing that comes to my mind is adding --datadir /etc/znc to the > command line, but that makes it IMO just harder to use this (users have to > guess that they have to run sudo znc --datadir /etc/znc --makeconf). And > something like ConditionPathIsDirectory=/etc/znc may make it more obvious > that a config has to be created first, but still doesn't provide any hint > on how to do that. (Or AssertPathIsDirectory?) > > — > Reply to this email directly or view it on GitHub > https://github.com/znc/znc/issues/1165#issuecomment-150775443. <!-- github-comment-id:150777229 -->
Author
Owner

--datadir /etc/znc/ would next bring issues that:

  • /etc/znc/modules doesn't belong to /etc
  • moddata doesn't belong to /etc
  • and what else there is...

I think systemd units allow comments starting with # so that could be used as a solution to this issue.

`--datadir /etc/znc/` would next bring issues that: - `/etc/znc/modules` doesn't belong to /etc - moddata doesn't belong to /etc - and what else there is... I think systemd units allow comments starting with `#` so that could be used as a solution to this issue. <!-- github-comment-id:150779317 -->
Author
Owner

Random idea: Use znc --datadir %i in the systemd unit. %i is the instance name and so the user is "forced" to provide the datadir. They would then have to do something like systemctl enable znc@/etc/znc to use this. Of course, the problem of "how is this documented in a useful fashion"?

Random idea: Use `znc --datadir %i` in the systemd unit. `%i` is the instance name and so the user is "forced" to provide the datadir. They would then have to do something like `systemctl enable znc@/etc/znc` to use this. Of course, the problem of "how is this documented in a useful fashion"? <!-- github-comment-id:155436339 -->
Author
Owner

@psychon did you see #1166? I am wondering if it's OK or if I should implement your idea.

@DarthGandalf didn't express opinion at IRC when asked (unless the opinion was that it also was offtopic for #znc-dev which didn't help).

@psychon did you see #1166? I am wondering if it's OK or if I should implement your idea. @DarthGandalf didn't express opinion at IRC when asked (unless the opinion was that it also was offtopic for #znc-dev which didn't help). <!-- github-comment-id:155450903 -->
Author
Owner

I saw #1166 and don't have any opinion on it. Also, abusing %i like this might count as ugly....
It was just an idea. I don't even know if it works.

I saw #1166 and don't have any opinion on it. Also, abusing %i like this might count as ugly.... It was just an idea. I don't even know if it works. <!-- github-comment-id:155491323 -->
Author
Owner

This is probably the point where I ask for any better ideas? 😄

This is probably the point where I ask for any better ideas? :smile: <!-- github-comment-id:155492863 -->
Author
Owner

On Tue, Nov 10, 2015 at 09:12:45AM -0800, Uli Schlachter wrote:

I saw #1166 and don't have any opinion on it. Also, abusing %i like this might count as ugly....
It was just an idea. I don't even know if it works.

it does work but yes it's ugly.

On Tue, Nov 10, 2015 at 09:12:45AM -0800, Uli Schlachter wrote: > I saw #1166 and don't have any opinion on it. Also, abusing %i like this might count as ugly.... > It was just an idea. I don't even know if it works. it does work but yes it's ugly. <!-- github-comment-id:155498595 -->
Author
Owner

Should I create a new issue "znc.service.in only works with /var/lib/znc"?

As it was previously, it worked just fine, including automatic creation of users.
Regardless of how the user is created, the home folder is "/var/lib/znc" (or anything else), then ZNC can just write to "/var/lib/znc/.znc" and that's totally fine.

As it is now, the behavior is indeed hardcoded and wrong and is going to break people's setups.

Should I create a new issue "znc.service.in only works with /var/lib/znc"? As it was previously, it worked just fine, including automatic creation of users. Regardless of how the user is created, the home folder is "/var/lib/znc" (**or anything else**), then ZNC can just write to "/var/lib/znc/.znc" and that's totally fine. As it is now, the behavior is indeed hardcoded and wrong and is going to break people's setups. <!-- github-comment-id:156865694 -->
Author
Owner

Urgh.

If no packager comments anything about this, I'll remove this file from the repo again, as in 0a049664fb

@nbebout @Philantrop (anyone else uses it? @seblu @Barthalion @TingPing)

Urgh. If no packager comments anything about this, I'll remove this file from the repo again, as in 0a049664fb671768bdf8f4cadfecbe486af46039 @nbebout @Philantrop (anyone else uses it? @seblu @Barthalion @TingPing) <!-- github-comment-id:156867211 -->
Author
Owner

With 1.6.1 the service file was working great. It is used in official Arch Linux package without any modifications.
https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/znc

With 1.6.1 the service file was working great. It is used in official Arch Linux package without any modifications. https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/znc <!-- github-comment-id:156867458 -->
Author
Owner

As @BlaXpirit says, we're using it as is (I think one of points for single init in many distributions is using the same service, isn't it?). Our package creates a znc user with /var/lib/znc home.

As @BlaXpirit says, we're using it as is (I think one of points for single init in many distributions is using the same service, isn't it?). Our package creates a znc user with /var/lib/znc home. <!-- github-comment-id:156867607 -->
Author
Owner

…and looking at current version of the service in git, it is incompatible with previous behavior. Usage of --datadir looks good to me though, so we will just handle it on package side.

…and looking at current version of the service in git, it is incompatible with previous behavior. Usage of --datadir looks good to me though, so we will just handle it on package side. <!-- github-comment-id:156867781 -->
Author
Owner

@Barthalion ok, thanks...

If you guys (packagers) all agree on how this file should look like, I'm fine with it too.

@Barthalion ok, thanks... If you guys (packagers) all agree on how this file should look like, I'm fine with it too. <!-- github-comment-id:156874532 -->
Author
Owner

I think there were two wrong move with the znc.service recently.

  1. the unit should not require network-online.target but network.target. znc does require network stack to be setup, not to be configured. It starts and connects to irc servers when each network paths become available, no need to depend on something else.
  2. to make the systemd service unit generic, we should keep it without the path of the datadir and rely on the default paths defined in the znc binary (which is ~/.znc).

I don't understand the rational behind this bug report. The ~/.znc is the default datadir, if it's not good, that's not the systemd unit which have to be changed. Moreover, the previous systemd service file worked out of the box when a properly znc user is setup. The point about the chmod in Arch Linux is completly irrevelent.
Maybe there is one upstream systemd file missing to create the znc user which can be added.

@DarthGandalf So my reading is to revert commits 43f2253f2d and 28f7f57666 and close this bug report as wont fix.

Nonetheless, there is no problem managing the unit downstream, I already added a systemd specific file to create the znc user, but as @Barthalion says, it would be better if systemd files go in znc tree.

I think there were two wrong move with the `znc.service` recently. 1. the unit should not require `network-online.target` but `network.target`. znc **does** require network stack to be setup, not to be configured. It starts and connects to irc servers when each network paths become available, no need to depend on something else. 2. to make the _systemd service unit_ generic, we should keep it without the path of the datadir and rely on the default paths defined in the znc binary (which is `~/.znc`). I don't understand the rational behind this bug report. The `~/.znc` is the default datadir, if it's not good, that's not the systemd unit which have to be changed. Moreover, the previous systemd service file **worked out of the box** when a properly znc user is setup. The point about the `chmod` in Arch Linux is completly irrevelent. Maybe there is one upstream [systemd file](https://projects.archlinux.org/svntogit/community.git/tree/trunk/znc.sysusers?h=packages/znc) missing to create the znc user which can be added. @DarthGandalf So my reading is to revert commits 43f2253f2ddc71269220f053778cbec876670886 and 28f7f576664ecd2d2f1eba7b49ce5fa81b899a18 and close this bug report as wont fix. Nonetheless, there is no problem managing the unit downstream, I already added a systemd specific file to create the znc user, but as @Barthalion says, it would be better if systemd files go in znc tree. <!-- github-comment-id:156880251 -->
Author
Owner

On Sun, Nov 15, 2015 at 04:54:07PM -0800, Sébastien Luttringer wrote:

I don't understand the rational behind this bug report. The ~/.znc is
the default datadir, if it's not good, that's not the systemd unit which
have to be changed.

that's the implication behind this bug. the way config file location is
handled is just, well, different? that's where the real problem is. it
doesn't lend itself to generalisation if like.

On Sun, Nov 15, 2015 at 04:54:07PM -0800, Sébastien Luttringer wrote: > I don't understand the rational behind this bug report. The `~/.znc` is > the default datadir, if it's not good, that's not the systemd unit which > have to be changed. that's the implication behind this bug. the way config file location is handled is just, well, different? that's where the real problem is. it doesn't lend itself to generalisation if like. <!-- github-comment-id:156888087 -->
Author
Owner

@DarthGandalf: I completely agree with @seblu's comment here. Things were correct before and those two commits he referenced should be reverted.

This bug is invalid; the distro used by @257 needs to properly set up the ZNC user.

We're coming from the bad old times where every distro did things differently and admins had to memorise how things were done for each of them. Nowadays, we're standardising things - starting with service files, configuration file locations, etc.

Let's not make this more complicated because one person or distro gets it wrong.

@DarthGandalf: I completely agree with @seblu's comment here. Things were correct before and those two commits he referenced should be reverted. This bug is invalid; the distro used by @257 needs to properly set up the ZNC user. We're coming from the bad old times where every distro did things differently and admins had to memorise how things were done for each of them. Nowadays, we're standardising things - starting with service files, configuration file locations, etc. Let's not make this more complicated because one person or distro gets it wrong. <!-- github-comment-id:156919883 -->
Author
Owner

znc does require network stack to be setup, not to be configured

Except if configuration of a listener limits it to some specific host. Listening on 127.0.0.1 and on 0.0.0.0 probably doesn't need network to be configured, but listening on something more explicitly external (e.g. 198.51.100.20 or 2001:db8:12::a2) needs it, I think... At least until #431 is fixed (see also #617)

I don't see how single znc.service file can support both cases (listening on everything with network.target vs listening on some specific host with network-online.target), as listeners are configured at runtime and stored in znc.conf. Does systemd (or any other init) support querying a program for its current dependencies based on its configuration?

> znc does require network stack to be setup, not to be configured Except if configuration of a listener limits it to some specific host. Listening on 127.0.0.1 and on 0.0.0.0 probably doesn't need network to be configured, but listening on something more explicitly external (e.g. 198.51.100.20 or 2001:db8:12::a2) needs it, I think... At least until #431 is fixed (see also #617) I don't see how single `znc.service` file can support both cases (listening on everything with `network.target` vs listening on some specific host with `network-online.target`), as listeners are configured at runtime and stored in `znc.conf`. Does systemd (or any other init) support querying a program for its current dependencies based on its configuration? <!-- github-comment-id:156952727 -->
Author
Owner

the unit should not require network-online.target but network.target. znc does require network stack to be setup, not to be configured. It starts and connects to irc servers when each network paths become available, no need to depend on something else.

How does ZNC connect to networks with network stack up, but without it having external connectivity? I believe majority of ZNC users use it to connect to not-localhost networks.

> the unit should not require network-online.target but network.target. znc does require network stack to be setup, not to be configured. It starts and connects to irc servers when each network paths become available, no need to depend on something else. How does ZNC connect to networks with network stack up, but without it having external connectivity? I believe majority of ZNC users use it to connect to not-localhost networks. <!-- github-comment-id:156969539 -->
Author
Owner

On Tue, Nov 10, 2015 at 06:35:24AM -0800, Uli Schlachter wrote:

Random idea: Use znc --datadir %i in the systemd unit. %i is the
instance name and so the user is "forced" to provide the datadir. They
would then have to do something like systemctl enable znc@/etc/znc to
use this. Of course, the problem of "how is this documented in a useful
fashion"?

%f seems more suited for this; 'man systemd.unit'

so for:
znc --datadir %f

one does 'systemctl enable znc@etc/znc'

or even this might work if znc is specified as the user running the daemon:
znc --datadir %f/%u

'systemctl enable znc@etc'
or
'systemctl enable znc@var/lib'

On Tue, Nov 10, 2015 at 06:35:24AM -0800, Uli Schlachter wrote: > Random idea: Use `znc --datadir %i` in the systemd unit. `%i` is the > instance name and so the user is "forced" to provide the datadir. They > would then have to do something like `systemctl enable znc@/etc/znc` to > use this. Of course, the problem of "how is this documented in a useful > fashion"? %f seems more suited for this; 'man systemd.unit' so for: znc --datadir %f one does 'systemctl enable znc@etc/znc' or even this might work if znc is specified as the user running the daemon: znc --datadir %f/%u 'systemctl enable znc@etc' or 'systemctl enable znc@var/lib' <!-- github-comment-id:159000344 -->
Author
Owner

@DarthGandalf If we look what is done elsewhere, almost all units are scheduled after network.target and don't use network-online.target. In particular, nginx, apache, postgres are servers which listen on network like znc and don't pull network-online.target.

The best way to manage this, is from the developer point of view. He has to make his software support dynamic IP. Either using IP_FREEBIND socket option, either watching rtnetlink (more complex).

The other way is a system configuration, which doesn't require software to be dynamic. The network manager ensure network is fully setup before reaching network.target. This is done by enabling wait online units from your network manager.
Examples:

systemctl enable NetworkManager-wait-online.service
systemctl enable systemd-networkd-wait-online.service

I think the rational behind that is the few number of configurations using IP in binding. Instead of slow down all servers startup, when the admin needs to do that, he has to force network to be fully online.

@257 Service instances are used to run multiple instance of the same service at the same time. Not to configure a path.
It's expected to be done either by

  1. overriding the unit (new way)
  2. loading the path from a EnvironmentFile=-/etc/default/xxx directive. (old way)
@DarthGandalf If we look what is done elsewhere, almost all units are scheduled after `network.target` and don't use `network-online.target`. In particular, _nginx_, _apache_, _postgres_ are servers which listen on network like _znc_ and don't pull `network-online.target`. The best way to manage this, is from the developer point of view. He has to make his software support dynamic IP. Either using IP_FREEBIND socket option, either watching rtnetlink (more complex). The other way is a system configuration, **which doesn't require software to be dynamic**. The _network manager_ ensure network is fully setup before reaching `network.target`. This is done by enabling _wait online_ units from your _network manager_. Examples: ``` systemctl enable NetworkManager-wait-online.service ``` ``` systemctl enable systemd-networkd-wait-online.service ``` I think the rational behind that is the few number of configurations using IP in binding. Instead of slow down all servers startup, when the admin needs to do that, he has to force network to be fully online. @257 Service **instances** are used to run multiple **instance** of the same service at the same time. Not to configure a path. It's expected to be done either by 1. overriding the unit (new way) 2. loading the path from a `EnvironmentFile=-/etc/default/xxx` directive. (old way) <!-- github-comment-id:159006828 -->
Author
Owner

On Mon, Nov 23, 2015 at 09:40:10AM -0800, Sébastien Luttringer wrote:

@257 Service instances are used to run multiple instance of the
same service at the same time. Not to configure a path.

don't think so; have a look at these two units:
system/systemd-fsck@.service
system/systemd-hibernate-resume@.service

and like i mentioned, have a look at systemd.unit manual:

"%f"

Unescaped filename

This is either the unescaped instance name (if applicable) with / prepended
(if applicable), or the prefix name

It's expected to be done either by

  1. overriding the unit (new way)
    that (overriding) is my current set up for but it's not general.
On Mon, Nov 23, 2015 at 09:40:10AM -0800, Sébastien Luttringer wrote: > @257 Service **instances** are used to run multiple **instance** of the > same service at the same time. Not to configure a path. don't think so; have a look at these two units: system/systemd-fsck@.service system/systemd-hibernate-resume@.service and like i mentioned, have a look at systemd.unit manual: ## "%f" ## Unescaped filename This is either the unescaped instance name (if applicable) with / prepended (if applicable), or the prefix name > It's expected to be done either by > 1. overriding the unit (new way) > that (overriding) is my current set up for but it's not general. <!-- github-comment-id:159014565 -->
Author
Owner

In particular, nginx, apache, postgres are servers which listen on network like znc and don't pull network-online.target.

As far as I am aware, these services don't usually connect to other hosts unless working as reverse proxy and on postgres I am not fully sure (I have faint idea of it being a database server).

I repeat https://github.com/znc/znc/issues/1165#issuecomment-156969539: How does ZNC connect to networks with network stack up, but without it having external connectivity? I believe majority of ZNC users use it to connect to not-localhost networks.

> In particular, nginx, apache, postgres are servers which listen on network like znc and don't pull network-online.target. As far as I am aware, these services don't usually connect to other hosts unless working as reverse proxy and on postgres I am not fully sure (I have faint idea of it being a database server). I repeat https://github.com/znc/znc/issues/1165#issuecomment-156969539: _How does ZNC connect to networks with network stack up, but without it having external connectivity? I believe majority of ZNC users use it to connect to not-localhost networks._ <!-- github-comment-id:159154580 -->
Author
Owner

@Mikaela ZNC will try to connect until network is finally fully up. No need to delay startup though.

@Mikaela ZNC will try to connect until network is finally fully up. No need to delay startup though. <!-- github-comment-id:159188635 -->
Author
Owner

On Mon, Nov 23, 2015 at 01:06:39PM -0500, 257 wrote:

On Mon, Nov 23, 2015 at 09:40:10AM -0800, Sébastien Luttringer wrote:

@257 Service instances are used to run multiple instance of the
same service at the same time. Not to configure a path.

don't think so; have a look at these two units:
system/systemd-fsck@.service
system/systemd-hibernate-resume@.service

and like i mentioned, have a look at systemd.unit manual:

"%f"

Unescaped filename

This is either the unescaped instance name (if applicable) with / prepended
(if applicable), or the prefix name

It's expected to be done either by

  1. overriding the unit (new way)
    that (overriding) is my current set up for but it's not general.

yep, works just fine here. in fact those ugly forward slashes get
translated to hyphen:

. znc@var-lib.service - ZNC, an advanced IRC bouncer
Loaded: loaded (/etc/systemd/system/znc@.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2015-11-24 13:12:57 EST; 2min 16s ago
Main PID: 710 (znc)
CGroup: /system.slice/system-znc.slice/znc@var-lib.service
└─710 /usr/bin/znc -D -d /var/lib/znc

znc@.service:
[Unit]
Description=ZNC, an advanced IRC bouncer
After=network.target

[Service]
User=znc
ExecStart=/usr/bin/znc -f -d %f/%u

[Install]
WantedBy=multi-user.target

ran this:
systemctl enable znc@var/lib.service

of course you could also do:
systemctl enable znc@etc.service

given /etc/znc exist etc. next, look into tmpfiles.d(5) and RTFA i posted
early on about 'where things are headed'.

On Mon, Nov 23, 2015 at 01:06:39PM -0500, 257 wrote: > On Mon, Nov 23, 2015 at 09:40:10AM -0800, Sébastien Luttringer wrote: > > > @257 Service **instances** are used to run multiple **instance** of the > > same service at the same time. Not to configure a path. > > don't think so; have a look at these two units: > system/systemd-fsck@.service > system/systemd-hibernate-resume@.service > > and like i mentioned, have a look at systemd.unit manual: > > ## "%f" > > ## Unescaped filename > > This is either the unescaped instance name (if applicable) with / prepended > (if applicable), or the prefix name > > > It's expected to be done either by > > 1. overriding the unit (new way) > > that (overriding) is my current set up for but it's not general. yep, works just fine here. in fact those _ugly_ forward slashes get translated to hyphen: . znc@var-lib.service - ZNC, an advanced IRC bouncer Loaded: loaded (/etc/systemd/system/znc@.service; disabled; vendor preset: enabled) Active: active (running) since Tue 2015-11-24 13:12:57 EST; 2min 16s ago Main PID: 710 (znc) CGroup: /system.slice/system-znc.slice/znc@var-lib.service └─710 /usr/bin/znc -D -d /var/lib/znc znc@.service: [Unit] Description=ZNC, an advanced IRC bouncer After=network.target [Service] User=znc ExecStart=/usr/bin/znc -f -d %f/%u [Install] WantedBy=multi-user.target ran this: systemctl enable znc@var/lib.service of course you could also do: systemctl enable znc@etc.service given /etc/znc exist etc. next, look into tmpfiles.d(5) and RTFA i posted early on about 'where things are headed'. <!-- github-comment-id:159361865 -->
Author
Owner

@257: Yes, it works and it's still wrong and abuse.

@257: Yes, it works and it's still wrong and abuse. <!-- github-comment-id:159393080 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#627