Re: Systemd migration: opinion and questions

Marc Joliet <[email protected]> Fri, 27 Feb 2015 23:29:58 +0100
Newsgroups gmane.linux.gentoo.amd64
Message-ID <[email protected]>
Am Wed, 25 Feb 2015 23:42:20 +0100
schrieb Marc Joliet <[email protected]>:

> Am Wed, 25 Feb 2015 00:11:18 +0100
> schrieb Marc Joliet <[email protected]>:
> 
> [...]
> > What was more difficult was getting it to depend on the right network target
> > properly.  The same "Requires" line that worked for samba and cups fails with
> > "failed to add dependency" type errors:
> > 
> >     Feb 24 21:20:01 marcec systemd[540]: Cannot add dependency job for unit
> >     mpd.service, ignoring: Unit [email protected] failed to load: No such file or directory.
> > 
> > So apparently user units can't "Require" system units? However, adding a
> > symlink from the service unit in /etc to .../mpd.service.requires/ solved that
> > problem, but yielded a new one:
> > 
> >     Feb 24 23:26:49 marcec network[2200]: netctl needs root privileges
> > 
> > Oh, well... Maybe it would work with systemd-networkd?
> [...]
> 
> FWIW, I found this earlier today:
> http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/, which even has
> its own FAQ entry (guess I should have found it earlier, then).  Systemd has a
> network-online.target, which looks like what I want(ed). I'm too tired to try it
> now, but I'll do so tomorrow.

OK, I looked at this today and it turns out that the way I reconfigured mpd (to
use 'bind_to_address "any"') is not only a simpler way to express what I had
already configured it to do anyway, but is also in line with the recommendations
in the above article (in the last section "What does this mean for me, a
Developer?").

That article also pointed me to the correct solution for my cups and dovecot
socket units:  what one *should* do when one wants/has to listen to a particular
address is set "FreeBind=true", which allows the bind to succeed even if the
address is not configured yet.  This is obviously much better than trying to
meddle with dependencies as I was doing above.

(Current versions (i.e., ~arch) of MPD ship a socket unit, so one can use
FreeBind there, too, if necessary.)

-- 
Marc Joliet