• 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

0.0
/src/basic/keyring-util.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include "alloc-util.h"
4
#include "keyring-util.h"
5
#include "log.h"
6
#include "missing_syscall.h"
7

UNCOV
8
int keyring_read(key_serial_t serial, void **ret, size_t *ret_size) {
×
9
        size_t bufsize = 100;
×
10

UNCOV
11
        for (;;) {
×
12
                _cleanup_(erase_and_freep) uint8_t *buf = NULL;
×
13
                long n;
×
14

UNCOV
15
                buf = new(uint8_t, bufsize + 1);
×
16
                if (!buf)
×
17
                        return -ENOMEM;
18

UNCOV
19
                n = keyctl(KEYCTL_READ, (unsigned long) serial, (unsigned long) buf, (unsigned long) bufsize, 0);
×
20
                if (n < 0)
×
21
                        return -errno;
×
22

UNCOV
23
                if ((size_t) n <= bufsize) {
×
24
                        buf[n] = 0; /* NUL terminate, just in case */
×
25

UNCOV
26
                        if (ret)
×
27
                                *ret = TAKE_PTR(buf);
×
28
                        if (ret_size)
×
29
                                *ret_size = n;
×
30

UNCOV
31
                        return 0;
×
32
                }
33

UNCOV
34
                bufsize = (size_t) n;
×
35
        }
36
}
37

UNCOV
38
int keyring_describe(key_serial_t serial, char **ret) {
×
39
        _cleanup_free_ char *tuple = NULL;
×
40
        size_t sz = 64;
×
41
        int c = -1; /* Workaround for maybe-uninitialized false positive due to missing_syscall indirection */
×
42

UNCOV
43
        assert(ret);
×
44

UNCOV
45
        for (;;) {
×
46
                tuple = new(char, sz);
×
47
                if (!tuple)
×
48
                        return log_oom_debug();
×
49

UNCOV
50
                c = keyctl(KEYCTL_DESCRIBE, serial, (unsigned long) tuple, c, 0);
×
51
                if (c < 0)
×
52
                        return log_debug_errno(errno, "Failed to describe key id %d: %m", serial);
×
53

UNCOV
54
                if ((size_t) c <= sz)
×
55
                        break;
56

UNCOV
57
                sz = c;
×
58
                free(tuple);
×
59
        }
60

61
        /* The kernel returns a final NUL in the string, verify that. */
UNCOV
62
        assert(tuple[c-1] == 0);
×
63

UNCOV
64
        *ret = TAKE_PTR(tuple);
×
65

UNCOV
66
        return 0;
×
67
}
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