1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-01 09:47:35 +03:00

4389 Commits

Author SHA1 Message Date
Lennart Poettering
6528563e64 test: make sure --tpm2-device-key= works correctly in repart, too 2023-11-09 12:28:37 +01:00
Frantisek Sumsal
730ccf9681 test: use Type=notify together with busctl monitor
Let's use the newly gained feature of `busctl` and start is as a
Type=notify unit, which should make sure the unit is started only after
`busctl` is on the bus listening for messages.

This should help with a race spotted in CIs, where we continued too
early after starting `busctl monitor` and miss the emitted signals:

[   10.914831] testsuite-45.sh[694]: + systemd-run --unit busctl-monitor.service --service-type=exec busctl monitor --json=short '--match=type='\''signal'\'',sender=org.freedesktop.timesync1,member='\''PropertiesChanged'\'',path=/org/free>
[   11.064365] systemd[1]: Starting busctl-monitor.service...
[   11.064903] systemd[1]: Started busctl-monitor.service.
[   11.065192] testsuite-45.sh[740]: Running as unit: busctl-monitor.service; invocation ID: ee44a9d713c34b9a97e3e7f6f4fffe77
...
[   11.069255] testsuite-45.sh[694]: + timedatectl ntp-servers ntp99 10.0.0.1
[   11.077140] systemd-timesyncd[728]: Network configuration changed, trying to establish connection.
[   11.077461] testsuite-45.sh[694]: + assert_networkd_ntp ntp99 10.0.0.1
...
[   11.087418] testsuite-45.sh[694]: + assert_timesyncd_signal '2023-11-08 16:28:48.861455' LinkNTPServers 10.0.0.1
...
[   11.095543] testsuite-45.sh[694]: + for _ in {0..9}
[   11.095543] testsuite-45.sh[694]: + journalctl -q '--since=2023-11-08 16:28:48.861455' -p info _SYSTEMD_UNIT=busctl-monitor.service --grep .
[   11.193258] systemd-journald[375]: Received client request to sync journal.
[   11.112424] testsuite-45.sh[694]: + sleep .5
[   11.160318] dbus-daemon[465]: [system] Connection :1.56 (uid=0 pid=741 comm="/usr/bin/busctl monitor --json=short --match=type=") became a monitor.

Resolves: #29923
2023-11-09 00:00:27 +01:00
Frantisek Sumsal
9a42457bae test: drop some unnecessary quotes 2023-11-08 23:38:28 +01:00
Yu Watanabe
797b237c77 test: use wait-online 2023-11-09 07:16:56 +09:00
Yu Watanabe
e1d4613eaa test: prefix network config files with digits 2023-11-09 07:16:56 +09:00
Yu Watanabe
9bb589dc2d networkd-test.py: prefix .network and .netdev files with digits
Otherwise config files generated by systemd-network-generator may
match with the test interfaces.
2023-11-09 07:16:56 +09:00
Yu Watanabe
2e978188cb networkd-test.py: hide default .network files
To make the test works fine with -Ddefault-network=True.
2023-11-09 07:16:56 +09:00
Yu Watanabe
3aa47694d1 test-network: verify json format about DHCPv6 client status 2023-11-09 01:31:17 +09:00
Frantisek Sumsal
4e55082f74 test: retry the property check a couple of times
41e4ce06fe shortened existing sleeps, which resulted in the check being
sometimes done before the property had a chance to update. Let's do what
what we do with the rest of the checks and retry it a couple of times.

Resolves: #29923
2023-11-08 10:03:53 +00:00
Lennart Poettering
e3c5842732
Merge pull request #28519 from ddstreet/tpm2_external_seal
Update systemd-cryptenroll to enroll TPM using only public key
2023-11-08 10:28:28 +01:00
Yu Watanabe
9e6d587961 test: set working directory even if it is expected that the command fails
Otherwise, parsing may unexpectedly succeeds but fail to run writing
.network files with permission error.

Follow-up for 6bc5de53e8410fdec817300185b7ad72cd7775dd.
2023-11-08 08:07:27 +01:00
Yu Watanabe
c62345ffc7 tree-wide: fix typo 2023-11-08 14:57:33 +09:00
Luca Boccassi
ee32d7a640
Merge pull request #29915 from mrc0mmand/ntp-followups
timesync: fix PropertiesChanges signals for NTP properties
2023-11-07 22:38:23 +00:00
Luca Boccassi
00666ec71f
Merge pull request #6763 from kinvolk/iaguis/no-new-privs
core: allow using seccomp without no_new_privs when unprivileged
2023-11-07 21:34:49 +00:00
Frantisek Sumsal
9521574cd4 timesync: fix PropertiesChanges signals for NTP properties
As in their current form they didn't work at all:

systemd-timesyncd[190115]: Assertion 's' failed at src/libsystemd/sd-event/sd-event.c:3058, function sd_event_source_set_enabled(). Ignoring.
systemd-timesyncd[190115]: Failed to reenable system ntp server change event source!
systemd-timesyncd[190115]: Failed to enable ntp server defer event, ignoring: Invalid argument

This was also pointed out in the post-merge review [0].

Let's address this together with the rest of the comments, and add
some tests to make sure everything works as it should.

Resolves: #28770
Follow-up to: 8f1c446

[0] 8f1c446979 (r124147466)
2023-11-07 21:36:59 +01:00
Frantisek Sumsal
41e4ce06fe test: "prettify" the test a bit 2023-11-07 21:36:59 +01:00
Yu Watanabe
b86f60bfb3 network-generator: refuse unexpected trailing strings 2023-11-08 04:29:45 +09:00
Yu Watanabe
816c269e55 network-generator: allow to specify both IPv4 and IPv6 DNS servers
Follow-up for 923599523c10d8897551e081e6b00cd8002309c3.
2023-11-08 04:29:45 +09:00
Dan Streetman
803e95932f test: update TEST-70 with systemd-cryptenroll calculated TPM2 enrollment
Update test to check systemd-cryptenroll --tpm2-device-key= enrollment.
2023-11-07 12:29:36 -05:00
Dan Streetman
57f0786ee0 test: fix env var name of persistent handle used for testing so it is removed after test
The cleanup uses PERSISTENT_HANDLE while the test uses PERSISTENT, so change
the test to use PERSISTENT_HANDLE so it's cleaned up (i.e. removed from the
tpm) after the test.
2023-11-07 12:28:56 -05:00
Iago López Galeiras
e720cebf7c test-execute: add no_new_privs tests for SystemCallFilter
When starting a service with a non-root user and a SystemCallFilter and
other settings (like ProtectClock), the no_new_privs flag should not be set.

Also, test that CapabilityBoundingSet behaves correctly, since we need
to preserve some capabilities to do the seccomp filter and restore the
ones set by the service before executing.
2023-11-07 11:31:53 +01:00
Luca Boccassi
58a2ab5e9d
Merge pull request #29888 from mrc0mmand/network-generator
test: add a couple of tests for systemd-network-generator
2023-11-07 00:10:43 +00:00
Frantisek Sumsal
4457a2e0ee test: wait for the "latest" systemd-bsod message
Let's wait for the "latest" message systemd-bsod prints to the console
to appear, otherwise we might be too fast and take a console snapshot
before it contains all the information:

[   44.237788] testsuite-04.sh[1744]: + setterm --term linux --dump --file /tmp/console.dump
[   44.246089] systemd-bsod[1858]: QR code could not be printed, ignoring: Operation not supported
[   44.305692] testsuite-04.sh[1744]: + grep -aq 'The current boot has failed' /tmp/console.dump
[   44.308047] testsuite-04.sh[1744]: + grep -aq 'Service emergency message' /tmp/console.dump
[   44.311200] testsuite-04.sh[1744]: + grep -aq 'Press any key to exit' /tmp/console.dump
[   44.314359] testsuite-04.sh[1744]: + at_exit
[   44.315087] testsuite-04.sh[1744]: + local EC=1
[   44.315945] testsuite-04.sh[1744]: + [[ 1 -ne 0 ]]
[   44.316647] testsuite-04.sh[1744]: + [[ -e /tmp/console.dump ]]
[   44.318305] testsuite-04.sh[1744]: + cat /tmp/console.dump
[   44.319320] testsuite-04.sh[1871]:    The current boot has failed!
[   44.319970] testsuite-04.sh[1871]:    Service emergency message
2023-11-06 21:01:24 +00:00
Yu Watanabe
d377949085 test-network: test MultiPathRoute= via another interface
Prompted by https://github.com/systemd/systemd/pull/14194#issuecomment-1795489641.
2023-11-06 20:59:49 +00:00
Frantisek Sumsal
6bc5de53e8 test: add a couple of tests for systemd-network-generator
Only for ip= stuff, for now.
2023-11-06 21:38:14 +01:00
Frantisek Sumsal
7dafeb6d6b test: add test case for issue #29863 2023-11-06 20:26:53 +09:00
Frantisek Sumsal
0ffb690111 test: make the test happy with coverage builds
Bump the LimitFSIZE=, since the process needs to write quite a lot of
.gcda files, and suppress coverage errors with DynamicUser=true.
2023-11-05 00:32:04 +00:00
Yu Watanabe
ab8f553d1e sd-journal: rework generic_array_bisect()
- Rename generic_array_bisect_one() -> generic_array_bisect_step(), as there
  is also generic_array_bisect_plus_one(), so the original name is confusing.
- Make generic_array_bisect_step() return TEST_GOTO_NEXT or TEST_GOTO_PREVIOUS
  when the current array does not contain any matching entries.
- Make generic_array_bisect_step() symmetric with respect to the direction
  we are going to, except for the journal corruption handling.
- Make generic_array_bisect_step() gracefully handle journal corruptions,
  so the corruption handling in the caller side can be mostly dropped.
- Especially, when the last entry in an array is corrupted, previously
  we tried to find a valid entry sequentially from the end of the array,
  but now we anyway bisect the array. That should improve performance of
  reading corrupted journal files.
- Return earlier when no entry linked to the chained array (n == 0).
- Add many comments.

No behavior change unless journal is corrupted.
2023-11-04 11:01:30 +09:00
Frantisek Sumsal
12c2560997 test: wait for the nvme device to appear
Also, use a /dev/disk/by-id/ symlink to the device, which should be
predictable, unlike the /dev/nvmeX stuff.
2023-11-03 23:26:57 +00:00
Frantisek Sumsal
ebefce6eab test: add a couple of tests for systemd-bsod
Add some basic tests for systemd-bsod, mainly to have something to build on
for #29056.
2023-11-03 20:39:15 +00:00
Frantisek Sumsal
4e086c389a Revert "test: don't panic on soft lockups"
Let's put this back in, as it could help with occasional machine lock ups
on overloaded systems (and it didn't help with the original issue
anyway).

This reverts commit 3a89904e45cbbd96fb1c5d0768de5e5fcdaaa508.
2023-11-03 20:38:31 +00:00
Maanya Goenka
db776f6935 portable: add support for confext
Support confexts for portable services
2023-11-03 16:59:58 +00:00
Luca Boccassi
f0304df6e4 core: check that extensions have the hierarchies before overlaying
Before confext was added, hierarchies always existed in extensions. Now
they are optional - i.e., a sysext will not contain /etc/. So mixing a
confext and a sysext fails, as we'll try to create an overlay with /etc/
from the base, the confext and the sysext, but the latter doesn't have
the directory.

After the source images are mounted, check that each hierarchy exists in
each source image before creating the overlay, and drop them if they
don't.

Follow-up for 55ea4ef096543
2023-11-03 16:59:58 +00:00
Luca Boccassi
8d04721507
Merge pull request #28891 from poettering/pcrlock
new pcrlock tool for generating signed PCR policies for PCR 0, 1, 4, …
2023-11-03 16:07:43 +00:00
Frantisek Sumsal
d4317fe172 nspawn: allow disabling os-release check
Introduce a new env variable $SYSTEMD_NSPAWN_CHECK_OS_RELEASE, that can
be used to disable the os-release check for bootable OS trees. Useful
when trying to boot a container with empty /etc/ and bind-mounted /usr/.

Resolves: #29185
2023-11-03 16:05:14 +00:00
Lennart Poettering
3e6a25a6f3 test: add pcrlock integration test
(Contains various test additions added by @mrc0mmand)
2023-11-03 11:25:14 +01:00
Yu Watanabe
b94f59b9d5 network: make generated configs have higher precedence over default configs
We use 80- for default .network files. So, the generated files from the
kernel command line should have smaller prefix.
2023-11-03 11:42:19 +09:00
Luca Boccassi
d2e99d288e
Merge pull request #29792 from poettering/resolved-monitor-packet
resolved: make sure "resolvectl monitor" can properly deal with stub …
2023-11-02 20:43:19 +00:00
Frantisek Sumsal
a0e000076a test: check that resolvectl monitor --json generates valid JSON
Provides coverage for #29580.
2023-11-02 18:08:30 +01:00
Lennart Poettering
565b7c90eb test: add integration test for systemd-storagetm 2023-11-02 14:19:32 +01:00
Peter Hutterer
4f7a629e6c analyze: handle CAP_BPF support 2023-11-01 10:25:59 +00:00
Frantisek Sumsal
3d72a9645e test: exercise more systemd-executor related stuff 2023-10-31 18:52:00 +01:00
Frantisek Sumsal
72d50da4f6 test: skip SocketBind*= tests when built without a bpf framework
The test intentionally checks for -BPF_FRAMEWORK so we run the test case
(and fail) even if we rename the feature flag.
2023-10-31 17:36:03 +01:00
Lennart Poettering
b3634c45d7 network-generator: add support for ip=link-local 2023-10-31 11:03:49 +01:00
Yu Watanabe
d19434fbf8 tree-wide: fix typo 2023-10-31 14:35:33 +09:00
Frantisek Sumsal
33b0e0c09a test-network: copy rules from source & build trees if needed
When running with --build-dir= we need to copy over udev rules from
$BUILD_DIR/udev.d/ and $SOURCE_TREE/udev.d/ to make stuff work as
expected.
2023-10-30 21:13:00 +00:00
Frantisek Sumsal
d203e5e008 test: add one missing cleanup
So the test doesn't fail when run multiple times with the same image.
2023-10-30 22:37:08 +09:00
Luca Boccassi
7b6d3dcdd2 exec-invoke: don't double-close FDs on error
When a late error occurs in sd-executor, the cleanup-on-close of the
context structs happen, but at that time all FDs might have already
been closed via close_all_fds(), so a double-close happens. This
can be seen when DynamicUser is enabled, with a non-existing
WorkingDirectory.

Invalidate the FDs in the context structs if close_all_fds succeeds.
2023-10-28 16:56:25 +02:00
Luca Boccassi
3ad5aedadc test: io.latency cgroup support might not be available, skip test
It doesn't seem to be enabled on Debian stable, and the test fails.

Follow-up for 5efc8183c9cf9b
2023-10-28 08:08:42 +00:00
Yu Watanabe
2aa246e88f
Merge pull request #29693 from rpigott/dhcp-rapid-commit
network: implement RFC4039 DHCP Rapid Commit
2023-10-28 10:23:23 +09:00