Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] looking for a couple of systemd units "Canek Peláez Valdés" <caneko@×××××.com>