1 |
> On Sat, Feb 22, 2014 at 6:16 PM, <thegeezer@×××××××××.net> wrote: |
2 |
>> OK so because of how much time has been spent arguing about systemd with |
3 |
>> little technical content, i've spent some time on the freedesktop site |
4 |
>> reading Lennart's blog and also going through the source to find answers |
5 |
>> to my questions about the socket activator. |
6 |
>> i've also been going through the man pages of netctl too and am |
7 |
>> horrified |
8 |
>> at the lack of what i would call enterprise features. |
9 |
> |
10 |
> networkd (netctl is just the command-line front-end) is not intended |
11 |
> for enterprise; it's for little servers where you only need static IPs |
12 |
> or simple bridges. For desktops/laptops, you are supposed to keep |
13 |
> using NetworkManager/connman/whatever you used before. For complex |
14 |
> network setups, you need *a* network manager (not necessarily |
15 |
> NetworkManager). |
16 |
> |
17 |
>> this is by no means a definitive list. |
18 |
>> I just thought that i would share what i had found. |
19 |
>> please correct me if i am wrong in any of these. |
20 |
>> please add to the list for technical items only. |
21 |
> |
22 |
> I find it a very impartial and objective review; thank you very much! |
23 |
> |
24 |
>> thanks! |
25 |
>> |
26 |
>> pros |
27 |
>> 1.very modular, everything can be disabled though not removed |
28 |
>> 2.socket based activator allows restart of services with no service |
29 |
>> interruption |
30 |
>> 3.if activator.c is used for this, then the code is actually pretty |
31 |
>> clean |
32 |
>> using supplied sd-daemon.c simplifies sockets for daemons and also adds |
33 |
>> extra watchdog features |
34 |
>> 4.can disable socket based activation according to Canek, but i can't |
35 |
>> find |
36 |
>> how. |
37 |
> |
38 |
> You use a .service unit file instead of a .socket unit file. That's it. |
39 |
> |
40 |
|
41 |
thanks good to know that is all you need |
42 |
|
43 |
> For OpenSSH, for example, you can enable sshd.service[1], and then the |
44 |
> SSH daemon works as it does in OpenRC. If you instead enable |
45 |
> sshd.socket[2], then the daemon will start on demand. |
46 |
> |
47 |
> You don't have to *disable* anything; you choose how do you want to |
48 |
> use your services (if the services provide both ways, like OpenSSH |
49 |
> does). |
50 |
> |
51 |
>> 5.fschecking mounts and logging output (though how for corrupt / |
52 |
>> notsure) |
53 |
> |
54 |
> Corrupt filesystems or logs? |
55 |
> |
56 |
|
57 |
logs. currently if fsck runs anywhere on boot i get zero log about what |
58 |
was done, so i prefer to do this on a running system. / is obviously |
59 |
special, so this is a pro that fsck is logged, but of course if / has |
60 |
issue i'm not sure what systemd would do other than drop you to emergency |
61 |
|
62 |
>> 6.auto-gettys allows for lower numbered X windows by default for e.g. |
63 |
>> multiseat and dynamic serial ttys |
64 |
>> 7.clever logging, including from nspawned containers' logs and |
65 |
>> distributed |
66 |
>> for enterprise |
67 |
>> 8.nspawning using filename namespaces |
68 |
>> 9.systemctl kill <service> -- killing service and all forks and spawn |
69 |
>> cgtop -- top with cgroups |
70 |
>> 10.much easier to define resource limitations per service |
71 |
>> |
72 |
>> cons |
73 |
>> 1.new tools to learn, new gotchas to learn. |
74 |
>> 2.yet to go through systemd source to find out how modular or not it is. |
75 |
> |
76 |
> While it tries to be modular where it can, systemd prefers simple code |
77 |
> and integrated solutions. Modularity is not going to be one of its |
78 |
> strong points. |
79 |
> |
80 |
>> 3.not clear how the socket activator works, the code activator.c appears |
81 |
>> to be to _test_ activation only, with activator code being elsewhere. |
82 |
>> if |
83 |
>> it is used then you would have one process running for each port it is |
84 |
>> virtually listened to. |
85 |
> |
86 |
> It's been a while since I've read the source code, but it isn't in |
87 |
> src/activate/activate.c[3]? |
88 |
|
89 |
ok so it does look like it would have a systemd-activate process for each |
90 |
socket being activated on behalf of a service. that makes me feel better |
91 |
than one process doing all of them. perhaps someone using service |
92 |
activation can do a 'ps aux' to confirm? |
93 |
|
94 |
>> 4./etc/machine-id because hostname and node id in the <cluster of your |
95 |
>> choice> are not enough. |
96 |
> |
97 |
> The idea is that machine-id is as unique as reasonable to ask. I'm not |
98 |
> overly happy with it, too, but that's the justification. |
99 |
> |
100 |
> Imagine thousands of virtual machines running services, and you want |
101 |
> to coalesce all their journal logs in a central server. With |
102 |
> machine-id, you don't need to worry even to change the default |
103 |
> "localhost" for your throwaway VMs, you can detect the different logs |
104 |
> immediately (machine-id should be generated at OS install time; for |
105 |
> rolling distros, I think they generate it if when installing systemd |
106 |
> is not available.) |
107 |
> |
108 |
>> 5./fsck.options gives more options than "auto""force""skip" on reboot |
109 |
>> 6.requiring logging tools in rescue cds in order to view logs |
110 |
> |
111 |
> Yeah, that's a drag. However, you *can* run rsyslog (or syslog-ng) |
112 |
> alongside the journal, and have the best of both worlds. Or you can |
113 |
> automatically send the journal logs to a central server designed for |
114 |
> that purpose only. |
115 |
> |
116 |
>> 7.chroots no longer work. forcing use of nspawn to ensure environment |
117 |
>> set |
118 |
>> up correctly. |
119 |
> |
120 |
> I'm sorry, chroot doesn't work? First time I heard about it. While |
121 |
> systemd-nspawn is a gazillion times better than a simple chroot, you |
122 |
> *can* still use a chroot if you so desire. Where did you found that |
123 |
> chroot doesn't works? |
124 |
|
125 |
agreed nspawn is better due to the filesystem namespaces. chroot itself |
126 |
works, but the environment doesn't so it is effectively broken. full |
127 |
explaination from lennart's blog [5] This is quite old so i don't know if |
128 |
this has been fixed, seems unlikely based on what he described |
129 |
|
130 |
>> 8.strange gotchas: that because of socket/dbus etc activation you have |
131 |
>> to |
132 |
>> disable a service first, then stop it in case it is then restarted in |
133 |
>> the |
134 |
>> background |
135 |
> |
136 |
> You only need to stop the socket too. You can do it at the same time: |
137 |
> |
138 |
> systemctl stop avahi-daemon.service avahi-daemon.socket |
139 |
> |
140 |
|
141 |
good to know |
142 |
|
143 |
>> 9.the new deal breaker for me is the networking. |
144 |
>> for anything remotely complex (i.e. two IP addresses on an interface |
145 |
>> woo), |
146 |
>> need to use netctl. |
147 |
>> a.which doesn't support vlan naming types i.e. padding zeroes |
148 |
>> b.doesn't appear to support gre keys |
149 |
>> c.doesn't appear to support multiple routing tables |
150 |
>> d.doesn't appear to support "ip rule" |
151 |
>> e.doesn't have lacp support for bonding |
152 |
>> f.there is the option for running a script in PRE and POST UP but...no |
153 |
> |
154 |
> networkd (again, netctl is the command-line front-end) is not for |
155 |
> enterprise networks; on the contrary, is for the trivial cases. For |
156 |
> example, in a little web server I administer I have: |
157 |
> |
158 |
> $ cat /etc/systemd/system/network.service |
159 |
> [Unit] |
160 |
> Description=Static network service |
161 |
> After=local-fs.target |
162 |
> Before=network.target |
163 |
> Documentation=man:ifconfig(8) |
164 |
> Documentation=man:route(8) |
165 |
> |
166 |
> [Service] |
167 |
> Type=oneshot |
168 |
> RemainAfterExit=yes |
169 |
> ExecStart=/bin/ifconfig enp2s12 192.168.1.2 broadcast 192.168.1.255 |
170 |
> netmask 255.255.255.0 up |
171 |
> ExecStart=/bin/route add default gw 192.168.1.1 enp2s12 |
172 |
> |
173 |
> [Install] |
174 |
> WantedBy=multi-user.target |
175 |
> |
176 |
> (Yeah, I know, I should switch to ip, I'm sorry, I haven't had the time |
177 |
> yet). |
178 |
> |
179 |
> I'm going to get rid of this trivial network.service unit file when |
180 |
> 209 (or better 210) hits Gentoo. Cases like this are the use-cases for |
181 |
> networkd. |
182 |
> |
183 |
|
184 |
what i don't understand is if you look at how openRC does it, it only |
185 |
really cares about up/down events and the /etc/conf.d/net is very |
186 |
comprehensive, in part because it passes everything to iproute2 to handle, |
187 |
the only thing i can't do without an additional shell script is tc qdiscs. |
188 |
i don't need or want a network manager, just need something that applies |
189 |
confs on startup / stop of interfaces. I'm a little surprised that there |
190 |
isn't an iproute2 .service file |
191 |
|
192 |
reading through your example, in fact this is preferrable to me than using |
193 |
a network manager but using iproute2. I would rather you keep this |
194 |
example in, and have this shown on the wiki or somewhere as this neatly |
195 |
resolves my network concern. |
196 |
|
197 |
>> 10.strange gotchas: /tmp being tmpfs using up to 50% ram. unless |
198 |
>> mounted |
199 |
>> in fstab |
200 |
> |
201 |
> That doesn't have nothing to do with systemd: from man:mount(8): |
202 |
> |
203 |
> """ |
204 |
> Mount options for tmpfs |
205 |
> size=nbytes |
206 |
> Override default maximum size of the filesystem. |
207 |
> The size is given in bytes, and rounded up to entire pages. The |
208 |
> default is half of the memory. The size parameter also |
209 |
> accepts a suffix % to limit this tmpfs instance to that |
210 |
> percentage of your physical RAM: the default, when neither size nor |
211 |
> nr_blocks is specified, is size=50% |
212 |
> """ |
213 |
> |
214 |
> systemd just mounts the tmpfs; the default *is* 50%. |
215 |
> |
216 |
|
217 |
I was just highlighting because someone could be putting systemd on |
218 |
embedded and wondering why memory usage increased over time. no issue if |
219 |
you have 8GB+, but if you have 256MB is an issue, and if you have less you |
220 |
are counting every byte. |
221 |
|
222 |
>> 11.strange gotchas: logging is volatile by default _unless_ |
223 |
>> /var/log/journal exists, when it becomes persistent due to the "auto" |
224 |
>> default. |
225 |
> |
226 |
> It's by design; a distro can decide if it creates /var/log/journal or |
227 |
> nor for its users at install time. RHEL probably will; Ubuntu |
228 |
> (desktop) probably wont. |
229 |
> |
230 |
>> 12.transitions into systemd are non-trivial. |
231 |
> |
232 |
> No, they are not. |
233 |
|
234 |
i'm not talkign about new installs. for me the transition is not easy. |
235 |
most of my gentoo boxes are headless, and many are in far flung places. a |
236 |
migration into systemd would be a nightmare of repeatedly checking items |
237 |
to ensure the reboot would succeed remotely, and have a working network |
238 |
connection and working sshd. in a previous post i mentioned that i would |
239 |
need to do the following, requiring at least two reboots from gentoo wiki |
240 |
[4] |
241 |
.. new kernel options |
242 |
.. reboot |
243 |
.. new grub2 command line |
244 |
.. install dbus (use=-systemd) _then_ systemd |
245 |
.. create network.service as you have shown |
246 |
.. add grub secondary entry with systemd init and reboot |
247 |
.. would be nice to use an import for localed and hostnamed and timedated |
248 |
.. importing openrc services and runlevels to targets |
249 |
.. adjust syslog and systemd to work together |
250 |
also there are 'workarounds' for lvm early masking -- i use LVM everywhere |
251 |
and i wouldn't know which location would need this or if my boot was |
252 |
broken for another reason. |
253 |
|
254 |
a trivial migration would be |
255 |
# emerge systemd (auto removes openrc) |
256 |
# systemd-import-openrc (including network issues as mentioned in this post) |
257 |
# reboot |
258 |
|
259 |
> |
260 |
>> my own conclusions |
261 |
>> systemd seems to be excellent for a desktop |
262 |
>> good for _new_ instances of service VMs. I say new because of the large |
263 |
>> job of transitioning away from openRC, but all the watchdog and better |
264 |
>> resource management will help to pack datacentres. |
265 |
> |
266 |
> I agree. |
267 |
> |
268 |
>> It would also be good for big iron running many services because of |
269 |
>> this, |
270 |
>> but then i thought everyone was using small fast service specific gentoo |
271 |
>> VMs to compartmentalise anyway --- or was that just me? |
272 |
> |
273 |
> I think Gentoo users come in all sizes and shapes ;) |
274 |
> |
275 |
>> Unless I have completely got netctl wrong it is terrible for a |
276 |
>> firewall/router scenario, or being the host server for LXC containers |
277 |
>> which is a shame because resource management built in to service control |
278 |
>> combined with say docker.io would be a great combination; as long as you |
279 |
>> don't use custom VLAN settings. |
280 |
> |
281 |
> I think you got it wrong; it's just to fill the needs of simple |
282 |
> networks when you don't want all the bells and whistles of a big |
283 |
> network manager (not necessarily NetworkManager). |
284 |
> |
285 |
> BTW, Kay and Lennart Ok'd the inclusion of networkd (and they had |
286 |
> thought it was missing from systemd), but it was written by Tom |
287 |
> Gundersen, primarily. |
288 |
> |
289 |
|
290 |
I think actually that i would just create an iproute2 service file for |
291 |
each device. so have no network manager at all and have the service file |
292 |
start after the interface. iproute2.enp2s0.service etc |
293 |
in there i would have "exec=/sbin/ip rule add" etc |
294 |
i'd also have "exec=/sbin/ip addr add" etc |
295 |
|
296 |
>> As Gentoo is a meta-distro (says Larry the Cow |
297 |
>> http://www.gentoo.org/main/en/about.xml) and a rolling release distro, |
298 |
>> I'm |
299 |
>> all for choice, but I would sincerely hope that unlike all of the other |
300 |
>> distributions from Arch to Ubuntu systemd is not adopted by default as |
301 |
>> udev and baselayout transitions were bad enough. |
302 |
> |
303 |
> As a systemd supporter, at some point in the long, long future, I |
304 |
> would be more than happy if systemd was added to the handbook as |
305 |
> "secondary supported init system" in its own section. I'm completely |
306 |
> fine with OpenRC as the default. |
307 |
> |
308 |
|
309 |
that would be the ideal way forwards |
310 |
|
311 |
> Also (and I plan to work on this in the future), I would like to have |
312 |
> LiveCDs and stages with systemd installed (not necessarily hosted in |
313 |
> the Gentoo infrastructure), because is works really nicely install |
314 |
> Gentoo from systemd-nspawn instead of a chroot. |
315 |
> |
316 |
|
317 |
actually I agree - even if it is only to get journactl on a bootable cd! |
318 |
|
319 |
> Someone would have to do that, though; I hope to help with that in the |
320 |
> future. |
321 |
> |
322 |
|
323 |
to end on a merry note [6] and kind of why i wrote this |
324 |
|
325 |
>> I will however be installing a systemd desktop in a vm to play properly. |
326 |
>> YMMV |
327 |
> |
328 |
> Thanks again for a succinct, impartial and objective analysis of systemd. |
329 |
> |
330 |
|
331 |
very welcome, hope this helps others |
332 |
|
333 |
> Regards. |
334 |
> |
335 |
> [1] |
336 |
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/openssh/files/sshd.service?view=markup |
337 |
> [2] |
338 |
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/openssh/files/sshd.socket?view=markup |
339 |
> [3] http://cgit.freedesktop.org/systemd/systemd/tree/src/activate |
340 |
> -- |
341 |
> Canek Peláez Valdés |
342 |
> Posgrado en Ciencia e Ingeniería de la Computación |
343 |
> Universidad Nacional Autónoma de México |
344 |
> |
345 |
> |
346 |
|
347 |
[4] http://wiki.gentoo.org/wiki/Systemd |
348 |
[5] http://0pointer.de/blog/projects/changing-roots.html |
349 |
[6] |
350 |
http://allpoetry.com/poem/9326367-Everybody--Anybody--Somebody--Nobody-and-Someone-Else-by-YoungDumbCrazy |