Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] technical review of systemd
Date: Sun, 23 Feb 2014 01:26:20
Message-Id: CADPrc832gm8h0-p_DQDHBuTeTQsOr-2KS6JJpPmAFMqqj7=c-A@mail.gmail.com
In Reply to: [gentoo-user] technical review of systemd by thegeezer@thegeezer.net
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 horrified
7 > at the lack of what i would call enterprise features.
8
9 networkd (netctl is just the command-line front-end) is not intended
10 for enterprise; it's for little servers where you only need static IPs
11 or simple bridges. For desktops/laptops, you are supposed to keep
12 using NetworkManager/connman/whatever you used before. For complex
13 network setups, you need *a* network manager (not necessarily
14 NetworkManager).
15
16 > this is by no means a definitive list.
17 > I just thought that i would share what i had found.
18 > please correct me if i am wrong in any of these.
19 > please add to the list for technical items only.
20
21 I find it a very impartial and objective review; thank you very much!
22
23 > thanks!
24 >
25 > pros
26 > 1.very modular, everything can be disabled though not removed
27 > 2.socket based activator allows restart of services with no service
28 > interruption
29 > 3.if activator.c is used for this, then the code is actually pretty clean
30 > using supplied sd-daemon.c simplifies sockets for daemons and also adds
31 > extra watchdog features
32 > 4.can disable socket based activation according to Canek, but i can't find
33 > how.
34
35 You use a .service unit file instead of a .socket unit file. That's it.
36
37 For OpenSSH, for example, you can enable sshd.service[1], and then the
38 SSH daemon works as it does in OpenRC. If you instead enable
39 sshd.socket[2], then the daemon will start on demand.
40
41 You don't have to *disable* anything; you choose how do you want to
42 use your services (if the services provide both ways, like OpenSSH
43 does).
44
45 > 5.fschecking mounts and logging output (though how for corrupt / notsure)
46
47 Corrupt filesystems or logs?
48
49 > 6.auto-gettys allows for lower numbered X windows by default for e.g.
50 > multiseat and dynamic serial ttys
51 > 7.clever logging, including from nspawned containers' logs and distributed
52 > for enterprise
53 > 8.nspawning using filename namespaces
54 > 9.systemctl kill <service> -- killing service and all forks and spawn
55 > cgtop -- top with cgroups
56 > 10.much easier to define resource limitations per service
57 >
58 > cons
59 > 1.new tools to learn, new gotchas to learn.
60 > 2.yet to go through systemd source to find out how modular or not it is.
61
62 While it tries to be modular where it can, systemd prefers simple code
63 and integrated solutions. Modularity is not going to be one of its
64 strong points.
65
66 > 3.not clear how the socket activator works, the code activator.c appears
67 > to be to _test_ activation only, with activator code being elsewhere. if
68 > it is used then you would have one process running for each port it is
69 > virtually listened to.
70
71 It's been a while since I've read the source code, but it isn't in
72 src/activate/activate.c[3]?
73
74 > 4./etc/machine-id because hostname and node id in the <cluster of your
75 > choice> are not enough.
76
77 The idea is that machine-id is as unique as reasonable to ask. I'm not
78 overly happy with it, too, but that's the justification.
79
80 Imagine thousands of virtual machines running services, and you want
81 to coalesce all their journal logs in a central server. With
82 machine-id, you don't need to worry even to change the default
83 "localhost" for your throwaway VMs, you can detect the different logs
84 immediately (machine-id should be generated at OS install time; for
85 rolling distros, I think they generate it if when installing systemd
86 is not available.)
87
88 > 5./fsck.options gives more options than "auto""force""skip" on reboot
89 > 6.requiring logging tools in rescue cds in order to view logs
90
91 Yeah, that's a drag. However, you *can* run rsyslog (or syslog-ng)
92 alongside the journal, and have the best of both worlds. Or you can
93 automatically send the journal logs to a central server designed for
94 that purpose only.
95
96 > 7.chroots no longer work. forcing use of nspawn to ensure environment set
97 > up correctly.
98
99 I'm sorry, chroot doesn't work? First time I heard about it. While
100 systemd-nspawn is a gazillion times better than a simple chroot, you
101 *can* still use a chroot if you so desire. Where did you found that
102 chroot doesn't works?
103
104 > 8.strange gotchas: that because of socket/dbus etc activation you have to
105 > disable a service first, then stop it in case it is then restarted in the
106 > background
107
108 You only need to stop the socket too. You can do it at the same time:
109
110 systemctl stop avahi-daemon.service avahi-daemon.socket
111
112 > 9.the new deal breaker for me is the networking.
113 > for anything remotely complex (i.e. two IP addresses on an interface woo),
114 > need to use netctl.
115 > a.which doesn't support vlan naming types i.e. padding zeroes
116 > b.doesn't appear to support gre keys
117 > c.doesn't appear to support multiple routing tables
118 > d.doesn't appear to support "ip rule"
119 > e.doesn't have lacp support for bonding
120 > f.there is the option for running a script in PRE and POST UP but...no
121
122 networkd (again, netctl is the command-line front-end) is not for
123 enterprise networks; on the contrary, is for the trivial cases. For
124 example, in a little web server I administer I have:
125
126 $ cat /etc/systemd/system/network.service
127 [Unit]
128 Description=Static network service
129 After=local-fs.target
130 Before=network.target
131 Documentation=man:ifconfig(8)
132 Documentation=man:route(8)
133
134 [Service]
135 Type=oneshot
136 RemainAfterExit=yes
137 ExecStart=/bin/ifconfig enp2s12 192.168.1.2 broadcast 192.168.1.255
138 netmask 255.255.255.0 up
139 ExecStart=/bin/route add default gw 192.168.1.1 enp2s12
140
141 [Install]
142 WantedBy=multi-user.target
143
144 (Yeah, I know, I should switch to ip, I'm sorry, I haven't had the time yet).
145
146 I'm going to get rid of this trivial network.service unit file when
147 209 (or better 210) hits Gentoo. Cases like this are the use-cases for
148 networkd.
149
150 > 10.strange gotchas: /tmp being tmpfs using up to 50% ram. unless mounted
151 > in fstab
152
153 That doesn't have nothing to do with systemd: from man:mount(8):
154
155 """
156 Mount options for tmpfs
157 size=nbytes
158 Override default maximum size of the filesystem.
159 The size is given in bytes, and rounded up to entire pages. The
160 default is half of the memory. The size parameter also
161 accepts a suffix % to limit this tmpfs instance to that
162 percentage of your physical RAM: the default, when neither size nor
163 nr_blocks is specified, is size=50%
164 """
165
166 systemd just mounts the tmpfs; the default *is* 50%.
167
168 > 11.strange gotchas: logging is volatile by default _unless_
169 > /var/log/journal exists, when it becomes persistent due to the "auto"
170 > default.
171
172 It's by design; a distro can decide if it creates /var/log/journal or
173 nor for its users at install time. RHEL probably will; Ubuntu
174 (desktop) probably wont.
175
176 > 12.transitions into systemd are non-trivial.
177
178 No, they are not.
179
180 > my own conclusions
181 > systemd seems to be excellent for a desktop
182 > good for _new_ instances of service VMs. I say new because of the large
183 > job of transitioning away from openRC, but all the watchdog and better
184 > resource management will help to pack datacentres.
185
186 I agree.
187
188 > It would also be good for big iron running many services because of this,
189 > but then i thought everyone was using small fast service specific gentoo
190 > VMs to compartmentalise anyway --- or was that just me?
191
192 I think Gentoo users come in all sizes and shapes ;)
193
194 > Unless I have completely got netctl wrong it is terrible for a
195 > firewall/router scenario, or being the host server for LXC containers
196 > which is a shame because resource management built in to service control
197 > combined with say docker.io would be a great combination; as long as you
198 > don't use custom VLAN settings.
199
200 I think you got it wrong; it's just to fill the needs of simple
201 networks when you don't want all the bells and whistles of a big
202 network manager (not necessarily NetworkManager).
203
204 BTW, Kay and Lennart Ok'd the inclusion of networkd (and they had
205 thought it was missing from systemd), but it was written by Tom
206 Gundersen, primarily.
207
208 > As Gentoo is a meta-distro (says Larry the Cow
209 > http://www.gentoo.org/main/en/about.xml) and a rolling release distro, I'm
210 > all for choice, but I would sincerely hope that unlike all of the other
211 > distributions from Arch to Ubuntu systemd is not adopted by default as
212 > udev and baselayout transitions were bad enough.
213
214 As a systemd supporter, at some point in the long, long future, I
215 would be more than happy if systemd was added to the handbook as
216 "secondary supported init system" in its own section. I'm completely
217 fine with OpenRC as the default.
218
219 Also (and I plan to work on this in the future), I would like to have
220 LiveCDs and stages with systemd installed (not necessarily hosted in
221 the Gentoo infrastructure), because is works really nicely install
222 Gentoo from systemd-nspawn instead of a chroot.
223
224 Someone would have to do that, though; I hope to help with that in the future.
225
226 > I will however be installing a systemd desktop in a vm to play properly.
227 > YMMV
228
229 Thanks again for a succinct, impartial and objective analysis of systemd.
230
231 Regards.
232
233 [1] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/openssh/files/sshd.service?view=markup
234 [2] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/openssh/files/sshd.socket?view=markup
235 [3] http://cgit.freedesktop.org/systemd/systemd/tree/src/activate
236 --
237 Canek Peláez Valdés
238 Posgrado en Ciencia e Ingeniería de la Computación
239 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] technical review of systemd thegeezer@×××××××××.net