systemd/.git
3 years agoMerge pull request #24853 from poettering/resolved-monitor-fixes
Luca Boccassi [Fri, 30 Sep 2022 14:46:13 +0000 (15:46 +0100)]
Merge pull request #24853 from poettering/resolved-monitor-fixes

resolved: various monitor fixes

3 years agoMerge pull request #24739 from keszybz/coredump-formatting
Luca Boccassi [Fri, 30 Sep 2022 14:42:15 +0000 (15:42 +0100)]
Merge pull request #24739 from keszybz/coredump-formatting

Improve formatting of package metadata in coredumps

3 years agosystemctl: color ignored exit status in yellow, not red
Christian Hesse [Fri, 30 Sep 2022 08:26:43 +0000 (10:26 +0200)]
systemctl: color ignored exit status in yellow, not red

If the executable path is prefixed with "-", an exit code of the command
normally considered a failure (i.e. non-zero exit status or abnormal exit
due to signal) is recorded, but has no further effect and is considered
equivalent to success.

Let's honor this with `systemctl status`, and color ignored exit status
in yellow, not red.

3 years agogenerator: skip fsck if fsck command is missing
Jonas Kümmerlin [Thu, 29 Sep 2022 16:51:03 +0000 (18:51 +0200)]
generator: skip fsck if fsck command is missing

This is useful for systems which don't have any fsck.

We already skip emitting the fsck dependency when the fsck.$fstype helper
is missing, but fstab-generator doesn't necessarily know the fstype when
handling the root= parameter.

Previously, systemd-fsck was started for these mounts and then exited
immediately because it couldn't find the fsck.$fstype helper.

3 years agoportablectl: add --force attach/detach
Luca Boccassi [Thu, 29 Sep 2022 21:41:55 +0000 (22:41 +0100)]
portablectl: add --force attach/detach

Allows to skip check that ensures units must not be running.

I have a use case that would use reattach, except the orchestrator
is using a non-standard versioning scheme, so image matching cannot
work. As a workaround, need to be able to detach and then attach
manually, without stopping the units to avoid extended downtimes
and loss of FD store.

3 years agoupdate TODO
Lennart Poettering [Fri, 30 Sep 2022 12:14:33 +0000 (14:14 +0200)]
update TODO

3 years agotest: rework resolved monitoring test
Lennart Poettering [Fri, 30 Sep 2022 08:04:37 +0000 (10:04 +0200)]
test: rework resolved monitoring test

Let's remove some sleep loops, and instead:

1. Use Type=notify to wait until "resolvectl monitor" successfully
   installed its monitor, so that we know that queries enqueued later
   will definitely be seen.

2. Use "grep -m1" to watch "journalctl -f" output to wait precisely for
   the RR data we want to see, and immediately exit.

This shortens code quite a bit, and should make it more robust.

3 years agoresolvectl: add new "monitor" verb
Lennart Poettering [Wed, 28 Sep 2022 10:46:21 +0000 (12:46 +0200)]
resolvectl: add new "monitor" verb

3 years agoMerge pull request #24831 from poettering/dbus-dump-doc
Franck Bui [Fri, 30 Sep 2022 12:23:59 +0000 (14:23 +0200)]
Merge pull request #24831 from poettering/dbus-dump-doc

man: clarify that D-Bus Dump() call is a debugging interface with no guarantees

3 years agoresolved: beef up monitor protocol, include full query info
Lennart Poettering [Wed, 28 Sep 2022 10:46:09 +0000 (12:46 +0200)]
resolved: beef up monitor protocol, include full query info

3 years agoresolved: add dns_question_merge() helper
Lennart Poettering [Thu, 29 Sep 2022 16:26:44 +0000 (18:26 +0200)]
resolved: add dns_question_merge() helper

Very similar to dns_answer_merge(), but for DnsQuestion objects instead
of DnsAnswer.

3 years agoresolved: add generic formatters for RRs into JSON
Lennart Poettering [Wed, 28 Sep 2022 15:17:23 +0000 (17:17 +0200)]
resolved: add generic formatters for RRs into JSON

For now we can use it to send broken-down records of JSON via the
monitor logic, but one day we can certainly reuse for dumping the
caches, or to implement a ResolveRecord() varlink call one day.

3 years agoresolved: split out helper for allocating DnsResourceRecord object from raw data
Lennart Poettering [Wed, 28 Sep 2022 10:44:43 +0000 (12:44 +0200)]
resolved: split out helper for allocating DnsResourceRecord object from raw data

No change in behaviour, just some refactoring.

3 years agoresolved: split out main server listening code from manager_varlink_init()
Lennart Poettering [Tue, 27 Sep 2022 12:50:53 +0000 (14:50 +0200)]
resolved: split out main server listening code from manager_varlink_init()

Just some minor refactoring, to make binding the two sockets (main +
minitor) symmetric

3 years agoresolved: don't make monitoring optional
Lennart Poettering [Tue, 27 Sep 2022 12:29:18 +0000 (14:29 +0200)]
resolved: don't make monitoring optional

The socket is only accessible to privileged clients anyway, no need to
add another (user unfriendly) restriction via opt-in setting. let's just
allow this for privileged clients, mirroring "busctl monitor", or
"tcpdump" and similar, which all just work if you have privs.

(This does not break API, since we never did a release witht the
"Monitor" dbus property or config setting in place, i.e. with
cb456374e096f0ebe9b70d7ddd98e16a4be24ee6)

3 years agoresolved: rename 'notification' → 'monitor'
Lennart Poettering [Tue, 27 Sep 2022 12:28:32 +0000 (14:28 +0200)]
resolved: rename 'notification' → 'monitor'

We expose this externally already as "monitor", name it internally the
same way. (Which is nice since it mirrors busctl monitor)

3 years agosd-event: add helper for exiting event loop on SIGTERM/SIGINT
Lennart Poettering [Wed, 28 Sep 2022 09:42:05 +0000 (11:42 +0200)]
sd-event: add helper for exiting event loop on SIGTERM/SIGINT

In many (most?) of our event loops we want to exit once SIGTERM/SIGINT
is seen. Add a common helper for that, that does the right things in a
single call.

3 years agosd-event: if signal nr has high bit set sd_event_add_signal() auto-block it via sigpr...
Lennart Poettering [Wed, 28 Sep 2022 09:39:25 +0000 (11:39 +0200)]
sd-event: if signal nr has high bit set sd_event_add_signal() auto-block it via sigprocmask()

So far we expected callers to block the signals manually. Which is
usually a good idea, since they should do that before forking off
threads and similar. But let's add a mode where we automatically block
it for the caller, to simplify things.

3 years agojson: explicitly support offsets relative to NULL when dispatching
Lennart Poettering [Fri, 30 Sep 2022 12:09:54 +0000 (14:09 +0200)]
json: explicitly support offsets relative to NULL when dispatching

Let's trick out UndefinedBehaviourSanitizer:

https://github.com/systemd/systemd/pull/24853#issuecomment-1263380745

3 years agojson: add helper for json builder for octescape/base32hex
Lennart Poettering [Wed, 28 Sep 2022 15:13:00 +0000 (17:13 +0200)]
json: add helper for json builder for octescape/base32hex

These encodings for binary data are mandated by DNS RFCs, so let's give
make them nice and easy to use with json builder logic.

3 years agojson: add dispatchers for 16bit integers
Lennart Poettering [Wed, 28 Sep 2022 09:35:47 +0000 (11:35 +0200)]
json: add dispatchers for 16bit integers

3 years agoglyph-util: add left arrow special glyph entry
Lennart Poettering [Wed, 28 Sep 2022 09:34:46 +0000 (11:34 +0200)]
glyph-util: add left arrow special glyph entry

3 years agoresolve: do not cache mDNS goodbye packet
Yu Watanabe [Thu, 29 Sep 2022 07:50:27 +0000 (16:50 +0900)]
resolve: do not cache mDNS goodbye packet

Fixes #24842.

3 years agoMerge pull request #24820 from keszybz/tmpfiles-warning
Yu Watanabe [Fri, 30 Sep 2022 09:50:31 +0000 (18:50 +0900)]
Merge pull request #24820 from keszybz/tmpfiles-warning

Downgrade warning about unitialized-/etc in tmpfiles

3 years agotest: wait until the unit finishes before checking the log
Frantisek Sumsal [Fri, 30 Sep 2022 07:31:47 +0000 (09:31 +0200)]
test: wait until the unit finishes before checking the log

Otherwise we might read an incomplete log and fail:

```
test_added_after (__main__.ExecutionResumeTest) ... FAIL
test_added_before (__main__.ExecutionResumeTest) ... ok
test_interleaved (__main__.ExecutionResumeTest) ... ok
test_issue_6533 (__main__.ExecutionResumeTest) ... ok
test_no_change (__main__.ExecutionResumeTest) ... ok
test_removal (__main__.ExecutionResumeTest) ... ok
test_swapped (__main__.ExecutionResumeTest) ... ok

======================================================================
FAIL: test_added_after (__main__.ExecutionResumeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/./test/test-exec-deserialization.py", line 152, in test_added_after
    self.check_output(expected_output)
  File "/build/./test/test-exec-deserialization.py", line 107, in check_output
    self.assertEqual(output, expected_output)
AssertionError: 'foo\n' != 'foo\nbar\n'
  foo
+ bar

----------------------------------------------------------------------
Ran 7 tests in 27.470s
```

3 years agotest: kill the machine on oops/panic/soft_lockup
Frantisek Sumsal [Fri, 30 Sep 2022 06:48:53 +0000 (08:48 +0200)]
test: kill the machine on oops/panic/soft_lockup

Otherwise the machine will hang on the panic until the timeout happens,
which might waste quite a considerable amount of time in certain cases.

3 years agomanager: make clear internal Dump() logic is debugging only.
Lennart Poettering [Tue, 27 Sep 2022 10:18:47 +0000 (12:18 +0200)]
manager: make clear internal Dump() logic is debugging only.

3 years agoman: document the Dump() calls of the PID 1 D-Bus interface, and what they are
Lennart Poettering [Tue, 27 Sep 2022 10:18:43 +0000 (12:18 +0200)]
man: document the Dump() calls of the PID 1 D-Bus interface, and what they are

3 years agokbd-model-map: correct variants for cz-qwerty to include comma
Adam Williamson [Thu, 29 Sep 2022 19:58:03 +0000 (12:58 -0700)]
kbd-model-map: correct variants for cz-qwerty to include comma

As explained by @poncovka , the 'xvariant' string should contain
the same number of comma-separated elements as 'xlayout'. When
we have two layouts we need two items in xvariant, in this case
one of them is empty.

See https://github.com/rhinstaller/anaconda/pull/4355#pullrequestreview-1119913870
for @poncovka's full explanation.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
3 years agoMerge pull request #24865 from yuwata/udevadm-tweaks
Frantisek Sumsal [Thu, 29 Sep 2022 22:01:48 +0000 (00:01 +0200)]
Merge pull request #24865 from yuwata/udevadm-tweaks

udevadm: fix misleading error message

3 years agoAdd special keyboard combos for Thinkpad P1 Gen 3 (#24862)
JeroenHD [Thu, 29 Sep 2022 20:23:42 +0000 (22:23 +0200)]
Add special keyboard combos for Thinkpad P1 Gen 3 (#24862)

* Add special keyboard combos for Thinkpad P1 Gen 3

These are based on the key codes I've found with evtest. See issue
https://github.com/systemd/systemd/issues/24814 for more details.

I'm not entirely sure what some of these keys are supposed to do,
notably Fn+RShift; this doesn't seem to do anything in Windows on
my machine. Binding them to prog# makes them available to desktop
managers' key bindings at least, in case someone wishes to make
use of this extra keybind possibility.

3 years agotest-64-udev-storage: use wait command instead of hackish "udevadm lock true"
Yu Watanabe [Thu, 29 Sep 2022 17:38:22 +0000 (02:38 +0900)]
test-64-udev-storage: use wait command instead of hackish "udevadm lock true"

Otherwise, "udevadm lock true" may lock a block device earlier than
"udevadm lock sfdisk &".

3 years agoudevadm: do not try to find device unit when a path like string is provided
Yu Watanabe [Thu, 29 Sep 2022 17:03:32 +0000 (02:03 +0900)]
udevadm: do not try to find device unit when a path like string is provided

Otherwise, we provide misleading error message.
Before:
---
$ udevadm info /sys/class/foo
Bad argument "/sys/class/foo", expected an absolute path in /dev/ or /sys/ or a unit name: Invalid argument
---
After:
---
$ udevadm info /sys/class/foo
Unknown device "/sys/class/foo": No such device
---

3 years agodocs/CONTRIBUTING: explain various labels and add link to "reviewable" PRs
Zbigniew Jędrzejewski-Szmek [Thu, 29 Sep 2022 12:30:24 +0000 (14:30 +0200)]
docs/CONTRIBUTING: explain various labels and add link to "reviewable" PRs

The linked filter gives an up-to-date list of pull requests that need review.
(Yes, there's too many.) We used to set 'needs-review' label, but that is
not available to non-members, and also every pull requests which is not labeled
'reviewed/needs-rework'/'ci-fails/needs-rework'/'needs-rebase' can and should
be reviewed.

If this is merged, I'll drop the 'needs-review' label.

3 years agotest: bump the `reattach` timeout when running w/ plain QEMU
Frantisek Sumsal [Thu, 29 Sep 2022 12:23:11 +0000 (14:23 +0200)]
test: bump the `reattach` timeout when running w/ plain QEMU

As it might sometimes take slightly longer without the acceleration:

```
[  176.805681] testsuite-29.sh[534]: + cp /usr/share/app1.raw /tmp/app1_2.raw
[  176.885365] testsuite-29.sh[534]: + timeout 30 portablectl reattach --now --runtime --extension /tmp/app1_2.raw /usr/share/minimal_1.raw app1
[  177.053358] portablectl[993]: (Matching unit files with prefixes 'app1'.)
[  177.138770] kernel: loop0: detected capacity change from 0 to 2965504
[  177.343137] kernel: loop1: detected capacity change from 0 to 4096
...
[  201.932062] systemd[1]: app1.service: Deactivated successfully.
[  202.009310] systemd[1]: Stopped app1.service.
[  202.053776] systemd[1]: app1.service: Consumed 2.183s CPU time.
[  202.125061] systemd[1]: Stopping app1.service...
[  202.611760] systemd[1]: Starting modprobe@dm_mod.service...
[  202.851031] systemd[1]: Starting modprobe@dm_verity.service...
[  202.909352] systemd[1]: Starting modprobe@loop.service...
[  203.198918] systemd[1]: Starting app1.service...
[  207.145494] kernel: audit: type=1130 audit(1663770336.105:428): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=testsuite-29 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
[  207.652545] systemd[1]: testsuite-29.service: Main process exited, code=exited, status=124/n/a
[  207.665088] systemd[1]: testsuite-29.service: Failed with result 'exit-code'.
[  207.830522] systemd[1]: Failed to start testsuite-29.service.
...
[  208.889449] script1.sh[1035]: ID="centos"
[  208.889449] script1.sh[1035]: VERSION_ID="8"
[  208.889449] script1.sh[1035]: SYSEXT_SCOPE=portable
[  208.889449] script1.sh[1035]: PORTABLE_PREFIXES=app1
...
[  214.155097] systemd[1]: app1.service: Deactivated successfully.
```

Spotted in Ubuntu CI and CentOS CI.

Follow-up to 706c9a30ac.

3 years agostub: Remove unused function parameter
Jan Janssen [Thu, 29 Sep 2022 07:09:52 +0000 (09:09 +0200)]
stub: Remove unused function parameter

3 years agoresolved: paranoia: restrict socket mode as much as we can
Lennart Poettering [Tue, 27 Sep 2022 12:32:35 +0000 (14:32 +0200)]
resolved: paranoia: restrict socket mode as much as we can

3 years agotest: wrap `ls` and `stat` to make it work w/ sanitizers in specific cases
Frantisek Sumsal [Wed, 28 Sep 2022 15:01:55 +0000 (17:01 +0200)]
test: wrap `ls` and `stat` to make it work w/ sanitizers in specific cases

When `/etc/nsswitch.conf` uses `systemd` together with `[SUCCESS=merge]`,
`ls -l` will pull in `libnss_systemd` causing `SIGABRT`, as `ls` is not
instrumented (by default):

```
-bash-5.1# strace -f -e %file ls -l /dev
execve("/usr/bin/ls", ["ls", "-l", "/dev"], 0x7ffc3bb211c8 /* 24 vars*/) = 0
...
openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=1896, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/etc/nsswitch.conf", {st_mode=S_IFREG|0644, st_size=359, ...}, 0) = 0
openat(AT_FDCWD, "/etc/group", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=965, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=10779, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/usr/lib/libnss_systemd.so.2", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=16195176, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/usr/lib/libasan.so.8", O_RDONLY|O_CLOEXEC) = 3
...
readlink("/proc/self/exe", "/usr/bin/ls", 4096) = 11
open("/proc/self/cmdline", O_RDONLY)    = 3
open("/proc/self/environ", O_RDONLY)    = 3
==620==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=620, si_uid=0} ---
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)
```

This also happens with `stat`. Let's add both `ls` and `stat` to the "wrap list"
to work around this.

Spotted on Arch Linux.

3 years agoresolvectl: add line breaks for readability
Lennart Poettering [Wed, 28 Sep 2022 10:45:31 +0000 (12:45 +0200)]
resolvectl: add line breaks for readability

3 years agoresolved: don't access sshfp fields from tlsa printer
Lennart Poettering [Wed, 28 Sep 2022 15:12:20 +0000 (17:12 +0200)]
resolved: don't access sshfp fields from tlsa printer

3 years agoresolved: return regular varlink invalid parameter error if more is not specified...
Lennart Poettering [Wed, 28 Sep 2022 09:44:57 +0000 (11:44 +0200)]
resolved: return regular varlink invalid parameter error if more is not specified on monitor call

No point in returning EINVAL if we can just return a proper varlink
invalid parameter error

3 years agoresolved: fix parameter reuse in DNS_ANSWER_FOREACH_ITEM() iterator macro
Lennart Poettering [Wed, 28 Sep 2022 09:44:18 +0000 (11:44 +0200)]
resolved: fix parameter reuse in DNS_ANSWER_FOREACH_ITEM() iterator macro

3 years agotest: fix a copy-paste error
Frantisek Sumsal [Wed, 28 Sep 2022 09:30:13 +0000 (11:30 +0200)]
test: fix a copy-paste error

3 years agoMerge pull request #24837 from yuwata/kernel-install
Daan De Meyer [Wed, 28 Sep 2022 08:50:55 +0000 (10:50 +0200)]
Merge pull request #24837 from yuwata/kernel-install

kernel-install: two fixlets

3 years agocoredump: print build-id only when package version is missing
Zbigniew Jędrzejewski-Szmek [Mon, 19 Sep 2022 07:33:28 +0000 (09:33 +0200)]
coredump: print build-id only when package version is missing

The build-id is quite verbose, and probably not very useful to a user when they
already know the nvra of the package.

3 years agocoredump: shorten output about package metadata to one line
Zbigniew Jędrzejewski-Szmek [Sun, 18 Sep 2022 17:26:29 +0000 (19:26 +0200)]
coredump: shorten output about package metadata to one line

We would print the whole thing in extenso. Users generally don't care,
and would likely prefer to just get the compact identifier of the package
that they can use in a bug report or package manager commands.

Before:
systemd-coredump[40645]: [🡕] Process 1975 (gnome-shell) of user 1000 dumped core.

                         Module /usr/bin/gnome-shell (deleted) with build-id aafdb7d69a7efca937e490080ad9348541fc57d8
                         Metadata for module /usr/bin/gnome-shell (deleted) owned by FDO found: {
                                 "type" : "rpm",
                                 "name" : "gnome-shell",
                                 "version" : "43~rc-3.fc37",
                                 "architecture" : "x86_64",
                                 "osCpe" : "cpe:/o:fedoraproject:fedora:37"
                         }

                         Module /usr/lib64/gnome-shell/libgvc.so (deleted) with build-id 56cbb9862e1ee84ca1549b94f2b4cda03537613e
                         Metadata for module /usr/lib64/gnome-shell/libgvc.so (deleted) owned by FDO found: {
                                 "type" : "rpm",
                                 "name" : "gnome-shell",
                                 "version" : "43~rc-2.fc37",
                                 "architecture" : "x86_64",
                                 "osCpe" : "cpe:/o:fedoraproject:fedora:37"
                         }

                         Module /usr/lib64/libLLVM-14.so (deleted) with build-id ffa7e43f48eb4c189304c0241b1862710de4c3a4
                         Metadata for module /usr/lib64/libLLVM-14.so (deleted) owned by FDO found: {
                                 "type" : "rpm",
                                 "name" : "gnome-shell",
                                 "version" : "43~rc-2.fc37",
                                 "architecture" : "x86_64",
                                 "osCpe" : "cpe:/o:fedoraproject:fedora:37"
                         }

After:
systemd-coredump[235218]: [🡕] Process 235216 (bash) of user 1000 dumped core.

                          Module libtinfo.so.6 from rpm ncurses-6.3-3.20220501.fc37.x86_64, build-id=71a04d23fd572525eb6efc47026c379725e06d96
                          Module bash from rpm bash-5.1.16-3.fc37.x86_64, build-id=6c936aff95a2ccda04a3fb685a81a84a0a8d10da
                          Stack trace of thread 235216:
                          #0  0x00007fa409ec8d8b kill (libc.so.6 + 0x38d8b)
                          #1  0x0000560d35e366b1 kill_builtin (bash + 0xad6b1)
                          #2  0x0000560d35dd7227 execute_builtin.lto_priv.0 (bash + 0x4e227)
                          #3  0x0000560d35dd0459 execute_simple_command (bash + 0x47459)
                          #4  0x0000560d35dd1de0 execute_command_internal (bash + 0x48de0)
                          #5  0x0000560d35e307aa parse_and_execute (bash + 0xa77aa)
                          #6  0x0000560d35e91b08 run_one_command.isra.0 (bash + 0x108b08)
                          #7  0x0000560d35dba07c main (bash + 0x3107c)
                          #8  0x00007fa409eb3510 __libc_start_call_main (libc.so.6 + 0x23510)
                          #9  0x00007fa409eb35c9 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x235c9)
                          #10 0x0000560d35dbad85 _start (bash + 0x31d85)

3 years agocoredump: when parsing json, optionally copy the string first
Zbigniew Jędrzejewski-Szmek [Mon, 19 Sep 2022 09:29:56 +0000 (11:29 +0200)]
coredump: when parsing json, optionally copy the string first

3 years agofuzz: tighten acceptable data size
Yu Watanabe [Wed, 28 Sep 2022 04:42:01 +0000 (13:42 +0900)]
fuzz: tighten acceptable data size

Fixes oss-fuzz#51887 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51887).
Fixes #24833.

3 years agodocs/NETWORK_ONLINE: systemd.network hyperlink fix
Sarah Brofeldt [Wed, 28 Sep 2022 06:43:30 +0000 (08:43 +0200)]
docs/NETWORK_ONLINE: systemd.network hyperlink fix

3 years agokernel-install: do not fail if a plugin exits with 77
Yu Watanabe [Wed, 28 Sep 2022 04:35:49 +0000 (13:35 +0900)]
kernel-install: do not fail if a plugin exits with 77

3 years agokernel-install: do not fail if $layout is not "bls"
Yu Watanabe [Wed, 28 Sep 2022 04:27:19 +0000 (13:27 +0900)]
kernel-install: do not fail if $layout is not "bls"

Fixes #24836.

3 years agoresolve: persist DNSOverTLS configuration in state file
msizanoen1 [Tue, 27 Sep 2022 14:48:48 +0000 (21:48 +0700)]
resolve: persist DNSOverTLS configuration in state file

Currently, NetworkManager will set DNSOverTLS according to its
`connection.dnsovertls` configuration only once during connection,
instead of every single restart of systemd-resolved, causing resolved to
lose the configuration on restart.

Fix this by persisting DNSOverTLS in the runtime state file, which will
also make it more consistent with other interface-specific settings.

3 years agohwdb: fix Positivo-vaio FE14 V2 key toggle touchpad #24822 (#24825)
Edson Juliano Drosdeck [Tue, 27 Sep 2022 23:06:34 +0000 (19:06 -0400)]
hwdb: fix Positivo-vaio FE14 V2 key toggle touchpad #24822  (#24825)

3 years agoresolved notifications: follow-up fixes
Luca Boccassi [Mon, 26 Sep 2022 14:33:35 +0000 (15:33 +0100)]
resolved notifications: follow-up fixes

Further review comments from: https://github.com/systemd/systemd/pull/22845

3 years agoMerge pull request #24832 from mrc0mmand/more-TEST-64-tweaks
Yu Watanabe [Tue, 27 Sep 2022 17:26:55 +0000 (02:26 +0900)]
Merge pull request #24832 from mrc0mmand/more-TEST-64-tweaks

A couple of performance tweaks for TEST-64 under QEMU

3 years agotmpfiles: downgrade message about unitialized-/etc
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2022 12:46:08 +0000 (14:46 +0200)]
tmpfiles: downgrade message about unitialized-/etc

If we're running with --root, or in a chroot (*), it's expected that machine-id
and other specifiers will be unresolvable, so downgrade the warning to debug.

Fixes #24655.

(*) sd_booted() in principle means more than that, but nowadays systemd
dominates and those others things are infrequently seen.

3 years agotmpfiles: fix detection of unitialized-/etc
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2022 12:22:49 +0000 (14:22 +0200)]
tmpfiles: fix detection of unitialized-/etc

In 6ec4c852c910b1aca649e87ba3143841334f01fa I changed specifier_machine_id() to
return EUNATCH, but the code catching in tmpfiles wasn't adjusted.

Instead of translating errors at various levels, let the "original" errno value
(whatever was returned by the low-level reading function) propagate all the way
to the logging function, and only check which errnos to suppress there. This
makes it easier to follow the flow of data through all the layers. Also, we
don't need to provide wrapper functions for each place where we want to do the
supression.

The common set of errnos that have similar meaning are are caught using
ERRNO_IS_NOINFO(). It is more managable to use a wider net than to figure out
which errors could be returned in specific cases.

3 years agotest: use fewer partitions/LVs when running with plain QEMU
Frantisek Sumsal [Tue, 27 Sep 2022 11:57:04 +0000 (13:57 +0200)]
test: use fewer partitions/LVs when running with plain QEMU

3 years agotest: make the symlink helpers a bit more quiet
Frantisek Sumsal [Tue, 27 Sep 2022 11:47:59 +0000 (13:47 +0200)]
test: make the symlink helpers a bit more quiet

and show only errors/warnings.

3 years agotest: ignore tty* devices when checking device units
Frantisek Sumsal [Tue, 27 Sep 2022 11:06:27 +0000 (13:06 +0200)]
test: ignore tty* devices when checking device units

This lower the runtime of `check_device_units()` in a plain QEMU VM from
~45 seconds to ~25 seconds.

3 years agotest: lower the # of iterations when running with plain QEMU
Frantisek Sumsal [Tue, 27 Sep 2022 11:05:43 +0000 (13:05 +0200)]
test: lower the # of iterations when running with plain QEMU

3 years agotest: support open-iscsi >= 2.1.2
Frantisek Sumsal [Mon, 26 Sep 2022 21:14:18 +0000 (23:14 +0200)]
test: support open-iscsi >= 2.1.2

Since open-iscsi 2.1.2 [0] the initiator name should be generated via
a one-time service instead of distro package's post-install scripts.
However, some distros still use this approach even after this patch,
so prefer the already existing initiatorname.iscsi file if it exists.

[0] https://github.com/open-iscsi/open-iscsi/commit/f37d5b653f9f251845db3f29b1a3dcb90ec89731

3 years agoMerge pull request #24805 from yuwata/sd-network
Lennart Poettering [Tue, 27 Sep 2022 09:28:25 +0000 (11:28 +0200)]
Merge pull request #24805 from yuwata/sd-network

sd-network: several cleanups

3 years agosystemctl: add support for --image option
Richard Phibel [Wed, 7 Sep 2022 10:53:09 +0000 (03:53 -0700)]
systemctl: add support for --image option

All tools that support --root= should also learn --image=
so that they can operate on disk images directly.

3 years agoMerge pull request #24812 from yuwata/udev-drop-netlink
Yu Watanabe [Tue, 27 Sep 2022 05:10:02 +0000 (14:10 +0900)]
Merge pull request #24812 from yuwata/udev-drop-netlink

udev: drop workaround for slow read of phys_port_name sysattr

3 years agosd-network: make sd_network_link_get_dns() or friends return -ENODATA
Yu Watanabe [Sat, 24 Sep 2022 00:31:00 +0000 (09:31 +0900)]
sd-network: make sd_network_link_get_dns() or friends return -ENODATA

To make them consistent with other functions.

3 years agosd-network: drop fallback values
Yu Watanabe [Sat, 24 Sep 2022 00:22:03 +0000 (09:22 +0900)]
sd-network: drop fallback values

This drops spurious lines in `networkctl status` for unmanaged interfaces.
Before:
```
$ networkctl status --lines 0 lo
● 1: lo
                     Link File: n/a
                  Network File: n/a
                          Type: loopback
                         State: carrier (unmanaged)
                  Online state: unknown
                    HW Address: 00:00:00:00:00:00
                           MTU: 65536
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
          Queue Length (Tx/Rx): 1/1
                       Address: 127.0.0.1
                                ::1
             Activation Policy: up
           Required For Online: yes
```
After:
```
$ networkctl status --lines 0 lo
● 1: lo
                     Link File: n/a
                  Network File: n/a
                         State: carrier (unmanaged)
                  Online state: unknown
                          Type: loopback
              Hardware Address: 00:00:00:00:00:00
                           MTU: 65536
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
      Number of Queues (Tx/Rx): 1/1
                       Address: 127.0.0.1
                                ::1
```

That is, the lines for Activation Policy and Required For Online are
dropped.

3 years agosd-network: introduce network_link_get_boolean() helper function
Yu Watanabe [Sat, 24 Sep 2022 00:20:36 +0000 (09:20 +0900)]
sd-network: introduce network_link_get_boolean() helper function

3 years agosd-network: accept all space-like separators
Yu Watanabe [Sat, 24 Sep 2022 00:05:05 +0000 (09:05 +0900)]
sd-network: accept all space-like separators

3 years agosd-network: propagate -ENOENT
Yu Watanabe [Sat, 24 Sep 2022 00:01:58 +0000 (09:01 +0900)]
sd-network: propagate -ENOENT

On -ENOENT, it suggests that network-manager is not running, and
interfaces are not unmanaged. Such information may be useful for
callers.

3 years agosd-network: rename function arguments for storing return value
Yu Watanabe [Fri, 23 Sep 2022 22:50:18 +0000 (07:50 +0900)]
sd-network: rename function arguments for storing return value

3 years agonetworkctl: use table_add_string_line() at one more place
Yu Watanabe [Fri, 23 Sep 2022 22:47:14 +0000 (07:47 +0900)]
networkctl: use table_add_string_line() at one more place

3 years agonetworkctl: handle all errors in sd_network_link_get_setup_state() as "unmanaged"
Yu Watanabe [Fri, 23 Sep 2022 22:46:31 +0000 (07:46 +0900)]
networkctl: handle all errors in sd_network_link_get_setup_state() as "unmanaged"

We have already ignored all errors in other fields.

3 years agoudev: drop workaround for slow read of phys_port_name sysattr
Yu Watanabe [Sun, 25 Sep 2022 04:18:24 +0000 (13:18 +0900)]
udev: drop workaround for slow read of phys_port_name sysattr

TL;DR
This effectively reverts 8327fd1b11c5fb6529d46dfb40e2af981ffa8545,
eaba9bb3e69635d2c490c5e1b0d262b763753e1d, and its follow-ups, as the
original issue was already fixed by the kernel side.

The original issue that the above commits tried to 'fix' is that reading
phys_port_name triggers a lock in the kernel, hence processing multiple
interfaces at the same time causes extreme slow down.
To workaround the issue, the above commits made several necessary
information retrieved through netlink instead of sysfs attributes.

A patch set for the kernel was proposed as a fix for the issue:
https://lore.kernel.org/all/20210928125500.167943-1-atenart@kernel.org/
and some of them were merged to v5.16:
https://github.com/torvalds/linux/commit/146e5e733310379f51924111068f08a3af0db830,
It has been already backported to 5.4.160, 5.10.80, 5.14.19, and 5.15.3.

When these commits were proposed, it is already claimed that such issue
should be fixed by the kernel side, and udevd should not workaround it.
Neverthless the feature was introduced, as these have theoretical
performance improvement, even if phys_port_name sysattr does not have the
above issue, as in that way udevd can obtain multiple information about
the interface with a single netlink socket operation. See the discussion
in #20744.

However, in reality, only `iflink`, `type`, `address`, and `phys_port_name`
attributes from netlink are used in the udev net_id builtin command. Hence,
after the original issue being fixed in the kernel side, there should be
almost no performance improvement for udevd.
Furthermore, combining attributes from netlink and sysfs makes hard to
test net_id builtin. See #21725.

Let's drop mostly meaningless code, and make net_id builtin easily testable.

Closes #21725.

3 years agoman: document that setting Storage= in namespaces journald menas LogDirectory= in...
Lennart Poettering [Mon, 26 Sep 2022 14:13:20 +0000 (16:13 +0200)]
man: document that setting Storage= in namespaces journald menas LogDirectory= in unit file needs setting too

Replaces: #24789

3 years agoMerge pull request #24757 from yuwata/sd-device-get-child-first
Lennart Poettering [Mon, 26 Sep 2022 17:03:15 +0000 (19:03 +0200)]
Merge pull request #24757 from yuwata/sd-device-get-child-first

sd-device: introduce sd_device_get_child_first() and _next()

3 years agoMerge pull request #24808 from medhefgo/fuzz
Lennart Poettering [Mon, 26 Sep 2022 16:37:08 +0000 (18:37 +0200)]
Merge pull request #24808 from medhefgo/fuzz

fuzz: Add fuzzer for some efi string functions

3 years agounits: udev: partially emulate ProtectClock=
Topi Miettinen [Sun, 25 Sep 2022 17:47:53 +0000 (20:47 +0300)]
units: udev: partially emulate ProtectClock=

Drop CAP_SYS_TIME and CAP_WAKE_ALARM capabilities and block clock-related
system calls. Update TODO.

3 years agoupdate TODO
Lennart Poettering [Mon, 26 Sep 2022 08:06:11 +0000 (10:06 +0200)]
update TODO

3 years agoboot: Make efi_fnmatch non-backtracking
Jan Janssen [Sat, 24 Sep 2022 11:33:10 +0000 (13:33 +0200)]
boot: Make efi_fnmatch non-backtracking

3 years agofuzz: Add fuzzer for some efi string functions
Jan Janssen [Fri, 23 Sep 2022 08:07:25 +0000 (10:07 +0200)]
fuzz: Add fuzzer for some efi string functions

3 years agofuzz: Introduce DO_NOT_OPTIMIZE
Jan Janssen [Fri, 23 Sep 2022 07:54:03 +0000 (09:54 +0200)]
fuzz: Introduce DO_NOT_OPTIMIZE

The compiler may decide computations like these are not doing anything
and decide to optimize them away. This would defeat the whole fuzzing
exercise. This macro will force the compiler to materialize the value
no matter what. It should be less prone to accidents compared to using
log functions, which would either slow things down or still optimize the
value away (or simply move it into the if branch the log macros create).

The benefit over assert_se would be that no requirement is made on the
value itself. If we are fine getting a string of any size (including
zero), an assert_se would either create a noisy compiler warning about
conditions that would alawys be met or yet again optimize the whole
thing away.

3 years agofuzz-bcd: Do not include bcd.c
Jan Janssen [Fri, 23 Sep 2022 07:47:26 +0000 (09:47 +0200)]
fuzz-bcd: Do not include bcd.c

This is not needed anymore, so do it the proper way now.

3 years agoAdd Asus G14 GA402 to hwdb
Albert Mikaelyan [Sat, 24 Sep 2022 22:18:26 +0000 (01:18 +0300)]
Add Asus G14 GA402 to hwdb

3 years agoMerge pull request #24811 from yuwata/build-without-openssl
Luca Boccassi [Sun, 25 Sep 2022 09:51:45 +0000 (10:51 +0100)]
Merge pull request #24811 from yuwata/build-without-openssl

meson,tpm2: fix build without openssl

3 years agosd-device: introduce device_get_sysattr_int()
Yu Watanabe [Sun, 25 Sep 2022 04:17:20 +0000 (13:17 +0900)]
sd-device: introduce device_get_sysattr_int()

3 years agotpm2-util: fix build with -Dopenssl=false
Yu Watanabe [Sat, 24 Sep 2022 22:41:07 +0000 (07:41 +0900)]
tpm2-util: fix build with -Dopenssl=false

Fixes #24800.

3 years agomeson: libfido2 requires openssl
Yu Watanabe [Sat, 24 Sep 2022 22:33:52 +0000 (07:33 +0900)]
meson: libfido2 requires openssl

Fixes compile error with -Dopenssl=false.
```
In file included from ../../home/watanabe/git/systemd/src/shared/pkcs11-util.h:12,
                 from ../../home/watanabe/git/systemd/src/cryptenroll/cryptenroll.c:24:
../../home/watanabe/git/systemd/src/shared/openssl-util.h:56:21: error: conflicting types for ‘X509’; have ‘struct X509’
   56 | typedef struct X509 X509;
      |                     ^~~~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/asn1.h:16,
                 from /usr/include/openssl/ec.h:17,
                 from /usr/include/fido.h:10,
                 from ../../home/watanabe/git/systemd/src/shared/libfido2-util.h:18,
                 from ../../home/watanabe/git/systemd/src/cryptenroll/cryptenroll-fido2.h:7,
                 from ../../home/watanabe/git/systemd/src/cryptenroll/cryptenroll.c:6:
/usr/include/openssl/ossl_typ.h:123:24: note: previous declaration of ‘X509’ with type ‘X509’ {aka ‘struct x509_st’}
  123 | typedef struct x509_st X509;
      |                        ^~~~
```

3 years agotmpfiles: fix wrong return value
Yu Watanabe [Sat, 24 Sep 2022 01:10:51 +0000 (10:10 +0900)]
tmpfiles: fix wrong return value

Follow-up for 27f6aa0b7112024c1236957abd909071b06869a8.

3 years agocore: respect SELinuxContext= for socket creation
Christian Göttsche [Fri, 23 Sep 2022 17:00:22 +0000 (19:00 +0200)]
core: respect SELinuxContext= for socket creation

On socket creation respect the SELinuxContext= setting of the associated
service, such that the initial created socket has the same label as the
future process accepting the connection (since w.r.t SELinux sockets
normally have the same label as the owning process).

Triggered by #24702

3 years agotree-wide: fix typo
Yu Watanabe [Sat, 24 Sep 2022 01:43:58 +0000 (10:43 +0900)]
tree-wide: fix typo

3 years agoMerge pull request #24799 from poettering/initrd-ftw
Luca Boccassi [Fri, 23 Sep 2022 19:43:15 +0000 (20:43 +0100)]
Merge pull request #24799 from poettering/initrd-ftw

use "initrd" rather than "initial RAM disk" or "initramfs" to refernce the concept

3 years agoMerge pull request #24635 from DaanDeMeyer/repart-verity-sig
Daan De Meyer [Fri, 23 Sep 2022 16:53:04 +0000 (18:53 +0200)]
Merge pull request #24635 from DaanDeMeyer/repart-verity-sig

repart: Add support for generating verity sig partitions

3 years agorepart: Add support for generating verity sig partitions
Daan De Meyer [Sun, 11 Sep 2022 08:49:24 +0000 (10:49 +0200)]
repart: Add support for generating verity sig partitions

3 years agoopenssl-util: Add x509_fingerprint()
Daan De Meyer [Fri, 23 Sep 2022 13:01:15 +0000 (15:01 +0200)]
openssl-util: Add x509_fingerprint()

3 years agoopenssl-util: Allow declaring openssl struct pointers without openssl
Daan De Meyer [Fri, 23 Sep 2022 12:17:20 +0000 (14:17 +0200)]
openssl-util: Allow declaring openssl struct pointers without openssl

3 years agoTODO
Lennart Poettering [Fri, 23 Sep 2022 14:12:54 +0000 (16:12 +0200)]
TODO

3 years agoMerge pull request #24700 from poettering/ssh-creds
Lennart Poettering [Fri, 23 Sep 2022 14:01:09 +0000 (16:01 +0200)]
Merge pull request #24700 from poettering/ssh-creds

support easy provisioning for SSH key of root user

3 years agoMerge pull request #24628 from medhefgo/boot-sections
Lennart Poettering [Fri, 23 Sep 2022 13:45:28 +0000 (15:45 +0200)]
Merge pull request #24628 from medhefgo/boot-sections

boot: Try to detect overlapping PE sections

3 years agoMerge pull request #24796 from yuwata/doc-update
Lennart Poettering [Fri, 23 Sep 2022 13:13:18 +0000 (15:13 +0200)]
Merge pull request #24796 from yuwata/doc-update

documentation updates