1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00
Commit Graph

59798 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
7c0e2b5559 units: add ordering dependencies on initrd-switch-root.target
For shutdown, we queue shutdown.target/start, so in every unit which should be
stopped *before* shutdown, we need both Conflicts and an ordering dependency
with shutdown.target (either Before= or After= would work, because stop jobs
are always ordered before start jobs).

For initrd transition, we queue initrd-switch-root.service/isolate. This
automatically creates a /stop job for every running unit without
IgnoreOnIsolate. But no ordering dependency is created, unless the unit has a
(possibly transitive) ordering dependency on initrd-switch-root.service.
Since most units must stop before the transition, we should add the ordering
dependency. It is nicer to use Before=initrd-switch-root.target for this.
initrd-switch-root.target is ordered before initrd-switch-root.service, so
the effect it the same when both are in a transaction.

Fixes #23745.

To also cover the case where somebody is emergency mode in the initrd and
queues initrd-switch-root.service/start (not isolate), also add
Conflicts=initrd-switch-root.target, so various units are stopped properly.
This extends 2525682565 to cover all the other
services that are touched. It could be consider "operator error", but it's
easy to make and it's nicer if we can make this more foolproof.
2022-09-15 14:59:11 +02:00
Zbigniew Jędrzejewski-Szmek
d5fd07cdee units/systemd-network-generator.service: add forgotten ordering for shutdown 2022-09-15 14:59:11 +02:00
Zbigniew Jędrzejewski-Szmek
9810e41942 units: reorder/split unit dependency blocks
The block is reordered and split to have:
  1. description + documentation
  2. (optionally) conditions
  3. all the dependencies
I think it's easier to read the units this way.
Also, the Conflicts+Before is seperated out to separate lines.
The ordering dependency is "fake", because it could just as well be
After=, we are adding it to force ordering wrt. shutdown.target, and
it plays a different role than the other Before=, which are about a
real ordering on boot.
2022-09-15 14:59:11 +02:00
Zbigniew Jędrzejewski-Szmek
d01d9197f5 TODO: various things about partitioning 2022-09-13 15:52:33 +01:00
Michal Sekletar
ab7ae746c6 logind: schedule idle check full interval from now if we couldn't figure out atime timestamp 2022-09-13 21:11:34 +09:00
Yu Watanabe
6f2d367e49
Merge pull request #24272 from dtardon/asserts
Use ASSERT_PTR more
2022-09-13 21:08:10 +09:00
Yu Watanabe
63d18b6cd0 boot: fix missing initialization
Fixes CID#1497847.
2022-09-13 21:06:05 +09:00
Yu Watanabe
e51bea3433
Merge pull request #24651 from yuwata/openssl-util
openssl-util: trivial cleanups
2022-09-13 21:05:42 +09:00
Yu Watanabe
35aefda35f creds-util: fix NULL pointer dereference
Fixes CID#1497840.
2022-09-13 21:05:16 +09:00
Yu Watanabe
2e64df07b8 openssl-util: use assert() if no side effect 2022-09-13 17:03:34 +09:00
Yu Watanabe
d39929d96d openssl-util: drop meaningless assertion
As the type of 'msz' is int.

Fixes CID#1497842.
2022-09-13 17:03:18 +09:00
David Tardon
48b7490985 dbus-execute: inline variable definition
Fixes a compiler warning:

../src/core/dbus-execute.c:460:22: error: unused variable 'c' [-Werror,-Wunused-variable]
        ExecContext *c = ASSERT_PTR(userdata);
2022-09-13 08:13:43 +02:00
David Tardon
c9958c4fc5 tree-wide: check parameter before dereferencing 2022-09-13 08:13:42 +02:00
David Tardon
995340074e tree-wide: use ASSERT_PTR more 2022-09-13 08:13:27 +02:00
Yu Watanabe
6d64cb0625
Merge pull request #23087 from yuwata/udev-watch
udev: resolve race in saving inotify watch handle
2022-09-12 23:41:00 +09:00
Yu Watanabe
75a5a143bb
Merge pull request #23043 from yuwata/udev-node-use-flock
udev-node: use flock() for symlink stack directory
2022-09-12 23:40:34 +09:00
Ansgar Burchardt
4167e2135e base-filesystem.c: add trailing zero byte for s390x entry 2022-09-12 23:35:09 +09:00
Hans de Goede
5092f7c86d hwdb: Fix Acer Aspire One AOD270/Packard Bell Dot keymappings
The Acer Aspire One AOD270 and the same hardware rebranded as
Packard Bell Dot SC need a couple of keymap fixups:

1. The switch-video-mode key does not do anything. Standard acer-wmi
   maps scancode 0x61 to KEY_IGNORE since typically these events are
   duplicate with the ACPI video bus. But on these models the ACPI video
   bus does not send events for this key, so map it.

2. The Brightness up / down hotkeys send atkbd scancode 0xce / 0xef
   which by default are mapped to KEY_KPPLUSMINUS and KEY_MACRO.
   These actually are duplicate events with the ACPI video bus,
   so map these to KEY_IGNORE.
2022-09-12 22:02:54 +09:00
Lennart Poettering
1135779156 update TODO 2022-09-12 11:03:42 +01:00
Lennart Poettering
4e0ceefeb6 update TODO 2022-09-12 00:13:44 +01:00
Yu Watanabe
ee27501225 test: add testcase for udev-watch 2022-09-12 01:36:06 +09:00
Yu Watanabe
3fb94c7062 sd-device: move device_new_from_watch_handle_at() to udev-watch.c
And drop unused watch handle related functions.
2022-09-12 01:36:06 +09:00
Yu Watanabe
790da548b0 udev: warn on udev_watch_{begin,end}() failure 2022-09-12 01:36:06 +09:00
Yu Watanabe
4443b1857b udev: drop unnecessary call of udev_watch_end()
As it is already called by udev_event_execute_rules().
2022-09-12 01:36:06 +09:00
Yu Watanabe
2369152394 udev: use rm_rf() to remove old watch directory 2022-09-12 01:36:02 +09:00
Yu Watanabe
691a596da1 udev-watch: remove symlink for saving inotify watch handle only when it is owned by the processing device
Before removing symlinks that stores watch handles, this makes udev
worker check if the symlink is owned by the processing device.
Then, we can avoid TOCTOU and drop the try-and-wait loop.

This partially reverts 2d3af41f0e.
2022-09-12 01:32:32 +09:00
Yu Watanabe
cd66f972d1 udev: ignore IN_IGNORED inotify event earlier 2022-09-12 01:23:08 +09:00
Yu Watanabe
ea8213dc47 udev: not necessary to return 1 from on_inotify() 2022-09-12 01:23:08 +09:00
Yu Watanabe
03f48fc7c3
Merge pull request #24637 from mrc0mmand/TEST-75-tweaks
test: make the resolved notifications check a bit more robust
2022-09-12 01:17:36 +09:00
Frantisek Sumsal
e3cccd3c2b test: make the resolved notifications check a bit more robust
Let's parse the resolved JSON notifications via `jq` and check them in a
bit more "controlled" manner - e.g. until now the `grep` was checking just
a one gigantic JSON string, as all received notifications via the
varlink socket are terminated by a NUL character, not a newline.

Also, as the notification delivery is asynchronous, retry the check
a couple of times if it fails (spotted in C8S jobs):

```
[ 2891.935879] testsuite-75.sh[36]: + : '--- nss-resolve/nss-myhostname tests'
[ 2891.935988] testsuite-75.sh[36]: + run getent -s resolve hosts ns1.unsigned.test
[ 2891.936542] testsuite-75.sh[177]: + getent -s resolve hosts ns1.unsigned.test
[ 2891.937499] testsuite-75.sh[178]: + tee /tmp/tmp.pqjNvbQ2eS
[ 2891.939977] testsuite-75.sh[178]: 10.0.0.1        ns1.unsigned.test
[ 2891.940258] testsuite-75.sh[36]: + grep -qE '^10\.0\.0\.1\s+ns1\.unsigned\.test' /tmp/tmp.pqjNvbQ2eS
[ 2891.942235] testsuite-75.sh[189]: + grep -qF '[10,0,0,1]'
[ 2891.942577] testsuite-75.sh[188]: + grep -aF ns1.unsigned.test /tmp/notifications.txt
[ 2891.943978] systemd[1]: testsuite-75.service: Child 36 belongs to testsuite-75.service.
[ 2891.944112] systemd[1]: testsuite-75.service: Main process exited, code=exited, status=1/FAILURE
[ 2891.944215] systemd[1]: testsuite-75.service: Failed with result 'exit-code'.
```
2022-09-11 14:29:34 +02:00
Frantisek Sumsal
7906b790e4 test: install jq into all images 2022-09-11 14:16:34 +02:00
Frantisek Sumsal
6c14f9ae57
Merge pull request #24593 from jamacku/main
Update `advanced-issue-labeler` action - `@v1` -> `@v2`
2022-09-10 19:42:26 +00:00
Lennart Poettering
251d2ea269 tpm2-util: avoid trial
Let's avoid trial mode for putting together policies if we can, and use
the real policy whenever we can pull it off.

Fixes: #24401
2022-09-10 20:58:41 +02:00
Yu Watanabe
706c9a30ac test-29-portable: set timeout for 'portablectl reattach'
Then, the test can fail earlier than the timeout of the whole test
specified by $QEMU_TIMEOUT=.

This is useful when we try to run the test multiple times.

Workaround for issue #24147.
2022-09-10 08:00:44 +00:00
Yu Watanabe
9a18458834
Merge pull request #24618 from yuwata/udev-split-synthesizing
udev: shorten synthesize_change() a bit
2022-09-10 02:52:54 +09:00
Yu Watanabe
86f9b69a6a blockdev-util: split out blockdev_reread_partition_table()
No functional changes, just refactoring.
2022-09-10 01:19:41 +09:00
Lennart Poettering
329984037b
Merge pull request #24458 from poettering/stub-embedd-sig
optionally, embed PCR signature and public key in new sd-stub PE sections
2022-09-09 18:18:37 +02:00
Yu Watanabe
9409174ee7 udevd: use partition enumerator at one more place
No functional changes, just refactoring.
2022-09-10 00:48:34 +09:00
Yu Watanabe
e97589cf38
Merge pull request #24609 from yuwata/sd-device-enumerator-check-sysname
sd-device-enumerator: check sysname earlier
2022-09-09 23:32:15 +09:00
Yu Watanabe
9cce72ee5d
Merge pull request #24611 from yuwata/loop-util-refactoring
loop-util: several cleanups
2022-09-09 23:31:19 +09:00
Yu Watanabe
e0993236d3 blockdevi-util: also check sysname when enumerating partitions 2022-09-09 22:30:19 +09:00
Yu Watanabe
88b5080ea9 sd-device-enumerator: use _cleanup_free_ attribute for safety
No functional changes, just improve readability.

Suggested by https://github.com/systemd/systemd/pull/24601#discussion_r966883459.
2022-09-09 21:16:37 +09:00
Yu Watanabe
89ad604839 sd-device-enumerator: always ignore ENOENT from opendir()
But logs all errors.
2022-09-09 21:16:37 +09:00
Yu Watanabe
0f519b9c2e sd-device-enumerator: check sysname earlier 2022-09-09 21:16:32 +09:00
Lennart Poettering
1d5f14ef3d update TODO 2022-09-09 11:53:06 +02:00
Lennart Poettering
6d856e26a7 man: say early what a unified kernel image/UKI is 2022-09-09 11:53:06 +02:00
Lennart Poettering
4889e809be man: be more careful regarding TPM vs. TPM2
We support PCR measurements for both classic TPM1.2 and TPM2, hence just
say "TPM" generically in that context. But the signed policies are
exclusive to TPM2, hence always say TPM2 there.

We mostly got that right, except at one place. Fix that.
2022-09-09 11:53:05 +02:00
Lennart Poettering
2deca517f6 man: document the new .pcrsig/.pcrpkey sections for unified kernel images 2022-09-09 11:53:05 +02:00
Lennart Poettering
f51b49c675 tmpfiles: copy PCR sig/pkey from initrd /.extra/ into /run/
Now that sd-stub will place the PCR signature and its public key in
the initrd's /.extra/ directory, let's copy it from there into /run/
from userspace. This is done because /.extra/ is on the initrd's tmpfs
which will be emptied during the initrd → host transition. Since we want
these two files to survive we'll copy them – if they exist – into /run/
where they will survive the transition.

Thus, with this last change the files will have safely propagated from
their PE sections into files in /run/ where userspace can find them

The paths in /run/ happen to be the exact ones that
systemd-cryptenroll/systemd-cryptsetup/systemd-creds look for them.
2022-09-09 11:31:04 +02:00
Lennart Poettering
23002b45b1 stub: pass .pcrsig and .pcrpkey PE sections as cpio into invoked kernel
Pick up the two new sections in sd-stub and pass them as initrds into
the booted kernels, where they'll show up as
/.extra/tpm2-pcr-signature.json and /.extra/tpm2-pcr-public-key.pem in
the initrd file system.

The initrd is then supposed to pick these files up from there and save
them at a place that will survive into the host OS.
2022-09-09 11:30:04 +02:00