Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] looking for a couple of systemd units
Date: Tue, 27 Aug 2013 14:48:07
Message-Id: CADPrc80E7hiAU8wnHhYu1YhZT_vhmfLux5j1h=Z3LD4npBvhTA@mail.gmail.com
In Reply to: Re: [gentoo-user] looking for a couple of systemd units by covici@ccs.covici.com
1 On Tue, Aug 27, 2013 at 9:41 AM, <covici@××××××××××.com> wrote:
2 > Canek Peláez Valdés <caneko@×××××.com> wrote:
3 >
4 >> On Tue, Aug 27, 2013 at 2:46 AM, <covici@××××××××××.com> wrote:
5 >> > Canek Peláez Valdés <caneko@×××××.com> wrote:
6 >> >
7 >> >> On Tue, Aug 27, 2013 at 1:10 AM, <covici@××××××××××.com> wrote:
8 >> >> > Canek Peláez Valdés <caneko@×××××.com> wrote:
9 >> >> >
10 >> >> >> On Mon, Aug 26, 2013 at 11:06 PM, Canek Peláez Valdés <caneko@×××××.com> wrote:
11 >> >> >> > On Mon, Aug 26, 2013 at 10:52 PM, <covici@××××××××××.com> wrote:
12 >> >> >> >> Hi. I am looking for a couple of systemd units which I have not been
13 >> >> >> >> able to find -- one for mailman and one for innd which is a shell script
14 >> >> >> >> by itself.
15 >> >> >> >>
16 >> >> >> >> Thanks in advance for any suggestions.
17 >> >> >> >
18 >> >> >> > I use this one in production for mailman with Gentoo:
19 >> >> >> >
20 >> >> >> > ----------------------------------------------------------------
21 >> >> >> > [Unit]
22 >> >> >> > Description=Mailman mailing list service
23 >> >> >> > After=network.target
24 >> >> >> >
25 >> >> >> > [Service]
26 >> >> >> > Type=forking
27 >> >> >> > ExecStart=/usr/lib/mailman/bin/mailmanctl -s start
28 >> >> >> > ExecStop=/usr/lib/mailman/bin/mailmanctl stop
29 >> >> >> > User=mailman
30 >> >> >> > Group=mailman
31 >> >> >> >
32 >> >> >> > [Install]
33 >> >> >> > WantedBy=multi-user.target
34 >> >> >> > ----------------------------------------------------------------
35 >> >> >> >
36 >> >> >> > I don't have any for innd.
37 >> >> >>
38 >> >> >> If innd is the one from net-nntp/inn, then the following should work:
39 >> >> >>
40 >> >> >> ----------------------------------------------------------------
41 >> >> >> [Unit]
42 >> >> >> Description=The Internet News daemon
43 >> >> >> Documentation=man:innd(8)
44 >> >> >> ConditionPathExists=/var/run/news
45 >> >> >>
46 >> >> >> [Service]
47 >> >> >> Type=simple
48 >> >> >> ExecStart=/usr/lib/news/bin/rc.news
49 >> >> >> ExecStop=/usr/lib/news/bin/rc.news stop
50 >> >> >> User=news
51 >> >> >> Group=news
52 >> >> >>
53 >> >> >> [Install]
54 >> >> >> WantedBy=multi-user.target
55 >> >> >> ----------------------------------------------------------------
56 >> >> >>
57 >> >> >> If the binary rc.news forks itself (and there is no option to force it
58 >> >> >> to run in the foreground), use Type=forking. The former is preferred
59 >> >> >> over the latter. Also, to guarantee that the directory /var/run/news
60 >> >> >> always is present, add the following to a new file
61 >> >> >> /etc/tmpfiles.d/innd.conf:
62 >> >> >>
63 >> >> >> ----------------------------------------------------------------
64 >> >> >> d /var/run/news 0755 news news 10d -
65 >> >> >> ----------------------------------------------------------------
66 >> >> >>
67 >> >> >> You can replace 10d with - (hypen), so the directory is never cleaned
68 >> >> >> automatically. If you try this unit and it works as expected, please
69 >> >> >> let us know.
70 >> >> >>
71 >> >> >
72 >> >> > OK, thanks again. I have one question which this brings up -- and this
73 >> >> > applies to openrc as well -- I never have let it migrate /var/run to
74 >> >> > /run and /var/lock likewise because I have directories in those which
75 >> >> > are owned by various users, etc. and the packages themselves almost
76 >> >> > never create such -- is putting things in /etc/tmpfiles.d the correct
77 >> >> > way to fix this?
78 >> >>
79 >> >> tmpfiles.d is from systemd:
80 >> >>
81 >> >> http://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
82 >> >>
83 >> >> However, I think OpenRC developers were thinking about supporting it.
84 >> >> I don't know if that actually happened.
85 >> >>
86 >> >> With systemd in Gentoo, /var/run is bind mounted from /run, and it's a
87 >> >> tmpfs dir, so everything there goes away after a reboot. The config
88 >> >> files in tmpfiles.d allows the creation (and automatic removal) of
89 >> >> directories and files there.
90 >> >>
91 >> >> I don't know if it's the "correct" way to fix anything; but it works.
92 >> >>
93 >> > Can I use the d action to change the permissions of an existing
94 >> > directory and if not, how can I do this?
95 >>
96 >> I don't think so. The contents of /run (and /var/run before it) are,
97 >> by definition, used only at run time. They are not intended to be
98 >> preserved, and they actually should be cleaned from time to time
99 >> (hence the age field in tmpfiles.d). Therefore tmpfiles.d only deals
100 >> with creation (and cleaning up) of files/directories, not "updating"
101 >> them, since they should not be even present when the system boots up.
102 >>
103 >> The files in /etc/tmpfiles.d are used by the systemd-tmpfiles-* units,
104 >> and (AFAIU) they only create files/directories at boot time, and then
105 >> only clean afterwards.
106 >>
107 >> My /run directory is really empty. When my systems boot up, systemd
108 >> mounts a tmpfs on it:
109 >>
110 >> # mount | grep "on /run"
111 >> tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
112 >>
113 >> Then the var-run.mount unit binds mount /run into /var/run. So no
114 >> file/directory there is actually written into any physical disk ever.
115 >
116 > But I need to change the permissions of /var/lock to 777, if I can't use
117 > tmpfiles.d how can I do this?
118
119 chmod 777 /var/lock? I don't understand the question. What program do
120 you need that requires universal writing access for /var/lock? In my
121 systems, /var/lock is either bind mounted from /run/lock, or a soft
122 link to /run/lock, and /run/lock is root:root and 755.
123
124 Regards.
125 --
126 Canek Peláez Valdés
127 Posgrado en Ciencia e Ingeniería de la Computación
128 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] looking for a couple of systemd units covici@××××××××××.com