Gentoo Archives: gentoo-amd64

From: Marc Joliet <marcec@×××.de>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] Systemd migration: opinion and questions
Date: Fri, 27 Feb 2015 22:30:14
Message-Id: 20150227232958.318090a3@marcec.fritz.box
In Reply to: Re: [gentoo-amd64] Systemd migration: opinion and questions by Marc Joliet
1 Am Wed, 25 Feb 2015 23:42:20 +0100
2 schrieb Marc Joliet <marcec@×××.de>:
3
4 > Am Wed, 25 Feb 2015 00:11:18 +0100
5 > schrieb Marc Joliet <marcec@×××.de>:
6 >
7 > [...]
8 > > What was more difficult was getting it to depend on the right network target
9 > > properly. The same "Requires" line that worked for samba and cups fails with
10 > > "failed to add dependency" type errors:
11 > >
12 > > Feb 24 21:20:01 marcec systemd[540]: Cannot add dependency job for unit
13 > > mpd.service, ignoring: Unit netctl@×××××××××.service failed to load: No such file or directory.
14 > >
15 > > So apparently user units can't "Require" system units? However, adding a
16 > > symlink from the service unit in /etc to .../mpd.service.requires/ solved that
17 > > problem, but yielded a new one:
18 > >
19 > > Feb 24 23:26:49 marcec network[2200]: netctl needs root privileges
20 > >
21 > > Oh, well... Maybe it would work with systemd-networkd?
22 > [...]
23 >
24 > FWIW, I found this earlier today:
25 > http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/, which even has
26 > its own FAQ entry (guess I should have found it earlier, then). Systemd has a
27 > network-online.target, which looks like what I want(ed). I'm too tired to try it
28 > now, but I'll do so tomorrow.
29
30 OK, I looked at this today and it turns out that the way I reconfigured mpd (to
31 use 'bind_to_address "any"') is not only a simpler way to express what I had
32 already configured it to do anyway, but is also in line with the recommendations
33 in the above article (in the last section "What does this mean for me, a
34 Developer?").
35
36 That article also pointed me to the correct solution for my cups and dovecot
37 socket units: what one *should* do when one wants/has to listen to a particular
38 address is set "FreeBind=true", which allows the bind to succeed even if the
39 address is not configured yet. This is obviously much better than trying to
40 meddle with dependencies as I was doing above.
41
42 (Current versions (i.e., ~arch) of MPD ship a socket unit, so one can use
43 FreeBind there, too, if necessary.)
44
45 --
46 Marc Joliet
47 --
48 "People who think they know everything really annoy those of us who know we
49 don't" - Bjarne Stroustrup