Commit graph

56422 commits

Author SHA1 Message Date
Lennart Poettering bd4f672e4c
Merge pull request #22584 from poettering/systemctl-verb-renamed
systemctl: rename "verb" entrypoint functions systematically to verb_xyz()
2022-02-22 16:16:58 +01:00
Lennart Poettering c04c7c10c0 analyze: fix build on non-seccomp builds
Follow-up for #22585

See: https://github.com/systemd/systemd/pull/22585#issuecomment-1047658990
2022-02-22 16:15:52 +01:00
Lennart Poettering 623461c130 systemctl: rework daemon_reload() functions
Let's split out the inner parts of verb_daemon_reload() as a function
daemon_reload() and then stop using the former outside of the verbs
logic, and instead call the latter whenever we need to reload the daemon
as auxiliary opeation.

This should make our logic more systematic as we don't have to provide
fake or misleading argc/argv to verb_daemon_reload() anymore.
2022-02-22 14:15:08 +01:00
Lennart Poettering 32baf64d5a systemctl: systematically rename verb entrypoints verb_xyz()
Let's clean up our function naming a bit, and always name the
verb_xyz(), where the xyz maps to the command line verb as closely as
possible.

No actual code changes, just an attempt to make the systemctl sources a
bit more systematic, and less surprising.
2022-02-22 14:15:07 +01:00
Franck Bui c972880640 core: really skip automatic restart when a JOB_STOP job is pending
It's not clear why we rescheduled a service auto restart while a stop job for
the unit was pending. The comment claims that the unit shouldn't be restarted
but the code did reschedule an auto restart meanwhile.

In practice that was rarely an issue because the service waited for the next
auto restart to be rescheduled, letting the queued stop job to be proceed and
service_stop() to be called preventing the next restart to complete.

However when RestartSec=0, the timer expired right away making PID1 to
reschedule the unit again, making the timer expired right away... and so
on. This busy loop prevented PID1 to handle any queued jobs (and hence giving
no chance to the start rate limiting to trigger), which made the busy loop last
forever.

This patch breaks this loop by skipping the reschedule of the unit auto restart
and hence not depending on the value of u->restart_usec anymore.

Fixes: #13667
2022-02-22 11:45:12 +01:00
Ludwig Nussel 6d7127d6dd systemctl: improve error messages related to halt failures 2022-02-22 11:36:29 +01:00
Zbigniew Jędrzejewski-Szmek 22049270c0
Merge pull request #22585 from poettering/analyze-split-up
analyze: split out each verb into its own .c/.h pair
2022-02-22 11:02:57 +01:00
Lan Tian 70920214b6 hwdb: Force release calculator key on all HP OMEN laptops 2022-02-22 10:40:51 +01:00
prumian d9ab110ddc
hwdb: add CST Laser Trackball (#22583)
Set the default to 800DPI as this is what user manual suggests.
2022-02-22 07:47:39 +01:00
Lennart Poettering 0e48986961 env-util: drop unsetenv_erase()
Follow-up for: e99ca14741

Found by @grigorig: e99ca14741 (r67071855)
2022-02-21 23:08:34 +00:00
Lennart Poettering dc4864dd68 analyze: modernize pretty_boot_time() a bit
Use simple strextend() backed by dynamic memory instead of format string
logic with fixed buffer.
2022-02-21 17:22:23 +01:00
Lennart Poettering ef38bedbf9 analyze: systematically name verb entry point functions verb_xyz()
Some of the functions so far were named do_xyz(), others dump_xyz() and
even others test_xyz(). let's instead name them exactly like the verb
exposed in the command line, just prefixed with verb_
2022-02-21 17:22:23 +01:00
Lennart Poettering e82116e56b analyze: move "condition" verb into analyze-condition.[ch] 2022-02-21 17:22:23 +01:00
Lennart Poettering f2562398ea analyze: split out "verify" verb into own .c/.h file
This renames the old analyze-verify.[ch] pair →
analyze-verify-util.[ch], because it's used by the test logic as well,
and by keeping it separate from the verify verb logic we don't have to
import the arg_xyz variables.
2022-02-21 17:22:23 +01:00
Lennart Poettering 2acfc25225 analyze: move inspect-elf verb entrypoint into analyze-elf.[ch], too
like for the other verbs, let's move the whole entry point for the verb,
too.
2022-02-21 17:22:23 +01:00
Lennart Poettering 57a22a3f97 analyze: fully move "security" verb to analyze-security.[ch]
let's move the verb entropy point too, like for the other verbs now.
2022-02-21 17:22:23 +01:00
Lennart Poettering f24f8e3789 analyze: split out "time" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering ef215fa752 analyze: split out critical chain 2022-02-21 17:22:23 +01:00
Lennart Poettering 0c2d69df7f analyze: split out "unit-files" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering 36258fbe74 analyze: split out "unit-paths" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering faaa6ea076 analyze: split out log control verb 2022-02-21 17:22:23 +01:00
Lennart Poettering c649b343b4 analyze: split out cat-config verb 2022-02-21 17:22:23 +01:00
Lennart Poettering ba474dada8 analyze: split out "plot" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering 113dd9cbc4 analyze: split out "blame" verb + time helpers 2022-02-21 17:22:23 +01:00
Lennart Poettering 6488e8443b analyze: split out "capability" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering 73cb64c44d analyze: split out "exit-status" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering ab86ccbab0 analyze: highlight the range of deprecated verbs in comments a bit better 2022-02-21 17:22:23 +01:00
Lennart Poettering 2b04e72cd1 analyze: split out "service-watchdogs" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering cccd2af6f5 analyze: split out "dot" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering 25eb70af8b analyze: split out "dump" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering 389638d395 analyze: split out "syscall-filter" verb 2022-02-21 17:22:23 +01:00
Lennart Poettering 08e36480d4 analyze: split out "filesystems" verb into its own .c/.h file pair 2022-02-21 17:22:23 +01:00
Lennart Poettering 5229b03c10 analyze: split out calendar verb into own .c/.h file 2022-02-21 17:22:23 +01:00
Lennart Poettering 503ccaaa5b analyze: split out "timestamp" verb into its own .c/.h files 2022-02-21 17:22:23 +01:00
Lennart Poettering 30bddc066a analyze: split out "timespan" verb into its own .c/.h file 2022-02-21 17:22:23 +01:00
Lennart Poettering 67e993b9e0
Merge pull request #22573 from mrc0mmand/epoch-timestamp
time-util: introduce TIMESTAMP_UNIX
2022-02-21 16:13:47 +01:00
Frantisek Sumsal b58b4a9f37 systemctl,man: update docs for --timestamp= 2022-02-21 13:22:02 +01:00
Frantisek Sumsal ed4a5b4345 time-util: introduce TIMESTAMP_UNIX
Allow formatting timestamps as number of seconds since the Epoch for easier
machine parsing.

Fixes: #22567

```
$ systemctl show systemd-journald | grep Timestamp
WatchdogTimestampMonotonic=0
ExecMainStartTimestamp=Sat 2021-12-11 15:25:57 CET
ExecMainStartTimestampMonotonic=13030408
ExecMainExitTimestampMonotonic=0
StateChangeTimestamp=Sat 2021-12-11 15:25:57 CET
StateChangeTimestampMonotonic=13049273
InactiveExitTimestamp=Sat 2021-12-11 15:25:57 CET
InactiveExitTimestampMonotonic=13030430
ActiveEnterTimestamp=Sat 2021-12-11 15:25:57 CET
ActiveEnterTimestampMonotonic=13049273
ActiveExitTimestamp=Sat 2021-12-11 15:25:57 CET
ActiveExitTimestampMonotonic=12997236
InactiveEnterTimestamp=Sat 2021-12-11 15:25:57 CET
InactiveEnterTimestampMonotonic=13028890
ConditionTimestamp=Sat 2021-12-11 15:25:57 CET
ConditionTimestampMonotonic=13029539
AssertTimestamp=Sat 2021-12-11 15:25:57 CET
AssertTimestampMonotonic=13029540

$ systemctl show --timestamp=unix systemd-journald | grep Timestamp
WatchdogTimestampMonotonic=0
ExecMainStartTimestamp=@1639232757
ExecMainStartTimestampMonotonic=13030408
ExecMainExitTimestampMonotonic=0
StateChangeTimestamp=@1639232757
StateChangeTimestampMonotonic=13049273
InactiveExitTimestamp=@1639232757
InactiveExitTimestampMonotonic=13030430
ActiveEnterTimestamp=@1639232757
ActiveEnterTimestampMonotonic=13049273
ActiveExitTimestamp=@1639232757
ActiveExitTimestampMonotonic=12997236
InactiveEnterTimestamp=@1639232757
InactiveEnterTimestampMonotonic=13028890
ConditionTimestamp=@1639232757
ConditionTimestampMonotonic=13029539
AssertTimestamp=@1639232757
AssertTimestampMonotonic=13029540
```
2022-02-21 13:21:58 +01:00
Zbigniew Jędrzejewski-Szmek 521da4646e
Merge pull request #22579 from ml-/fix-discoverable-partitions-table
docs: fix discoverable partitions table
2022-02-21 09:02:05 +01:00
Matthias Lisin 7d5beae28c docs: swap Name and Partition Type UUID in header 2022-02-21 02:46:57 +01:00
Matthias Lisin 5fa87e9651 tools: adjust re.match to recent gpt.h additions
with addition of SD_ID128_MAKE_UUID_STR entries to src/shared/gpt.h the tool
failed halfway due to falsly matching the new entries
2022-02-21 02:35:26 +01:00
Lennart Poettering e99ca14741 env-util: replace unsetenv_erase() by new getenv_steal_erase() helper
The new helper combines a bunch of steps every invocation of
unsetenv_erase() did so far: getenv() + strdup() + unsetenv_erase().
Let's unify this into one helper that is harder to use incorrectly. It's
in inspired by TAKE_PTR() in a way: get the env var out and invalidate
where it was before.
2022-02-20 12:38:06 +09:00
Yu Watanabe 5cf84d2545 NEWS: fix typo 2022-02-20 11:10:44 +09:00
Luca Boccassi 21838f36a6 mkosi CI: mask isc-dhcp-server units
The packages are installed to provide the dhcpd binary, used by
test/test-network/systemd-networkd-tests.py, but we don't need the units
to run, and in fact in some cases the image fails to boot because of
them:

Spawning container image on /home/runner/work/systemd/systemd/image.raw.
Press ^] three times within 1s to kill container.
● isc-dhcp-server.service  loaded failed failed ISC DHCP IPv4 server
● isc-dhcp-server6.service loaded failed failed ISC DHCP IPv6 server
Container image failed with error code 1.
Error: Process completed with exit code 1.

Mask the units with an --extra-tree.
2022-02-19 14:01:17 +00:00
Frantisek Sumsal a59e5c625d systemctl: make --timestamp= affect the show verb as well
Currently the `--timestamp=` option has no effect on timestamps shown by
`systemctl show`, let's fix that.

Spotted in #22567.

Before:
```
$ systemctl show --timestamp=us+utc systemd-journald | grep Timestamp=
ExecMainStartTimestamp=Sat 2021-12-11 15:25:57 CET
StateChangeTimestamp=Sat 2021-12-11 15:25:57 CET
InactiveExitTimestamp=Sat 2021-12-11 15:25:57 CET
ActiveEnterTimestamp=Sat 2021-12-11 15:25:57 CET
ActiveExitTimestamp=Sat 2021-12-11 15:25:57 CET
InactiveEnterTimestamp=Sat 2021-12-11 15:25:57 CET
ConditionTimestamp=Sat 2021-12-11 15:25:57 CET
AssertTimestamp=Sat 2021-12-11 15:25:57 CET
```

After:
```
$ systemctl show --timestamp=us+utc systemd-journald | grep Timestamp=
ExecMainStartTimestamp=Sat 2021-12-11 14:25:57.177848 UTC
StateChangeTimestamp=Sat 2021-12-11 14:25:57.196714 UTC
InactiveExitTimestamp=Sat 2021-12-11 14:25:57.177871 UTC
ActiveEnterTimestamp=Sat 2021-12-11 14:25:57.196714 UTC
ActiveExitTimestamp=Sat 2021-12-11 14:25:57.144677 UTC
InactiveEnterTimestamp=Sat 2021-12-11 14:25:57.176331 UTC
ConditionTimestamp=Sat 2021-12-11 14:25:57.176980 UTC
AssertTimestamp=Sat 2021-12-11 14:25:57.176980 UTC

```
2022-02-19 10:16:30 +01:00
Jan Janssen b7de9651db generator: Rename password arg
This function does not expect a password, but a key file path. The
cryptsetup helper binary even calls it that.

No Code changes.

Follow up on: 6e41f4dd91
Fixes: https://github.com/systemd/systemd/security/code-scanning/81
2022-02-19 10:15:38 +01:00
Luca Boccassi 915e2786f4
Merge pull request #22546 from poettering/resolved-bus-error-reply-rework
resolved: rework how we reply to D-Bus messages for resolution requests
2022-02-18 22:20:17 +00:00
Lennart Poettering 2471a977b1 resolved: rework how we reply to D-Bus messages for resolution requests
This reworks how we reply to D-Bus messages that come in for resolution
requests. Previously, we'd store them in the .bus_request field of
the main DnsQuery (but not any auxiliary one), and reply to it whenever
we had something to reply. In error paths this could mean we'd
accidentally reply twice.

This cleans this logic up: whenever we reply to a message we'll now go up
the tree of auxiliary queries, to find the primary query, i.e. the one
we actually want to reply to. Once we found it, we take out the bus
message object, resetting it to NULL. This way we can be sure we'll
reply at most once to each message.

Fixes: #22477
2022-02-18 18:50:24 +01:00
Yu Watanabe 08275791d8 resolve: add reference of the original bus message to the aux queries
Otherwise, the error in aux queries cannot be replied.

Fixes #22477.
2022-02-18 18:13:20 +01:00
Lennart Poettering 2234cd6a0b
Merge pull request #22562 from poettering/logind-bool-fix
machined: fix confusion around "bool" and sd-bus
2022-02-18 14:39:44 +01:00