Project

General

Profile

Status RPi3 20200526 » History » Version 1

lnussel, 2020-05-29 08:58

1 1 lnussel
# Status RPi3 20200526
2
3
Build 11.51, May 26th 2020
4
5
## Size
6
7
```
8
# rpm-sortbysize |tail -20
9
5660408 libsolv-tools
10
5737343 raspberrypi-firmware
11
5916442 file-magic
12
5996273 kbd
13
6016237 rpm
14
6530502 glibc
15
7195074 openssh
16
7774733 zypper
17
8034287 udev
18
8375418 gpg2
19
8457236 xtables-plugins
20
8533749 libzypp
21
9183861 util-linux
22
9620460 coreutils
23
13150058 systemd
24
25159592 grub2
25
27441111 glibc-locale-base
26
27863675 ignition
27
346060194 kernel-default
28
511097221 kernel-firmware
29
```
30
31
## Boot Times
32
Initial boot, network connected
33
```
34
# systemd-analyze
35
Startup finished in 42.032s (kernel) + 19.073s (initrd) + 24.977s (userspace) = 1min 26.084s
36
# systemd-analyze blame|head -20
37
         14.088s btrfsmaintenance-refresh.service
38
          7.666s wicked.service
39
          4.904s create-dirs-from-rpmdb.service
40
          4.554s dracut-initqueue.service
41
          3.808s dracut-pre-mount.service
42
          3.678s lvm2-monitor.service
43
          2.578s initrd-switch-root.service
44
          2.263s systemd-journal-flush.service
45
          2.023s systemd-udev-settle.service
46
          1.744s systemd-logind.service
47
          1.741s kbdsettings.service
48
          1.225s systemd-remount-fs.service
49
          1.118s initrd-parse-etc.service
50
          1.028s dracut-cmdline.service
51
           986ms wickedd-auto4.service
52
           975ms wickedd-dhcp4.service
53
           970ms wickedd-dhcp6.service
54
           925ms rebootmgr.service
55
           786ms systemd-user-sessions.service
56
           746ms systemd-sysctl.service
57
# du -sh /boot/initrd-5.3.18-lp152.16-default
58
61M     /boot/initrd-5.3.18-lp152.16-default
59
```
60
61
The initrd is too big with 61MB. Let's rebuild it as the first boot one was created using --no-hostonly.
62
63
```
64
# mkinitrd
65
# du -sh /boot/initrd-5.3.18-lp152.16-default
66
23M     /boot/initrd-5.3.18-lp152.16-default
67
```
68
69
Remove kiwi dracut hooks and ignition as they are not needed after first boot and see the impact on initrd
70
71
```
72
# zypper rm dracut-kiwi-lib ignition ignition-dracut
73
# mkinitrd
74
# du -sh /boot/initrd-5.3.18-lp152.16-default 
75
12M     /boot/initrd-5.3.18-lp152.16-default
76
# reboot
77
# systemd-analyze 
78
Startup finished in 3.784s (kernel) + 7.243s (initrd) + 36.189s (userspace) = 47.217s
79
# systemd-analyze blame|head -20
80
         20.997s btrfsmaintenance-refresh.service
81
         14.378s wicked.service
82
          6.367s create-dirs-from-rpmdb.service
83
          5.909s lvm2-monitor.service
84
          4.429s systemd-journal-flush.service
85
          3.412s systemd-remount-fs.service
86
          3.094s systemd-modules-load.service
87
          2.684s systemd-udev-settle.service
88
          2.221s initrd-switch-root.service
89
          1.613s kbdsettings.service
90
          1.303s wickedd-auto4.service
91
          1.291s wickedd-dhcp6.service
92
          1.283s wickedd-dhcp4.service
93
           862ms rebootmgr.service
94
           661ms sshd.service
95
           646ms initrd-parse-etc.service
96
           597ms systemd-udev-trigger.service
97
           460ms chronyd.service
98
           405ms boot-efi.mount
99
           357ms systemd-udevd.service
100
```
101
102
That helped a lot. Remove obvious offenders too
103
104
```
105
# rpm -e btrfsmaintenance lvm2 --nodeps
106
# sed -i -e '/WAIT_FOR_INTERFACES/s/30/1/' /etc/sysconfig/network/config
107
# reboot
108
# systemd-analyze 
109
Startup finished in 3.774s (kernel) + 7.262s (initrd) + 19.238s (userspace) = 30.275s
110
# systemd-analyze blame|head -20
111
          5.190s create-dirs-from-rpmdb.service
112
          3.098s systemd-journal-flush.service
113
          2.903s systemd-udev-settle.service
114
          2.753s systemd-remount-fs.service
115
          2.471s systemd-modules-load.service
116
          2.038s initrd-switch-root.service
117
          1.856s wickedd-dhcp4.service
118
          1.846s wickedd-dhcp6.service
119
          1.818s wickedd-auto4.service
120
          1.150s wicked.service
121
          1.003s health-checker.service
122
           954ms rebootmgr.service
123
           765ms kbdsettings.service
124
           723ms boot-efi.mount
125
           700ms sshd.service
126
           696ms chronyd.service
127
           631ms initrd-parse-etc.service
128
           567ms systemd-udev-trigger.service
129
           542ms systemd-udevd.service
130
           462ms systemd-logind.service
131
# systemd-analyze critical-chain
132
The time after the unit is active or started is printed after the "@" character.
133
The time the unit takes to start is printed after the "+" character.
134
135
multi-user.target @19.111s
136
└─getty.target @18.505s
137
  └─getty@tty1.service @18.504s
138
    └─systemd-user-sessions.service @18.353s +132ms
139
      └─network.target @17.112s
140
        └─wicked.service @15.960s +1.150s
141
          └─wickedd-nanny.service @15.853s +100ms
142
            └─wickedd.service @15.743s +104ms
143
              └─wickedd-dhcp6.service @13.891s +1.846s
144
                └─dbus.service @12.479s
145
                  └─basic.target @12.464s
146
                    └─paths.target @12.463s
147
                      └─ca-certificates.path @12.463s
148
                        └─sysinit.target @12.459s
149
                          └─systemd-update-utmp.service @12.380s +77ms
150
                            └─auditd.service @12.169s +204ms
151
                              └─systemd-tmpfiles-setup.service @12.097s +68ms
152
                                └─create-dirs-from-rpmdb.service @6.902s +5.190s
153
                                  └─local-fs.target @6.880s
154
                                    └─boot-efi.mount @6.125s +723ms
155
                                      └─dev-disk-by\x2duuid-34A1\x2d7474.device @5.877s
156
```
157
158
create-dirs-from-rpmdb in Factory uses a cookie to check if the rpmdb actually changed. In 15 it runs always. So let's disable it. Also syncing of the journal to the SD card.
159
160
```
161
# systemctl disable create-dirs-from-rpmdb.service
162
# rpm -e systemd-logger --nodeps
163
# rm -rf /var/log/journal/
164
# reboot
165
# systemd-analyze 
166
Startup finished in 3.764s (kernel) + 7.143s (initrd) + 10.558s (userspace) = 21.467s
167
# systemd-analyze blame|head -20
168
          2.454s systemd-udev-settle.service
169
          2.007s initrd-switch-root.service
170
          1.552s systemd-remount-fs.service
171
          1.238s systemd-sysctl.service
172
          1.198s health-checker.service
173
          1.147s wicked.service
174
           939ms rebootmgr.service
175
           722ms chronyd.service
176
           711ms sshd.service
177
           596ms initrd-parse-etc.service
178
           556ms boot-efi.mount
179
           519ms systemd-udev-trigger.service
180
           465ms opt.mount
181
           456ms home.mount
182
           444ms srv.mount
183
           416ms systemd-modules-load.service
184
           414ms tmp.mount
185
           401ms usr-local.mount
186
           400ms systemd-journal-flush.service
187
           386ms \x2esnapshots.mount
188
localhost:~ # systemd-analyze critical-chain
189
The time after the unit is active or started is printed after the "@" character.
190
The time the unit takes to start is printed after the "+" character.
191
192
multi-user.target @10.426s
193
└─getty.target @9.607s
194
  └─serial-getty@ttyS0.service @9.604s
195
    └─systemd-user-sessions.service @9.425s +158ms
196
      └─network.target @8.252s
197
        └─wicked.service @7.103s +1.147s
198
          └─wickedd-nanny.service @6.992s +104ms
199
            └─wickedd.service @6.883s +103ms
200
              └─wickedd-dhcp4.service @6.633s +243ms
201
                └─dbus.service @6.458s
202
                  └─basic.target @6.417s
203
                    └─sockets.target @6.416s
204
                      └─dbus.socket @6.416s
205
                        └─sysinit.target @6.410s
206
                          └─systemd-update-utmp.service @6.256s +152ms
207
                            └─auditd.service @5.943s +305ms
208
                              └─systemd-tmpfiles-setup.service @5.803s +132ms
209
                                └─systemd-journal-flush.service @5.390s +400ms
210
                                  └─local-fs.target @5.380s
211
                                    └─boot-efi.mount @4.763s +556ms
212
                                      └─dev-disk-by\x2duuid-34A1\x2d7474.device @4.546s
213
```
214
215
Let's get rid of wicked for the fun of it
216
217
```
218
# rpm -e wicked wicked-service --nodeps
219
# systemctl enable systemd-networkd
220
# cat > 50-eth0.network <<-EOF
221
[Match]
222
Name=eth0
223
224
[Network]
225
DHCP=yes
226
EOF
227
``
228
# reboot
229
# systemd-analyze 
230
Startup finished in 3.784s (kernel) + 7.131s (initrd) + 13.681s (userspace) = 24.596s
231
# systemd-analyze blame|head -20
232
          8.018s systemd-networkd-wait-online.service
233
          2.020s initrd-switch-root.service
234
          1.968s systemd-remount-fs.service
235
          1.671s systemd-modules-load.service
236
          1.072s health-checker.service
237
           657ms sshd.service
238
           639ms initrd-parse-etc.service
239
           604ms systemd-udev-trigger.service
240
           493ms rebootmgr.service
241
           414ms systemd-sysctl.service
242
           362ms systemd-udevd.service
243
           347ms chronyd.service
244
           335ms systemd-journald.service
245
           324ms sys-kernel-debug.mount
246
           322ms home.mount
247
           318ms auditd.service
248
           316ms systemd-logind.service
249
           313ms dev-hugepages.mount
250
           311ms boot-writable.mount
251
           300ms opt.mount
252
```
253
254
OOps! Now this actually works correctly. wicked and network-online semantics do not work actually. Rebootmgr pulls in network-online. The previous wicked timeout reduction would have actually broken rebootmgr if it really required the network to be online. Let's assume it does not.
255
256
```
257
# sed -i -e '/network-online.target/d' /usr/lib/systemd/system/rebootmgr.service
258
# systemd-analyze
259
Startup finished in 3.764s (kernel) + 7.078s (initrd) + 9.769s (userspace) = 20.612s
260
# systemd-analyze blame|head -20
261
          2.367s systemd-remount-fs.service
262
          2.105s systemd-sysctl.service
263
          2.008s initrd-switch-root.service
264
          1.374s health-checker.service
265
           983ms sshd.service
266
           679ms rebootmgr.service
267
           675ms systemd-udev-trigger.service
268
           592ms initrd-parse-etc.service
269
           516ms boot-efi.mount
270
           382ms chronyd.service
271
           359ms systemd-udevd.service
272
           320ms systemd-journald.service
273
           289ms systemd-modules-load.service
274
           286ms boot-grub2-arm64\x2defi.mount
275
           282ms \x2esnapshots.mount
276
           276ms systemd-networkd.service
277
           271ms boot-writable.mount
278
           266ms issue-add-ssh-keys.service
279
           256ms dracut-cmdline.service
280
           253ms home.mount
281
# systemd-analyze critical-chain
282
The time after the unit is active or started is printed after the "@" character.
283
The time the unit takes to start is printed after the "+" character.
284
285
multi-user.target @9.653s
286
└─getty.target @8.936s
287
  └─serial-getty@ttyS0.service @8.934s
288
    └─systemd-user-sessions.service @8.817s +103ms
289
      └─network.target @7.282s
290
        └─tallow.service @7.281s
291
          └─basic.target @7.272s
292
            └─sockets.target @7.272s
293
              └─dbus.socket @7.272s
294
                └─sysinit.target @7.267s
295
                  └─systemd-update-utmp.service @7.180s +86ms
296
                    └─auditd.service @6.960s +212ms
297
                      └─systemd-tmpfiles-setup.service @6.878s +77ms
298
                        └─systemd-journal-flush.service @6.693s +179ms
299
                          └─local-fs.target @6.678s
300
                            └─boot-efi.mount @6.107s +516ms
301
                              └─dev-disk-by\x2duuid-34A1\x2d7474.device @5.655s
302
303
```
304
305
More than one minute boot time saved. Still not great. More than that would require deeper investigation. For sure the initrd size needs to be reduced first.
306
Not included yet is the time in grub. It also has a 10s timeout by default that should be mostly useless on such systems.