• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 15263807472

26 May 2025 08:53PM UTC coverage: 72.046% (-0.002%) from 72.048%
15263807472

push

github

yuwata
src/core/manager.c: log preset activity on first boot

This gives us a little more information about what units were enabled
or disabled on that first boot and will be useful for OS developers
tracking down the source of unit state.

An example with this enabled looks like:

```
NET: Registered PF_VSOCK protocol family
systemd[1]: Applying preset policy.
systemd[1]: Unit /etc/systemd/system/dnsmasq.service is masked, ignoring.
systemd[1]: Unit /etc/systemd/system/systemd-repart.service is masked, ignoring.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket'.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir.mount' → '/etc/systemd/system/var-mnt-workdir.mount'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir\x2dtmp.mount' → '/etc/systemd/system/var-mnt-workdir\x2dtmp.mount'.
systemd[1]: Created symlink '/etc/systemd/system/afterburn-sshkeys.target.requires/afterburn-sshkeys@core.service' → '/usr/lib/systemd/system/afterburn-sshkeys@.service'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket' → '/usr/lib/systemd/system/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket' → '/usr/lib/systemd/system/systemd-resolved-monitor.socket'.
systemd[1]: Populated /etc with preset unit settings.
```

Considering it only happens on first boot and not on every boot I think
the extra information is worth the extra verbosity in the logs just for
that boot.

5 of 6 new or added lines in 1 file covered. (83.33%)

5463 existing lines in 165 files now uncovered.

299151 of 415222 relevant lines covered (72.05%)

702386.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.14
/src/basic/build.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include <stdio.h>
4

5
#include "alloc-util.h"
6
#include "ansi-color.h"
7
#include "build.h"
8
#include "extract-word.h"
9
#include "log.h"
10
#include "string-util.h"
11
#include "version.h"
12

13
const char* const systemd_features =
14

15
        /* PAM and MAC frameworks */
16

17
#if HAVE_PAM
18
        "+PAM"
19
#else
20
        "-PAM"
21
#endif
22

23
#if HAVE_AUDIT
24
        " +AUDIT"
25
#else
26
        " -AUDIT"
27
#endif
28

29
#if HAVE_SELINUX
30
        " +SELINUX"
31
#else
32
        " -SELINUX"
33
#endif
34

35
#if HAVE_APPARMOR
36
        " +APPARMOR"
37
#else
38
        " -APPARMOR"
39
#endif
40

41
#if ENABLE_IMA
42
        " +IMA"
43
#else
44
        " -IMA"
45
#endif
46

47
#if ENABLE_IPE
48
        " +IPE"
49
#else
50
        " -IPE"
51
#endif
52

53
#if ENABLE_SMACK
54
        " +SMACK"
55
#else
56
        " -SMACK"
57
#endif
58

59
#if HAVE_SECCOMP
60
        " +SECCOMP"
61
#else
62
        " -SECCOMP"
63
#endif
64

65
        /* cryptographic libraries */
66

67
#if HAVE_GCRYPT
68
        " +GCRYPT"
69
#else
70
        " -GCRYPT"
71
#endif
72

73
#if HAVE_GNUTLS
74
        " +GNUTLS"
75
#else
76
        " -GNUTLS"
77
#endif
78

79
#if HAVE_OPENSSL
80
        " +OPENSSL"
81
#else
82
        " -OPENSSL"
83
#endif
84

85
        /* all other libraries, sorted alphabetically */
86

87
#if HAVE_ACL
88
        " +ACL"
89
#else
90
        " -ACL"
91
#endif
92

93
#if HAVE_BLKID
94
        " +BLKID"
95
#else
96
        " -BLKID"
97
#endif
98

99
#if HAVE_LIBCURL
100
        " +CURL"
101
#else
102
        " -CURL"
103
#endif
104

105
#if HAVE_ELFUTILS
106
        " +ELFUTILS"
107
#else
108
        " -ELFUTILS"
109
#endif
110

111
#if HAVE_LIBFIDO2
112
        " +FIDO2"
113
#else
114
        " -FIDO2"
115
#endif
116

117
#if HAVE_LIBIDN2
118
        " +IDN2"
119
#else
120
        " -IDN2"
121
#endif
122

123
#if HAVE_LIBIDN
124
        " +IDN"
125
#else
126
        " -IDN"
127
#endif
128

129
#if HAVE_LIBIPTC
130
        " +IPTC"
131
#else
132
        " -IPTC"
133
#endif
134

135
#if HAVE_KMOD
136
        " +KMOD"
137
#else
138
        " -KMOD"
139
#endif
140

141
#if HAVE_LIBCRYPTSETUP
142
        " +LIBCRYPTSETUP"
143
#else
144
        " -LIBCRYPTSETUP"
145
#endif
146

147
#if HAVE_LIBCRYPTSETUP_PLUGINS
148
        " +LIBCRYPTSETUP_PLUGINS"
149
#else
150
        " -LIBCRYPTSETUP_PLUGINS"
151
#endif
152

153
#if HAVE_LIBFDISK
154
        " +LIBFDISK"
155
#else
156
        " -LIBFDISK"
157
#endif
158

159
#if HAVE_PCRE2
160
        " +PCRE2"
161
#else
162
        " -PCRE2"
163
#endif
164

165
#if HAVE_PWQUALITY
166
        " +PWQUALITY"
167
#else
168
        " -PWQUALITY"
169
#endif
170

171
#if HAVE_P11KIT
172
        " +P11KIT"
173
#else
174
        " -P11KIT"
175
#endif
176

177
#if HAVE_QRENCODE
178
        " +QRENCODE"
179
#else
180
        " -QRENCODE"
181
#endif
182

183
#if HAVE_TPM2
184
        " +TPM2"
185
#else
186
        " -TPM2"
187
#endif
188

189
        /* compressors */
190

191
#if HAVE_BZIP2
192
        " +BZIP2"
193
#else
194
        " -BZIP2"
195
#endif
196

197
#if HAVE_LZ4
198
        " +LZ4"
199
#else
200
        " -LZ4"
201
#endif
202

203
#if HAVE_XZ
204
        " +XZ"
205
#else
206
        " -XZ"
207
#endif
208

209
#if HAVE_ZLIB
210
        " +ZLIB"
211
#else
212
        " -ZLIB"
213
#endif
214

215
#if HAVE_ZSTD
216
        " +ZSTD"
217
#else
218
        " -ZSTD"
219
#endif
220

221
        /* other stuff that doesn't fit above */
222

223
#if BPF_FRAMEWORK
224
        " +BPF_FRAMEWORK"
225
#else
226
        " -BPF_FRAMEWORK"
227
#endif
228

229
#if HAVE_VMLINUX_H
230
        " +BTF"
231
#else
232
        " -BTF"
233
#endif
234

235
#if HAVE_XKBCOMMON
236
        " +XKBCOMMON"
237
#else
238
        " -XKBCOMMON"
239
#endif
240

241
#if ENABLE_UTMP
242
        " +UTMP"
243
#else
244
        " -UTMP"
245
#endif
246

247
#if HAVE_SYSV_COMPAT
248
        " +SYSVINIT"
249
#else
250
        " -SYSVINIT"
251
#endif
252

253
#if HAVE_LIBARCHIVE
254
        " +LIBARCHIVE"
255
#else
256
        " -LIBARCHIVE"
257
#endif
258

259
        ;
260

261
static char* systemd_features_with_color(void) {
1✔
262
        const char *p = systemd_features;
1✔
263
        _cleanup_free_ char *ret = NULL;
1✔
264
        int r;
40✔
265

266
        for (;;) {
79✔
267
                _cleanup_free_ char *word = NULL;
40✔
268
                char *q;
40✔
269

270
                r = extract_first_word(&p, &word, NULL, 0);
40✔
271
                if (r < 0) {
40✔
UNCOV
272
                        log_warning_errno(r, "Cannot split features string, ignoring: %m");
×
UNCOV
273
                        return NULL;
×
274
                }
275
                if (r == 0)
40✔
276
                        return TAKE_PTR(ret);
1✔
277

278
                if (ret && !strextend(&ret, " ")) {
39✔
UNCOV
279
                        log_oom_warning();
×
280
                        return NULL;
281
                }
282

283
                if (word[0] == '+')
39✔
284
                        q = strextend(&ret, ANSI_HIGHLIGHT_GREEN, CHAR_TO_STR(word[0]), ANSI_GREEN, word+1, ANSI_NORMAL);
34✔
285
                else if (word[0] == '-')
5✔
286
                        q = strextend(&ret, ANSI_HIGHLIGHT_RED, CHAR_TO_STR(word[0]), ANSI_RED, word+1, ANSI_NORMAL);
5✔
287
                else
UNCOV
288
                        q = strextend(&ret, word);
×
289
                if (!q) {
39✔
290
                        log_oom_warning();
×
291
                        return NULL;
292
                }
293
        }
294
}
295

296
int version(void) {
32✔
297
        _cleanup_free_ char *b = NULL;
32✔
298

299
        if (colors_enabled())
32✔
300
                b = systemd_features_with_color();
1✔
301

302
        printf("%ssystemd %i%s (" GIT_VERSION ")\n%s\n",
33✔
303
               ansi_highlight(), PROJECT_VERSION, ansi_normal(),
304
               b ?: systemd_features);
305
        return 0;
32✔
306
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc