Commit graph

74061 commits

Author SHA1 Message Date
Lennart Poettering 51a9a006a5 update TODO 2024-05-23 15:38:37 +02:00
Lennart Poettering b3efb67ddc tpm2-util: improve compat with older unlocking tools
Let's only generate the pin and pcrlock booleans if they are enabled, in
order to not unnecessarily confuse older unlocking tools.
2024-05-23 15:38:37 +02:00
Lennart Poettering 360198efc3 tpm2-util: do not serialize tpm2 bank if none is specified
If both literal and signed PCR bindings are not used then we won't
determine a PCR bank to use, and hence we shouldnt attempt to serialize
it either.

Hence, if the bank is zero, skip serialization.

(And while we are at it, also skip serialization of the primary
algorithm if not set, purely to make things systematic).

[This effectively results in little change, as previously we'd then
seralize a json "null", while now we simply won't genreate the field]
2024-05-23 15:38:37 +02:00
Lennart Poettering 96bf8aa051 cryptenroll: explicitly pick PCR bank if literal PCR binding is off, but signed PCR binding is on
We so far derived the PCR bank to use from the PCR values specified fr
literal PCR binding. However, when that's not used then we left the bank
uninitialized – which will break if signed PCR binds are used (where we
need to pick a bank too after all).

Hence, let's explicitly pick a bank to use if literal PCR values are not
used, to make things just work.

Fixes: #32946
2024-05-23 13:53:22 +02:00
Luca Boccassi a3680a45d0 NEWS: finalize for v256~rc3 2024-05-22 23:17:03 +01:00
Luca Boccassi 7bfef1d21e
Merge pull request #32986 from bluca/chores
Chores for RC3
2024-05-23 00:13:35 +02:00
Luca Boccassi ea8acb07bf meson: set version to 256~rc3 2024-05-22 21:25:35 +01:00
Luca Boccassi 55435a9eb2 Update autosuspend hwdb
ninja -C build update-hwdb-autosuspend
2024-05-22 21:17:24 +01:00
Luca Boccassi def9ccf028 Update hwdb
ninja -C build update-hwdb
2024-05-22 21:16:39 +01:00
Luca Boccassi 3bc0e89a3a NEWS: update contributors list 2024-05-22 21:14:22 +01:00
Michal Sekletar 9d8533b715 libsystemd: link with '-z nodelete'
We want to avoid reinitialization of our global variables with static
storage duration in case we get dlopened multiple times by the same
application. This will avoid potential resource leaks that could have
happened otherwise (e.g. leaking journal socket fd).
2024-05-22 22:09:25 +02:00
Christian Göttsche 9fb2db89e3 sd-bus: close peer pidfd
Do not leak the pidfd of the peer.

Fixes: 71be64064c ("sd-bus: add pidfd to the sd_bus_creds structure")
2024-05-22 22:08:44 +02:00
Lennart Poettering f5faf4ec5b varlinkctl: when operating in --more mode, fail correcly on Varlink method error
In varlink.c we generally do not make failing callback functions fatal,
since that should be up to the app. Hence, in case of varlinkctl (where
we want failures to be fatal), make sure to propagate the error back
explicitly.

Before this change a failing call to "varlinkctl --more call …" would result in
a zero exit code. With this it will correctly exit with a non-zero exit
code.
2024-05-22 22:08:28 +02:00
Yu Watanabe a925620f5f sd-ndisc: do not print "(null)" in the log message
If we received RA with no flags set, or with an invalid preference,
previously "(null)" was printed.

Follow-up for 238ed432c3.

Fixes https://github.com/systemd/systemd/pull/32308#discussion_r1600940289.
2024-05-22 22:07:58 +02:00
Luca Boccassi 6840ecb8ef
Merge pull request #32945 from bluca/lxc_network_test
Fix tests and services with PrivateNetwork=yes running under LXC with AppArmor
2024-05-22 22:07:31 +02:00
Luca Boccassi 25d505ca1d
Merge pull request #32975 from yuwata/revert-soft-reboot-reordering
Revert soft-reboot unit reordering
2024-05-22 22:03:46 +02:00
Luca Boccassi 6ab21f20bd test: do not fail network namespace test with permission issues
When running in LXC with AppArmor we'll most likely get an error when creating
a network namespace due to a kernel regression in < v6.2 affecting AppArmor,
resulting in denials. Like other tests, avoid failing in case of permission
issues and handle it gracefully.
2024-05-22 16:51:38 +01:00
Yu Watanabe 37143fdf5a units: stop systemd-journald before systemd-soft-reboot.service
Typically, soft-reboot.target is never reached. So, without this change,
systemd-journald may be killed by PID1 on soft-reboot, and may cause
journal corruption.
2024-05-23 00:08:14 +09:00
Yu Watanabe a328b24edd man: swap the order of soft-reboot.service and .target
Follow-up for the previous revert commit.
2024-05-23 00:08:14 +09:00
Yu Watanabe 03a41c41ee Revert "units: do not soft-reboot before soft-reboot.target reached"
This reverts commit 4263d7617f.

Still I think this is the way to go. But the change was merged after -rc2,
and still discussion is continued. So, at least now let's revert it,
and do that after v256-final is released if approved.
2024-05-23 00:06:30 +09:00
Luca Boccassi 06384eb3c5 lock-util: do not expect EACCES when it cannot happen
As per the documentation, EACCES is only returned when F_SETLK is
used, and only on some platforms, which doesn't seem to include
Linux:

https://github.com/torvalds/linux/blob/master/fs/locks.c

F_OFD_SETLK is documented to only return EAGAIN, and F_SETLKW/F_OFD_SETLKW
are blocking operations so this logic doesn't apply to them in the
first place.

Hence, only automatically convert EACCES into EAGAIN for F_SETLK
operations, and propagate the original error in the other cases.

This is important because in some cases we catch permission errors
and gracefully fallback, which is not possible if the original error
is lost.

This is an issue in practice because, due to a kernel bug present
before v6.2, AppArmor denies locking on file descriptors to LXC
containers. We support all currently maintained LTS kernels,
including v6.1, where despite a lot of effort and attempts over almost
a year, the bugfix still hasn't been backported, as it is complex and
requires large changes to AppArmor.
On affected kernels, all services running with PrivateNetwork=yes
fail and do not recover, instead of the normal behaviour of gracefully
downgrading to PrivateNetwork=no.

The integration tests in the Debian CI fail due to this issue:

https://ci.debian.net/packages/s/systemd/testing/arm64/46828037/
2024-05-22 13:25:44 +01:00
Yu Watanabe 87ed87efe1 test: also flush and rotate journal before read
Follow-up for a610ba00d9.

Fixes #32890.
2024-05-22 12:42:09 +02:00
Yu Watanabe 505b20ecdd test: replace journal checkers with journalctl --follow + grep -m
Recently, for slow test environments, journalctl --sync was added to the
loop in the timeout. However, journalctl --sync may be slow in such systems,
and timeout easily triggered during syncing.
Hopefully, reading journal with --follow and grep the output with an expected
line should be efficient.

Hopefully fixes #32712.
2024-05-22 12:03:35 +02:00
Yu Watanabe ce2aade08c
Merge pull request #32963 from yuwata/test-64-btrfs
test: lock device during running cryptsetup
2024-05-22 08:06:46 +09:00
Yu Watanabe be43c9b029 test: lock device during running cryptsetup
On running cryptsetup, udevd detects two inotify events for the
underlying device. Running the test on enough fast host, the expected
symlinks based on UUID and disk label are created by the second event.

During processing a uevent for a device, udevd disables the inotify
watch for the device. If the test runs on slow system, the second
inotify event may comes during a udev worker processing the synthesized
uevent triggered by the first inotify event. Hence, no synthesized
uevent for the second inotify event will be generated, and the expected
symlinks will be never created.

To prevent the issue, we need to lock the device during cryptsetup
command is running.

Fixes #32913.
2024-05-22 05:37:02 +09:00
Yu Watanabe bb6ce6b6a4 Revert "test: wipe filesystem before moving to the next test case"
This reverts commit 301d7ee611.

This does not solve issue #32913.
2024-05-22 05:37:02 +09:00
Luca Boccassi 5e30e6e281 btrfs-util: add assert to fix Coverity warning
Coverity gets confused since the iterator change, so add an
assert to indicate that this is allocated if n_old_groups is > 0

CID#1545922

Follow-up for 125cca1b51
2024-05-21 22:17:09 +02:00
Yu Watanabe e603a438a7
Merge pull request #32962 from bluca/suse_mod
pkg/opensuse: switch to SHA1 fork
2024-05-22 04:39:08 +09:00
Luca Boccassi 2d988c149d
Merge pull request #32944 from yuwata/test-74
test: several changes for TEST-74-AUX-UTILS
2024-05-21 20:44:13 +02:00
Luca Boccassi 27b5ac39d1
Merge pull request #32954 from YHNdnzj/run-forwarder-exit
run: when disconnected from PTY forwarder, exit event loop if not --wait
2024-05-21 20:37:17 +02:00
Luca Boccassi 386dc7d0fd mkosi: explicitly install g++ in opensuse
Not pulled in by default at build time
2024-05-21 19:07:39 +01:00
Luca Boccassi 34977b7512 pkg/opensuse: switch to SHA1 fork
src.opensuse.org switched to SHA256, which means it can no longer be
used as a submodule in a SHA1 repository. Switch to a fork on Pagure
that gets synced across and is still SHA1:

https://code.opensuse.org/package/systemd.git
2024-05-21 18:22:21 +01:00
Zbigniew Jędrzejewski-Szmek dcbf670430
Merge pull request #32957 from mrc0mmand/fix-coverage-builds
test: make TEST-65-ANALYZE happy when built with gcov
2024-05-21 18:42:08 +02:00
Yu Watanabe a5edb9b7b1 test: wait a bit before stopping/killing service
Otherwise, when stopping the service, the last command may not be
started yet, and the service manager may not send SIGTERM signal to the
last command, but send SIGKILL on timeout.

===
May 21 08:23:24 test19-exit-cgroup.sh[437]: + disown
May 21 08:23:24 test19-exit-cgroup.sh[438]: + sleep infinity
May 21 08:23:24 test19-exit-cgroup.sh[437]: + systemd-notify --ready
May 21 08:23:24 test19-exit-cgroup.sh[437]: + sleep infinity
May 21 08:23:24 test19-exit-cgroup.sh[441]: + systemctl stop one
May 21 08:23:24 test19-exit-cgroup.sh[443]: + sleep infinity
(snip)
May 21 08:23:24 systemd[1]: one.service: Changed running -> stop-sigterm
May 21 08:23:24 systemd[1]: Stopping one.service - /tmp/test19-exit-cgroup.sh "systemctl stop one"...
May 21 08:23:24 systemd[1]: Received SIGCHLD from PID 441 (systemctl).
May 21 08:23:24 systemd[1]: Child 437 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 437 belongs to one.service.
May 21 08:23:24 systemd[1]: one.service: Main process exited, code=killed, status=15/TERM (success)
May 21 08:23:24 systemd[1]: Child 439 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 439 belongs to one.service.
May 21 08:23:24 systemd[1]: Child 441 (systemctl) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 441 belongs to one.service.
May 21 08:23:24 systemd[1]: Child 442 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 442 belongs to one.service.
(snip)
May 21 08:24:54 systemd[1]: one.service: State 'stop-sigterm' timed out. Killing.
May 21 08:24:54 systemd[1]: one.service: Killing process 443 (sleep) with signal SIGKILL.
May 21 08:24:54 systemd[1]: one.service: Changed stop-sigterm -> stop-sigkill
May 21 08:24:54 systemd[1]: Received SIGCHLD from PID 443 (sleep).
May 21 08:24:54 systemd[1]: Child 443 (sleep) died (code=killed, status=9/KILL)
May 21 08:24:54 systemd[1]: one.service: Child 443 belongs to one.service.
May 21 08:24:54 systemd[1]: one.service: Control group is empty.
May 21 08:24:54 systemd[1]: one.service: Failed with result 'timeout'.
May 21 08:24:54 systemd[1]: one.service: Service restart not allowed.
May 21 08:24:54 systemd[1]: one.service: Changed stop-sigkill -> failed
May 21 08:24:54 systemd[1]: one.service: Job 738 one.service/stop finished, result=done
May 21 08:24:54 systemd[1]: Stopped one.service - /tmp/test19-exit-cgroup.sh "systemctl stop one".
May 21 08:24:54 systemd[1]: one.service: Unit entered failed state.
May 21 08:24:54 systemd[1]: one.service: Releasing resources...
===

Fixes #32947.
2024-05-21 18:35:15 +02:00
Zbigniew Jędrzejewski-Szmek 9280b08664 logind: use SD_BUS_ERROR_ACCESS_DENIED
As requested in post-merge review
https://github.com/systemd/systemd/pull/32869#pullrequestreview-2068161094:
> NotInControl error is really about session controllers, but this here really
> is different.
2024-05-21 18:32:36 +02:00
Yu Watanabe 07cbd02e9a test: collect information about loopback device on failure 2024-05-21 23:13:45 +09:00
Yu Watanabe e504f5a339 test: wait for loop/backing_file attribute being removed
Hopefully fixes issue like
https://github.com/systemd/systemd/issues/32680#issuecomment-2120959238
https://github.com/systemd/systemd/issues/32680#issuecomment-2122074805
2024-05-21 23:13:38 +09:00
Yu Watanabe 4a8ca3c6d5 test: wait for unit generated from /proc/self/mountinfo to be unloaded
Fixes https://github.com/systemd/systemd/issues/32680#issuecomment-2120974685.
===
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2475]: + mountpoint /tmp/tmp.eaRV7lSbX2/mnt
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2476]: /tmp/tmp.eaRV7lSbX2/mnt is not a mountpoint
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2449]: + systemd-mount /dev/loop0 /tmp/tmp.eaRV7lSbX2/mnt
May 21 02:45:08 systemd-mount[2477]: Failed to start transient mount unit: Unit tmp-tmp.eaRV7lSbX2-mnt.mount was already loaded or has a fragment file.
===
2024-05-21 23:09:38 +09:00
Yu Watanabe ee213b54ae test: also run some basic test cases on nspawn 2024-05-21 23:09:38 +09:00
Yu Watanabe d67e86ed67 test: stop container when it is not necessary anymore 2024-05-21 23:09:38 +09:00
Mike Yuan d73a47d259
man/systemd-run: beef up info regarding interaction between --pty, --pipe, and --wait 2024-05-21 21:40:01 +08:00
Mike Yuan 2b4a691c32
run: when disconnected from PTY forwarder, exit event loop if not --wait
Follow-up for ade0789fab

The change in behavior was partly intentional, as I think
if both --wait and --pty are used, manually disconnecting
from PTY forwarder should not result in systemd-run exiting
with "Finished with ..." log. But we should check for
--wait here.

Closes #32953
2024-05-21 21:30:32 +08:00
Mike Yuan d735753256
ptyfwd: add missing assertions for pty_forward_new 2024-05-21 21:30:32 +08:00
Andika Triwidada 688b701168 po: Translated using Weblate (Indonesian)
Currently translated at 100.0% (233 of 233 strings)

Co-authored-by: Andika Triwidada <andika@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/id/
Translation: systemd/main
2024-05-21 22:14:23 +09:00
Zbigniew Jędrzejewski-Szmek 055b465a3f shared/mountpoint-util: for old kernels, assume "norecovery" is supported by btrfs
Fixup for e3828d7103, as requested in
https://github.com/systemd/systemd/pull/32892#issuecomment-2117903328.
2024-05-21 15:13:42 +02:00
Frantisek Sumsal d3c14f78cd test: add a brief comment for the chattr check
Addresses: https://github.com/systemd/systemd/pull/32907#discussion_r1605919598
2024-05-21 15:08:07 +02:00
Frantisek Sumsal 95400d1d83 test: make TEST-65-ANALYZE happy when built with gcov
systemd-analyze runs the generators in a sandbox, which makes gcov
unhappy since it can't update its counters. Let's "silence" gcov in this
particular case by telling it to look for gcov note files in /tmp (where
shouldn't be any, so gcov won't try to update any counters).
2024-05-21 15:04:22 +02:00
Zbigniew Jędrzejewski-Szmek 72192b6cc9
Merge pull request #32869 from keszybz/dbus-release-session
Allow pam stack to call ReleaseSession
2024-05-21 09:01:17 +02:00
Luca Boccassi 1bfa83e77d
Merge pull request #32942 from yuwata/test-journal-sync-more
test: sync journal before read
2024-05-20 22:55:54 +02:00
Yu Watanabe f8ef1df3d1 test: extend timeout for DHCP/NDisc tests
Fixes https://github.com/systemd/systemd/pull/32932#issuecomment-2120424121.
2024-05-20 22:55:07 +02:00