Commit graph

73135 commits

Author SHA1 Message Date
Lennart Poettering 3c64aca544 update TODO 2024-04-25 13:40:41 +02:00
Lennart Poettering be3444f119 execute: make ExecStatus dump more useful by showing passed time
Let's show the runtimes of our commands and preparations for them. It's
actually quite interesting, we sometimes are irritatingly slow with our
handoffs.
2024-04-25 13:40:41 +02:00
Lennart Poettering 2b5321817f swap: hook up with handoff timestamps 2024-04-25 13:40:41 +02:00
Lennart Poettering 19ae89869e mount: hook up with handoff timestamps 2024-04-25 13:40:41 +02:00
Lennart Poettering 1f41b10ee0 socket: hookup handoff timestamps with processes forked off by socket units 2024-04-25 13:40:41 +02:00
Lennart Poettering 3c1d1ca146 manager: switch service unit type over to using new handoff timestamping logic
Also: rename Handover → Handoff. I think it makes it clearer that this
is not really about handing over any resources, but that the executor is
out off the game from that point on.
2024-04-25 13:40:41 +02:00
Lennart Poettering 12001b1bf0 execute: send handoff timestamps from executor to service manager
This changes the executor to systematically send handoff timestamps to
the service manager if a socket for that is supplied. This drops the
code that did this via Type=exec messages, and reverts that part to the
old behaviour before 93cb78aee2.

Benefits of this approach:

1. We can collect the handoff for any command we fork off, regardless
   if it's ExecStart= something else, regardless whether it's Type=exec,
   Type=simple or some any other service type, regardless of the unit
   type.

2. We collect both CLOCK_REALTIME and CLOCK_MONOTONIC, as we do for the
   other process timestamps.

3. It's entirely backwards compatible, as this doesn't change the
   protocol between service manager and executor, but just extends it.
2024-04-25 13:33:03 +02:00
Lennart Poettering 817062e621 manager: add socket for receiving handoff timestamps from forked children
This adds an AF_UNIX socket pair to the manager that we can collect
handoff timestamp messages on.

The idea is that forked off children send a datagram with a timestamp
and we use its sender PID to match it against the right forked off
process.

This part only implements the receiving side: a socket is created, and
listened on. Received datagrams are parsed, verified and then dispatched
to the interested units.
2024-04-25 13:33:03 +02:00
Lennart Poettering 33fc8b0d95 core: fix assertions in manager_dispatch_user_lookup_fd()
assert_se() should not be used here, these checks are paranoia only and
have no side-effect after all.

hence fix this to use assert(), or in fact ASSERT_PTR()
2024-04-25 13:32:25 +02:00
Yu Watanabe 90db1582a9 run/run: fix invocation ID handling
Fixes a regression introduced by 8157cc0e3e.
2024-04-25 10:58:56 +02:00
Yu Watanabe 68ee2ba1ee
Merge pull request #32464 from YHNdnzj/journal-object-invocation-id
journal: small fixes for OBJECT_SYSTEMD_INVOCATION_ID
2024-04-25 06:40:45 +09:00
Rasmus Villemoes dc3058e490 systemctl: list-jobs: interchange 'waiting for' and 'blocking' in output
The current output of 'systemctl list-jobs' with the --after and/or --before
switches seems backwards. With artificial units

# check-oil.service
[Unit]
Description=Check the oil level
Before=engine-ready.target

# fill-gas.service
[Unit]
Description=Fill the tank with gasoline
Before=engine-ready.target

# engine-ready.target
[Unit]
Description=The engine is ready

[Unit]
Description=Start the engine!
After=engine-ready.target
Wants=engine-ready.target

running 'systemctl list-jobs --before --after' produces

JOB UNIT                                              TYPE  STATE
93  check-oil.service                                 start running
└─      waiting for job 94 (engine-ready.target/start)   -     -
102 fill-gas.service                                  start running
└─      waiting for job 94 (engine-ready.target/start)   -     -
94  engine-ready.target                               start waiting
└─      waiting for job 111 (start-engine.service/start) -     -
└─      blocking job 93 (check-oil.service/start)        -     -
└─      blocking job 102 (fill-gas.service/start)        -     -
111 start-engine.service                              start waiting
└─      waiting for job 1 (multi-user.target/start)      -     -
└─      blocking job 94 (engine-ready.target/start)      -     -

Obviously, job 93 is not waiting for job 94, but rather blocking it.
2024-04-24 21:31:28 +02:00
Luca Boccassi cea14db914
Merge pull request #32458 from poettering/manager_get_units_for_pidref
core: split out manager_get_units_for_pidref() and use it at multiple places
2024-04-24 21:28:52 +02:00
Lennart Poettering b9e4d9ba95 mount,swap: include ExecStatus output in dump
socket and service units output there ExecCommand/ExecStatus definitions
already, but this was missing in mount/swap. Fix that.
2024-04-24 21:23:42 +02:00
Daan De Meyer 2fcf8bf3b1
Merge pull request #32465 from CodethinkLabs/mkosi-debug
mkosi: Build images and run mkosi tests with --debug to aid debugging in CI
2024-04-24 21:02:41 +02:00
Daan De Meyer 1c3f34fc6d
Merge pull request #32461 from DaanDeMeyer/test-fixes
Various integration test fixes
2024-04-24 19:30:53 +02:00
Daan De Meyer 5ae6ff1258 TEST-50-DISSECT: Skip mutable sysext tests on virtiofs
virtiofs cannot be used as the upper fs for overlayfs, so skip all
the sysext mutable tests that would try to use virtiofs as the
upper fs.
2024-04-24 19:30:00 +02:00
Richard Maw 125b2fee18 test: Add --debug when running mkosi through integration-test-wrapper 2024-04-24 18:27:07 +01:00
Mike Yuan 3cb7fc5fcb
man/systemd.journal-fields: add missing OBJECT_SYSTEMD_INVOCATION_ID 2024-04-25 01:12:27 +08:00
Mike Yuan 6cb8286aa3
journald-server: drop spuriously doubled '=' for OBJECT_SYSTEMD_INVOCATION_ID 2024-04-25 00:56:04 +08:00
Richard Maw 4933a51dc8 mkosi: Build images with --debug to aid debugging in CI 2024-04-24 17:33:22 +01:00
Lennart Poettering 58290af48a manager: also port manager_dispatch_sigchld() to manager_get_units_for_pidref()
We have pretty much the same code here, let's reuse the common
implementation.
2024-04-24 18:24:22 +02:00
Lennart Poettering 4414bd5932 manager: split out helper that gets Unit objects with interest in given PidRef
This is both easier to read and allows us to reuse the helper later.
2024-04-24 18:10:35 +02:00
Zbigniew Jędrzejewski-Szmek c2e6ed612a
Merge pull request #32447 from keszybz/test-taint
core: drop unused param, move taint calculation to separate file
2024-04-24 18:09:57 +02:00
Luca Boccassi 2d0c95f2b2 ci: remove packages.microsoft.com
It is not needed, it publishes things like dotnet, and it is often
broken, so just remove the sources
2024-04-24 18:07:52 +02:00
Lennart Poettering f6519d47a7 manager: port user lookup fd serialization to serialize_fd_many() 2024-04-24 17:34:42 +02:00
Lennart Poettering c3ab362dad manager: comprehensively mark manager_dispatch_user_lookup_fd() as static
The prototype was static, but the implementation was not. Make both
static, this is otherwise too confusing. (This doesn't actually change
anything, since the prototype decides about this anyway, but it makes
things easier to read.)
2024-04-24 17:33:51 +02:00
Lennart Poettering fbe8f6928e capability-util: avoid thread_local
While stracing PID1's forking off of children I noticed that every
single forked off child reads cap_last_cap from procfs. That value is a
kernel constant, hence we can save a lot of work if we'd cache it.

Thing is, we actually do cache it, in a thread_local cache field. This
means that the forked off processes (which are considered new threads)
will have to re-query it, even though we already know the result.

Hence, let's get rid of the thread_local stuff (given that the value is
going to be the same for all threads anyway, and we pretty much have a
single thread only anyway). Use an C11 atomic_int instead, which ensures
the value is either initialized or not initialized, but we don't need to
be concerned of partial initialization.

This makes the cap_last_cap reading go away in the children, as strace
shows (since cap_last_cap() is already called by PID 1 before
fork()ing, anyway).
2024-04-24 17:33:38 +02:00
Mike Yuan 98cf76a4cc cryptenroll: fix typo (close parenthesis out of nowhere)
Follow-up for 8518f4a814
2024-04-24 17:32:56 +02:00
Lennart Poettering 1a6dceeca2 manager: use startswith() return value 2024-04-24 16:58:12 +02:00
Lennart Poettering 3a7bb5c99c manager: use proper unicode arrow in dump 2024-04-24 16:15:53 +02:00
Daan De Meyer c709499a4e TEST-50-DISSECT: Use --apparent-size when calling du
Otherwise if the file is full of holes we get the wrong size and
we'll fail later on.
2024-04-24 15:51:37 +02:00
Daan De Meyer 2a9184b902 TEST-50-DISSECT: Skip mountfsd test if the user namespace interface is not supported 2024-04-24 15:51:35 +02:00
Zbigniew Jędrzejewski-Szmek 2a6b4d872d core/taint: make short_uid_range() not take a path
As requested in review.
2024-04-24 15:17:49 +02:00
Zbigniew Jędrzejewski-Szmek d851637ca6 core: drop unused param, move taint calculation to separate file
Follow-up for 2b28dfe6e6.

I also considered moving the function to src/basic, but since it's only used by
the manager, it doesn't seem useful.
2024-04-24 15:17:49 +02:00
Lennart Poettering 07296542d6 exec-invoke: correct dont_close[] size
THis needs 15 entries as far as I can count, not just 14.

Follow-up for: 5686391b00

Sniff.
2024-04-24 15:09:28 +02:00
Daan De Meyer 82e00a3f62
Merge pull request #32449 from DaanDeMeyer/mkosi
Various mkosi fixes
2024-04-24 12:11:11 +02:00
Daan De Meyer 2c139de254 mkosi: Add attr
Required for messing around with xattrs in integration tests.
2024-04-24 12:09:12 +02:00
Daan De Meyer ab7253e1ec mkosi: Add nvme-cli
The nvme command is needed for TEST-84-STORAGETM.
2024-04-24 11:02:48 +02:00
Richard Maw fab270d73e mkosi: Add psmisc to opensuse for killall 2024-04-24 11:01:45 +02:00
Richard Maw f744ccd5fe mkosi: Add psmisc to debian-ubuntu for killall 2024-04-24 11:01:45 +02:00
Richard Maw bad25450b8 mkosi: Add psmisc to arch for killall 2024-04-24 11:01:45 +02:00
Richard Maw 2fd849016b test: Shut down tests on crash
If an assert in systemd fails it can't shut down normally.

By default it freezes. For interactive runs we want the crash shell
to enable further debugging, but during test runs we want it to exit
without having to wait for the test timeout.

By deactivating the crash shell, enabling reboot, and configuring qemu
so that it shuts down instead of rebooting we can shut down instead.

Because by default UEFI will enroll keys and then reboot
we also have to set --qemu-firmware-variables=custom
so it doesn't need to auto-enroll.

Because mkosi has to handle not receiving an EXIT_STATUS notification
it falls back to the exit code of qemu, which in the case of reboot
would be 0, we also override the success exit status to 123
and check that we got that as an exit code from mkosi.
2024-04-24 11:01:45 +02:00
Richard Maw 796cf1b483 test: document when writable /usr overlays may be needed 2024-04-24 11:01:45 +02:00
Richard Maw 0bc1e9592e mkosi: Update to latest 2024-04-24 11:01:35 +02:00
Yu Watanabe d3a4b78b03
Merge pull request #32424 from yuwata/network-radv-cleanups
network/radv: further cleanups
2024-04-24 17:51:47 +09:00
Frantisek Sumsal 8dd4e2b2a9
Merge pull request #32443 from weblate/weblate-systemd-main
Translations update from Fedora Weblate
2024-04-24 10:23:09 +02:00
Luca Boccassi c75c8a38b8 man: document service types that record ExecMainHandoverTimestamp
Follow-up for 93cb78aee2
2024-04-24 07:55:37 +02:00
Temuri Doghonadze fc82ac9864 po: Translated using Weblate (Georgian)
Currently translated at 100.0% (233 of 233 strings)

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ka/
Translation: systemd/main
2024-04-24 07:43:37 +02:00
Yuri Chornoivan 95d04e8d2b po: Translated using Weblate (Ukrainian)
Currently translated at 100.0% (233 of 233 strings)

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/uk/
Translation: systemd/main
2024-04-24 07:43:37 +02:00