]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 months agotree-wide: extend the comment about the issue in __convert_scm_timestamps() 36905/head
Yu Watanabe [Mon, 31 Mar 2025 14:19:52 +0000 (23:19 +0900)] 
tree-wide: extend the comment about the issue in __convert_scm_timestamps()

7 months agocore/manager: update comment
Yu Watanabe [Mon, 31 Mar 2025 14:02:49 +0000 (23:02 +0900)] 
core/manager: update comment

7 months agoREADME: fix version of SO_BINDTOIFINDEX
Yu Watanabe [Mon, 31 Mar 2025 13:52:40 +0000 (22:52 +0900)] 
README: fix version of SO_BINDTOIFINDEX

Follow-up for 33746caf8fe51fe4e89fd7f2f459f06c34fbd175.

7 months agomissing_socket: drop unnecessary definitions and update comments
Yu Watanabe [Mon, 31 Mar 2025 13:49:37 +0000 (22:49 +0900)] 
missing_socket: drop unnecessary definitions and update comments

- SO_PEERGROUPS is since kernel v4.13
  (28b5ba2aa0f55d80adb2624564ed2b170c19519e),
- SO_BINDTOIFINDEX is since kernel v5.1
  (f5dd3d0c9638a9d9a02b5964c4ad636f06cf7e2c).

7 months agoREADME: note min kernerl version for SO_BINDTOIFINDEX
Luca Boccassi [Mon, 31 Mar 2025 13:06:54 +0000 (14:06 +0100)] 
README: note min kernerl version for SO_BINDTOIFINDEX

Prompted by https://github.com/systemd/systemd/pull/36893

7 months agowatchdog: fix typo
Yu Watanabe [Mon, 31 Mar 2025 12:26:57 +0000 (21:26 +0900)] 
watchdog: fix typo

Follow-up for ab596e4cde5d4b55be5182a8d5554e3e97366131.

7 months agoLog message improvements (#35237)
Yu Watanabe [Mon, 31 Mar 2025 12:23:23 +0000 (21:23 +0900)] 
Log message improvements (#35237)

Various improvements to log messages. Inspired by
https://bugzilla.redhat.com/show_bug.cgi?id=2327296.

7 months agohomed: move things over to quotactl_fd() (#36902)
Yu Watanabe [Mon, 31 Mar 2025 12:15:03 +0000 (21:15 +0900)] 
homed: move things over to quotactl_fd() (#36902)

Let's use quotactl_fd() wherever we can, it's 2025. quotactl() is such a
mess after all.

7 months agopcrextend: whenever we fail to extend PCRs, reboot immediately
Lennart Poettering [Tue, 11 Mar 2025 16:28:47 +0000 (17:28 +0100)] 
pcrextend: whenever we fail to extend PCRs, reboot immediately

PCR extensions are supposed to be useful for "destroying" the ability to
access TPM bound secrets. Hence, if for some reason we fail to extend a
PCR, it's safer to just reboot, instead of going on without the
extension, leaving secrets potentially accessible which should not be
accessible.

Note that the services exit gracefully if no TPM is found, hence this
should not be triggered on TPM-less systems. However, this enforces that
if there is a TPM that is accessible to Linux and that works properly,
the PCR measurement must complete too.

Inspired by this thread:

https://lists.freedesktop.org/archives/systemd-devel/2025-March/051244.html

7 months agosocket-proxy: add syntax highlighting to help output
Busayo Dada [Mon, 24 Mar 2025 21:19:41 +0000 (22:19 +0100)] 
socket-proxy: add syntax highlighting to help output

7 months agohomed: don't log error we don't have 36902/head
Lennart Poettering [Mon, 31 Mar 2025 09:51:38 +0000 (11:51 +0200)] 
homed: don't log error we don't have

7 months agohomed: always use quotactl_fd() if its available
Lennart Poettering [Mon, 31 Mar 2025 09:47:17 +0000 (11:47 +0200)] 
homed: always use quotactl_fd() if its available

Let's always prefer quotactl_fd() when it's available and use quotactl()
only as as a fallback on old kernels.

This way we can operate on the fds we typically already have open, or if
needed we can open a new one, and use for multiple fs operation.

In the long run we should really focus on operating exclusively by fd
instead of by path, by device nor or otherwise. This gets us a step
closer to that.

7 months agotest: skip networkd tests if networkd/resolved are disabled at build time
Luca Boccassi [Sat, 29 Mar 2025 17:56:04 +0000 (17:56 +0000)] 
test: skip networkd tests if networkd/resolved are disabled at build time

7 months agotest: skip TEST-75-RESOLVED if resolved is disabled at build time
Luca Boccassi [Sat, 29 Mar 2025 17:55:45 +0000 (17:55 +0000)] 
test: skip TEST-75-RESOLVED if resolved is disabled at build time

7 months agosd-bus/bus-common-errors: add missing error map entries
Mike Yuan [Fri, 21 Mar 2025 00:59:03 +0000 (01:59 +0100)] 
sd-bus/bus-common-errors: add missing error map entries

7 months agomeson: add feature flag for nspawn build (#36876)
Luca Boccassi [Fri, 28 Mar 2025 13:55:19 +0000 (13:55 +0000)] 
meson: add feature flag for nspawn build (#36876)

Other tools have it, nspawn doesn't, add one

7 months agomkosi: Use build image prepare scripts for tools tree as well (#36861)
Luca Boccassi [Fri, 28 Mar 2025 13:31:28 +0000 (13:31 +0000)] 
mkosi: Use build image prepare scripts for tools tree as well (#36861)

Instead of listing dependencies manually for the default tools tree,
let's reuse the prepare scripts from the build image. To make this work,
the sync script has to be configured for the tools tree as well so that
it's invoked both when building the tools tree and for the regular
image,
otherwise, when doing the first build in a fresh checkout, the sync
script
won't have executed yet as sync scripts for the regular images are
executed
after building the default tools tree.

7 months agotest: Drop --no-rebuild from meson test invocations
Daan De Meyer [Fri, 28 Mar 2025 11:35:54 +0000 (12:35 +0100)] 
test: Drop --no-rebuild from meson test invocations

With meson 1.7.0, meson won't rebuild the world anymore when running
meson test so since meson 1.7.0 is in tumbleweed, debian testing, fedora
rawhide and Arch Linux, drop --no-rebuild from the docs since all the default
tools trees built by mkosi in the systemd repo will have meson 1.7.0 or newer
installed.

We keep --no-rebuild in CI because in CI we run with the same tools tree
distribution as the target distribution we're building and in those it's not
guaranteed for meson 1.7.0 to be available yet.

The advantage of dropping --no-rebuild is that meson will now reconfigure itself
if needed, which is required if we change or move around meson files, as otherwise
meson tends to explode spectacularly in hard to debug ways.

https://mesonbuild.com/Release-notes-for-1-7-0.html#test-targets-no-longer-built-by-default

7 months agomkosi: Use build image prepare scripts for tools tree as well 36861/head
Daan De Meyer [Tue, 25 Mar 2025 20:02:24 +0000 (21:02 +0100)] 
mkosi: Use build image prepare scripts for tools tree as well

Instead of listing dependencies manually for the default tools tree,
let's reuse the prepare scripts from the build image. To make this work,
the sync script has to be configured for the tools tree as well so that
it's invoked both when building the tools tree and for the regular image,
otherwise, when doing the first build in a fresh checkout, the sync script
won't have executed yet as sync scripts for the regular images are executed
after building the default tools tree.

7 months agotest: Use /dev/shm for TEST_JOURNAL_USE_TMP if /tmp isn't tmpfs
Daan De Meyer [Thu, 27 Mar 2025 15:10:03 +0000 (16:10 +0100)] 
test: Use /dev/shm for TEST_JOURNAL_USE_TMP if /tmp isn't tmpfs

If /dev/shm is a tmpfs and /tmp isn't, use /dev/shm instead.

7 months agotest: Mark tests as skipped if requirements were not satisfied
Daan De Meyer [Thu, 27 Mar 2025 14:53:28 +0000 (15:53 +0100)] 
test: Mark tests as skipped if requirements were not satisfied

Instead of not creating the test at all, let's always create test but
simply mark them as skipped as this is more observable than simply not
creating the test at all.

7 months agoTEST-06-SELINUX: Only enable if meson was invoked as root
Daan De Meyer [Thu, 27 Mar 2025 14:49:06 +0000 (15:49 +0100)] 
TEST-06-SELINUX: Only enable if meson was invoked as root

This test only works if the image was built as root. Since that's
impossible to check as meson generally runs before we build the image,
let's use whether meson is run as root as a proxy.

7 months agotest: Boot integration test VMs without an initrd if possible
Daan De Meyer [Thu, 27 Mar 2025 13:24:28 +0000 (14:24 +0100)] 
test: Boot integration test VMs without an initrd if possible

If we don't need an initrd, let's not waste time in one. We have to
gate this by distributions that have the necessary kernel modules to
make this work as builtin modules, hopefully we can expand the list in
the future.

7 months agomkosi: Bump minimum version to 25~devel
Daan De Meyer [Fri, 28 Mar 2025 10:40:20 +0000 (11:40 +0100)] 
mkosi: Bump minimum version to 25~devel

7 months agotest: always install test-resolve subdir 36876/head
Luca Boccassi [Fri, 28 Mar 2025 03:12:12 +0000 (03:12 +0000)] 
test: always install test-resolve subdir

Content is also used by unit tests, not just resolved tests,
so they are needed even when resolved is disabled, as unit
tests are still built and run

7 months agomeson: add feature flag for nspawn build
Luca Boccassi [Thu, 27 Mar 2025 23:51:17 +0000 (23:51 +0000)] 
meson: add feature flag for nspawn build

Other tools have it, nspawn doesn't, add one

7 months agomkosi: Mark /etc /var as updated in a finalize script
Daan De Meyer [Thu, 27 Mar 2025 13:31:55 +0000 (14:31 +0100)] 
mkosi: Mark /etc /var as updated in a finalize script

Let's make sure we don't run ldconfig.service and other services
again on first boot.

7 months agomkosi: Disable various extra things in the default preset
Daan De Meyer [Thu, 27 Mar 2025 12:18:45 +0000 (13:18 +0100)] 
mkosi: Disable various extra things in the default preset

7 months agomkosi: Remove debian/ubuntu pinning
Daan De Meyer [Tue, 25 Mar 2025 19:41:24 +0000 (20:41 +0100)] 
mkosi: Remove debian/ubuntu pinning

mkosi does this natively now.

7 months agomkosi: Update to latest
Daan De Meyer [Tue, 25 Mar 2025 20:28:06 +0000 (21:28 +0100)] 
mkosi: Update to latest

7 months agotest/README.md: mention `mkosi genkey`
Allison Karlitskaya [Fri, 28 Mar 2025 07:53:46 +0000 (08:53 +0100)] 
test/README.md: mention `mkosi genkey`

This is a required first step before testing and it's not specifically
mentioned in the doc.  This tripped me up for a while, so let's save the
trouble for the next person.

7 months agomkosi: update fedora commit reference (#36875)
Luca Boccassi [Fri, 28 Mar 2025 02:06:06 +0000 (02:06 +0000)] 
mkosi: update fedora commit reference (#36875)

617952132d Run integration testsuite standalone if available

7 months agomkosi: update fedora commit reference 36875/head
Daan De Meyer [Thu, 27 Mar 2025 20:49:47 +0000 (21:49 +0100)] 
mkosi: update fedora commit reference

617952132d Run integration testsuite standalone if available

7 months agotest: Fix symlink location of standalone tests
Daan De Meyer [Thu, 27 Mar 2025 21:48:42 +0000 (22:48 +0100)] 
test: Fix symlink location of standalone tests

This was accidentally moved to the wrong folder so fix up the location
so it's located in the standalone/ folder as expected.

7 months agotest: Make it possible to run the integration tests standalone (#36868)
Daan De Meyer [Thu, 27 Mar 2025 20:38:00 +0000 (21:38 +0100)] 
test: Make it possible to run the integration tests standalone (#36868)

Currently, to run the integration tests, it's still necessary to
install various other build tools besides meson: A compiler, gperf,
libcap, ... which we want to avoid in CI systems where we receive
prebuilt systemd packages and only want to test them. Examples are
Debian's autopkgtest CI and Fedora CI. Let's make it possible for
these systems to run the integration tests without having to install
any other build dependency besides meson by extracting the logic
required to run the integration tests with meson into a separate
subdirectory and adding a standalone top-level meson.build file which
can be used to configure a meson tree with as its only purpose running
the integration tests.

Practically, we do the following:
- all the integration test directories and integration-test-wrapper.py
  are moved from test/ to test/integration-tests/.
- All the installation logic is kept out of test/integration-tests/ or
  any of its subdirectories and moved into test/meson.build instead.
- We add test/integration-tests/standalone/meson.build to run the
  integration tests standalone. This meson file includes
  test/integration-tests via a cute symlink hack to trick meson into
  including a parent directory with subdir().
- Documentation is included on how to use the new standalone mode.

7 months agotest: Make it possible to run the integration tests standalone 36868/head
Daan De Meyer [Wed, 26 Mar 2025 13:30:20 +0000 (14:30 +0100)] 
test: Make it possible to run the integration tests standalone

Currently, to run the integration tests, it's still necessary to
install various other build tools besides meson: A compiler, gperf,
libcap, ... which we want to avoid in CI systems where we receive
prebuilt systemd packages and only want to test them. Examples are
Debian's autopkgtest CI and Fedora CI. Let's make it possible for
these systems to run the integration tests without having to install
any other build dependency besides meson by extracting the logic
required to run the integration tests with meson into a separate
subdirectory and adding a standalone top-level meson.build file which
can be used to configure a meson tree with as its only purpose running
the integration tests.

Practically, we do the following:
- all the integration test directories and integration-test-wrapper.py
  are moved from test/ to test/integration-test/.
- All the installation logic is kept out of test/integration-test/ or
  any of its subdirectories and moved into test/meson.build instead.
- We add test/integration-test/standalone/meson.build to run the
  integration tests standalone. This meson file includes
  test/integration-test via a cute symlink hack to trick meson into
  including a parent directory with subdir().
- Documentation is included on how to use the new standalone mode.
- TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate
  units for each testcase to make them behave more like the other integration
  tests.

7 months agogpt-auto-generator: improve log message 35237/head
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 16:06:48 +0000 (17:06 +0100)] 
gpt-auto-generator: improve log message

We said "exiting", but then the program continues to do other operations
and log additional messages.

7 months agoshared/exec-util: fix logging of the args of an executed program
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 15:56:17 +0000 (16:56 +0100)] 
shared/exec-util: fix logging of the args of an executed program

The debug logs has lots of "About to execute /some/path (null)". This
occurs when the args array is empty. Instead, only print "(null)" if
we failed with oom.

Having strv_skip() return NULL makes this pleasant to write without repeating
strv_isempty() a few times.

7 months agotest-execve: minor simplification
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 15:51:39 +0000 (16:51 +0100)] 
test-execve: minor simplification

7 months agovarious: handle the positive condition after strv_skip() first
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 15:51:27 +0000 (16:51 +0100)] 
various: handle the positive condition after strv_skip() first

7 months agobusctl: use RET_GATHER
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 15:27:50 +0000 (16:27 +0100)] 
busctl: use RET_GATHER

7 months agobusctl: use STRV_FOREACH in the usual fashion
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 15:26:03 +0000 (16:26 +0100)] 
busctl: use STRV_FOREACH in the usual fashion

Also put positive branch first, do not use 'i' as a char** variable name.

7 months agoanalyze: use STRV_FOREACH in consistent fashion
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 14:48:31 +0000 (15:48 +0100)] 
analyze: use STRV_FOREACH in consistent fashion

Also put positive condition first.

7 months agobasic/strv: return NULL from strv_skip
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 14:41:22 +0000 (15:41 +0100)] 
basic/strv: return NULL from strv_skip

strv_skip was written to carefully return the original array, but this turns
out to be an unnecessary complication. After the previous patch, no caller
cares about the distinction between NULL and { NULL }, but various callers need
to wrap the process the returned value with strv_isempty(), sometimes more than
once. Let's always return NULL for an empty result to allow callers to be
simplified.

7 months agoac-power: update the help output to use the ansi-color functions
ZIHCO [Wed, 26 Mar 2025 19:50:15 +0000 (20:50 +0100)] 
ac-power: update the help output to use the ansi-color functions

7 months agocore: drop manager_get_unit_by_pid() and friends (#36872)
Yu Watanabe [Wed, 26 Mar 2025 21:10:53 +0000 (06:10 +0900)] 
core: drop manager_get_unit_by_pid() and friends (#36872)

Except for one place, they are only used by test-watch-pid. Let's also
use manager_get_unit_by_pidref() and friends in the test, and drop the
_pid() variants.

7 months agocore/cgroup: Properly handle aborting a pending freeze operation
msizanoen [Tue, 18 Mar 2025 05:47:21 +0000 (12:47 +0700)] 
core/cgroup: Properly handle aborting a pending freeze operation

We must thaw the cgroup even if cgroup.events/frozen=0 if a freeze
operation is in flight as it means the cgroup is already partially
frozen.

7 months agocoredump: make sure pid1/journal coredumps are not lost when Storage=journal is selec...
Yu Watanabe [Wed, 26 Mar 2025 19:27:01 +0000 (04:27 +0900)] 
coredump: make sure pid1/journal coredumps are not lost when Storage=journal is selected (#36870)

It confused the hell of me, that if pid1 crashes in an mkosi system run
from the build tree there's no coredump kept. Because mkosi configures
journal storage for coredumps, but that's not going to work for pid1 or
journald. Hence use external storage for these two even if everything
else is stored in the journal.

7 months agocore: drop unused wrappers of manager_get_unit_by_pidref() and friends 36872/head
Yu Watanabe [Wed, 26 Mar 2025 19:15:43 +0000 (04:15 +0900)] 
core: drop unused wrappers of manager_get_unit_by_pidref() and friends

7 months agotest-watch-pid: use pidref_safe_fork() with FORK_FREEZE
Yu Watanabe [Wed, 26 Mar 2025 19:02:26 +0000 (04:02 +0900)] 
test-watch-pid: use pidref_safe_fork() with FORK_FREEZE

Then, use pidref version of functions.

7 months agotest-watch-pid: move required test conditions to intro()
Yu Watanabe [Wed, 26 Mar 2025 18:56:46 +0000 (03:56 +0900)] 
test-watch-pid: move required test conditions to intro()

Follow-up for 7bcd76513a61f8f16f2cc9b291895779c7c367fe.

7 months agocoredump: do not disable removal of temporary coredump file 36870/head
Lennart Poettering [Wed, 26 Mar 2025 15:28:32 +0000 (11:28 -0400)] 
coredump: do not disable removal of temporary coredump file

7 months agocoredump: make sure we initialize all return parameters on success of save_external_c...
Lennart Poettering [Wed, 26 Mar 2025 15:25:47 +0000 (11:25 -0400)] 
coredump: make sure we initialize all return parameters on success of save_external_coredump()

7 months agocoredump: do not remove PID1/journal coredumps if Storage=journal is used
Lennart Poettering [Wed, 26 Mar 2025 15:22:01 +0000 (11:22 -0400)] 
coredump: do not remove PID1/journal coredumps if Storage=journal is used

We always redirect PID1/journal coredumps directly onto disk instead of
the journal even if that's configured because that might cause a
deadlock because we are still pinning the old journal process while
processing the coredump. However, so far we then immediately deleted the
coredumps because of Storage=journal, which is very annoying, since
there's hence no copy kept whatsoever.

Let's hence exclude PID1+journal from the removal.

This in particulary brings the code in line with the log messages which
claim we kept the file around but we actually did not.

7 months agocoredump: rename fix_permissions() → fix_permissions_and_link()
Lennart Poettering [Wed, 26 Mar 2025 15:20:12 +0000 (11:20 -0400)] 
coredump: rename fix_permissions() → fix_permissions_and_link()

The function doesn't just adjust permissions, it actually moves the
file into place. The function name should really make this fundamental
fact clear.

7 months agotest: update to use the new ASSERT_OK() macro and friends (#36838)
Luca Boccassi [Wed, 26 Mar 2025 15:21:55 +0000 (15:21 +0000)] 
test: update to use the new ASSERT_OK() macro and friends (#36838)

Converted the unitest implemented in src/test/test-watch-pid.c that
still uses assert_se() to use the new ASSERT_OK() macro and friends.

7 months agomeson: Drop project_source_root and project_build_root variables
Daan De Meyer [Wed, 26 Mar 2025 12:57:33 +0000 (13:57 +0100)] 
meson: Drop project_source_root and project_build_root variables

We can now rely on meson.project_source_root() and meson.project_build_root()
which do the same thing.

7 months agotree-wide: Update outdated docs on removed old integration test stuff
Daan De Meyer [Wed, 26 Mar 2025 12:41:46 +0000 (13:41 +0100)] 
tree-wide: Update outdated docs on removed old integration test stuff

7 months agoRevert "test: dynamically generate list of test cases"
Daan De Meyer [Wed, 26 Mar 2025 12:18:40 +0000 (13:18 +0100)] 
Revert "test: dynamically generate list of test cases"

We want to decouple the integration tests in meson from the
rest of the source files so the integration tests can be run
without the source files available. Let's revert the change to
dynamically figure out the test cases from the networkd tests for
now so that the tests can be generated without the test source file
being available.

This reverts commit 514458604b29663bc02c9d0e310f06e0ed682ae9.

7 months agoREADME: Drop test packages
Daan De Meyer [Wed, 26 Mar 2025 12:35:35 +0000 (13:35 +0100)] 
README: Drop test packages

This has bitrotted so let's just drop it as it's woefully out of date
and not really in the right location to be useful to anyone.

7 months agotest: Make sure serial is always set explicitly for scsi-hd qemu devices
Daan De Meyer [Wed, 26 Mar 2025 09:26:36 +0000 (10:26 +0100)] 
test: Make sure serial is always set explicitly for scsi-hd qemu devices

Now that mkosi uses -blockdev instead -drive, the device_id property
of scsi-hd devices is not populated automatically anymore so we have to
make sure to always specify serial= to make sure /dev/disk/by-id is populated
as expected in the test.

7 months agomkosi: Add back .mkosi-private/ to .gitignore
Daan De Meyer [Tue, 25 Mar 2025 20:00:08 +0000 (21:00 +0100)] 
mkosi: Add back .mkosi-private/ to .gitignore

Required to exclude the history data;

7 months agotest: update to use DEFINE_TEST_MAIN_WITH_INTRO() macro 36838/head
ZIHCO [Tue, 25 Mar 2025 16:11:46 +0000 (17:11 +0100)] 
test: update to use DEFINE_TEST_MAIN_WITH_INTRO() macro

7 months agotest: update to use the new ASSERT_OK() macro and friends
ZIHCO [Mon, 24 Mar 2025 07:22:40 +0000 (08:22 +0100)] 
test: update to use the new ASSERT_OK() macro and friends

7 months agoman: Add AssertVersion= to documentation (#36862)
Steve Ramage [Wed, 26 Mar 2025 01:34:59 +0000 (18:34 -0700)] 
man: Add AssertVersion= to documentation (#36862)

7 months agologind: inhibitor fixups (#36817)
Luca Boccassi [Wed, 26 Mar 2025 00:22:27 +0000 (00:22 +0000)] 
logind: inhibitor fixups (#36817)

7 months agopolkit: use -EBUSY to indicate shortcut after error or denial 36817/head
Nick Rosbrook [Mon, 24 Mar 2025 13:06:33 +0000 (09:06 -0400)] 
polkit: use -EBUSY to indicate shortcut after error or denial

Commit 536c18e5c3 ("bus-polkit: shortcut auth. after first denial")
added logic to async_polkit_query_check_action() that returns
-EALREADY when a failure or denial decision was made for a previous
action.

Tweak this to return -EBUSY instead of -EALREADY. This hopefully makes
the intent of the error more clear. EALREADY suggests that the request
is OK, but polkit is processing something else, and we should come back
later. EBUSY suggests that polkit is busy or unusable, hence the
request cannot be processed, and we should go away.

7 months agologin: add polkit example rules for allowing root to ignore inhibitors
Nick Rosbrook [Fri, 21 Mar 2025 19:14:20 +0000 (15:14 -0400)] 
login: add polkit example rules for allowing root to ignore inhibitors

The semantics of strong inhibitors require that POLKIT_ALWAYS_QUERY
always be set when checking if we can allow blocking inhibitors to be
ignored on shutdown, reboot, etc. With the default polkit rules and
policy, users may experience a situation where users in the sudo group
are authorized to run:

 systemctl reboot --check-inhibitors=no

but the root user is not authorized. Instead, the following error is
given:

 Call to Reboot failed: Interactive authentication required.

While this is correct according to the semantics of strong inhibitors,
it is confusing. To help the situation, provide example polkit rules
that allow root to perform these actions.

Finally, when root receives SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED
when calling e.g. systemctl reboot, print a message explaining that this
is due to the current polkit policy, and point to the new example rule.

Related: https://github.com/systemd/systemd/issues/36786

7 months agologin: handle -EALREADY from bus_verify_polkit_async_full()
Nick Rosbrook [Fri, 21 Mar 2025 18:38:20 +0000 (14:38 -0400)] 
login: handle -EALREADY from bus_verify_polkit_async_full()

Commit 536c18e5c3 ("bus-polkit: shortcut auth. after first denial")
added logic to async_polkit_query_check_action() that returns
-EALREADY when a failure or denial decision was made for a previous
action.

This has the consequence that root is able to ignore inhibitors and
shutdown etc. even when polkit explicitly denies it. This is because
when systemctl's verb_start_special() calls logind_reboot(), unless
the call succeeds or returns one of -EACCES, -EOPNOTSUPP, or
-EINPROGRESS, a fallback path is taken to attempt the action without
going through logind. Hence, since logind_reboot() started returning
-EALREADY in some cases, the fallback path was taken, and the shutdown
was performed anyways.

For example:

 root@ubuntu:/# cat /etc/polkit-1/rules.d/10-systemd-logind-no-skip-inhibitors.rules
 // Never allow strong inhibitors to be ignored.
 polkit.addRule(function(action, subject) {
     if ((action.id == "org.freedesktop.login1.power-off-ignore-inhibit" ||
          action.id == "org.freedesktop.login1.reboot-ignore-inhibit" ||
          action.id == "org.freedesktop.login1.halt-ignore-inhibit" ||
          action.id == "org.freedesktop.login1.suspend-ignore-inhibit" ||
          action.id == "org.freedesktop.login1.hibernate-ignore-inhibit")) {

         return polkit.Result.NO;
     }
 });
 root@ubuntu:/# systemctl reboot -i
 Call to Reboot failed: Operation already in progress

..but the reboot continues anyways due to the fallback.

To fix this, add logic in systemd-logind's verify_shutdown_creds() to
handle -EALREADY from bus_verify_polkit_async_full(): if we receive
-EALREADY when checking authorization for <action>-multiple-sessions,
and we are blocked on inhibitors, continue on to get the decision for
<action>-ignore-inhibit directly.

While here, add similar logic to method_inhibit(), which may need to
verify multiple polkit actions in a single call.

Fixes 536c18e5c33fd682fcd38d228b46a339adbe150b

7 months agopolkit: fix the ordering of a log message
Nick Rosbrook [Thu, 20 Mar 2025 11:07:08 +0000 (07:07 -0400)] 
polkit: fix the ordering of a log message

7 months agotools/check-version-history: avoid DeprecationWarning with newer lxml (#36860)
Luca Boccassi [Tue, 25 Mar 2025 19:34:44 +0000 (19:34 +0000)] 
tools/check-version-history: avoid DeprecationWarning with newer lxml (#36860)

We get the same warning thousands of times:
/work/src/tools/check-version-history.py:28: FutureWarning: This search
incorrectly ignores the root element, and will be fixed in a future
version. If you rely on the current behaviour, change it to

"./refsynopsisdiv/funcsynopsis/funcprototype/funcdef/function[.='udev_device_get_properties_list_entry']"

We also need to update the ignorelist to the new form.

7 months agogitignore: add .mkosi-private/ to the list again 36860/head
Zbigniew Jędrzejewski-Szmek [Tue, 25 Mar 2025 16:37:48 +0000 (17:37 +0100)] 
gitignore: add .mkosi-private/ to the list again

It was dropped in 9f9da8a1c61a01d6367d517d2e8dcfa85ae6795d and is
messing up CI now.

7 months agotools/check-version-history: avoid DeprecationWarning with newer lxml
Zbigniew Jędrzejewski-Szmek [Tue, 25 Mar 2025 16:16:16 +0000 (17:16 +0100)] 
tools/check-version-history: avoid DeprecationWarning with newer lxml

We get the same warning thousands of times:
/work/src/tools/check-version-history.py:28: FutureWarning: This search incorrectly
ignores the root element, and will be fixed in a future version. If you rely on the
current behaviour, change it to
"./refsynopsisdiv/funcsynopsis/funcprototype/funcdef/function[.='udev_device_get_properties_list_entry']"

We also need to update the ignorelist to the new form.

7 months agomkosi: Add two more mkosi entries to .gitignore
Daan De Meyer [Tue, 25 Mar 2025 14:28:42 +0000 (15:28 +0100)] 
mkosi: Add two more mkosi entries to .gitignore

Also get rid of a bunch of outdated entries that don't apply anymore.

7 months agomkosi: update fedora commit reference
Daan De Meyer [Tue, 25 Mar 2025 12:36:53 +0000 (13:36 +0100)] 
mkosi: update fedora commit reference

13d523f84d Relax dependencies from noarch packages on archful packages for OBS builds
59378485be Remove purge-nobody-user script
d1380dc114 Add more services to %post for udev and networkd
6f0d03443d Fix paths for /usr/sbin/nologin and related progs
df9a74d530 Make the source tarball glob in the test script more generic

7 months agotest: Disable pager in integration test units
Daan De Meyer [Tue, 25 Mar 2025 09:37:32 +0000 (10:37 +0100)] 
test: Disable pager in integration test units

Integration test units are now connected to the tty when running
interactively, so let's make sure we disable the pager to avoid tests
hanging in the pager.

7 months agoTrivial updates for docs and comments (#36854)
Luca Boccassi [Tue, 25 Mar 2025 10:37:42 +0000 (10:37 +0000)] 
Trivial updates for docs and comments (#36854)

7 months agoman/systed.swap: update description of implicit deps 36854/head
Zbigniew Jędrzejewski-Szmek [Tue, 25 Mar 2025 09:40:12 +0000 (10:40 +0100)] 
man/systed.swap: update description of implicit deps

This changed in e3e6f996894f0eea0e766b4194922f5c7235fb01.
Closes https://github.com/systemd/systemd/issues/36761.

7 months agoman/systemd-remount-fs: fix grammar
Zbigniew Jędrzejewski-Szmek [Mon, 24 Mar 2025 21:04:04 +0000 (22:04 +0100)] 
man/systemd-remount-fs: fix grammar

7 months agoman/varlinkctl: remove unneeded absolute path in example
Zbigniew Jędrzejewski-Szmek [Tue, 31 Dec 2024 22:38:40 +0000 (23:38 +0100)] 
man/varlinkctl: remove unneeded absolute path in example

7 months agoremount-fs: adjust comment
Zbigniew Jędrzejewski-Szmek [Tue, 14 Jan 2025 09:32:30 +0000 (10:32 +0100)] 
remount-fs: adjust comment

7 months agohomectl: split out inspect_home() and authenticate_home()
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 15:50:44 +0000 (16:50 +0100)] 
homectl: split out inspect_home() and authenticate_home()

mangle_user_list() was doing a microoptimization of avoiding of copying of a
single string by constructing the strv object manually. This seems like more
trouble than it's worth, considering that this is called once in the program's
life.

Rework the code to have inspect_home() and authenticate_home() that handle a
single home name and call them in a loop from the outer function.

7 months agovconsole-setup: reword error messages
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2024 13:57:32 +0000 (14:57 +0100)] 
vconsole-setup: reword error messages

I was looking at some logs, and — without context —
"Setting source virtual console failed" doesn't make sense. It's a source
internally in vconsole-setup because we configure it and then use it to copy
the settings to other consoles. But at the point this message is emitted it's
not yet a source of anything. Also, "setting" sounds like we'd like to assign
it somewhere, which is even more confusing. Reword the messages to be more
down-to-earth and meaningful without looking at the code.

7 months agoRatelimit attempts to open watchdog, increase logging (#35708)
Zbigniew Jędrzejewski-Szmek [Mon, 24 Mar 2025 20:06:57 +0000 (21:06 +0100)] 
Ratelimit attempts to open watchdog, increase logging (#35708)

7 months agoman: fix typo in org.freedesktop.systemd1.xml
Luca Boccassi [Mon, 24 Mar 2025 18:25:29 +0000 (18:25 +0000)] 
man: fix typo in org.freedesktop.systemd1.xml

7 months agotest: update to use the new ASSERT_OK() macro and friends
Busayo Dada [Mon, 24 Mar 2025 12:28:20 +0000 (13:28 +0100)] 
test: update to use the new ASSERT_OK() macro and friends

7 months agoman/timedatectl: add reference to systemd.time(7)
Yu Watanabe [Mon, 24 Mar 2025 11:43:53 +0000 (20:43 +0900)] 
man/timedatectl: add reference to systemd.time(7)

Closes #36839.

7 months agotree-wide: introduce LOG_ITEM() macro for verifying format string (#36780)
Luca Boccassi [Mon, 24 Mar 2025 12:58:14 +0000 (12:58 +0000)] 
tree-wide: introduce LOG_ITEM() macro for verifying format string (#36780)

This introduce `LOG_ITEM()` macro that checks format strings in
log_struct() and friends.

Hopefully, this silences false-positive warnings by Coverity.

7 months agoman/networkd.conf: revert unexpected replacement of PersistLeases= setting
Yu Watanabe [Mon, 24 Mar 2025 10:25:01 +0000 (19:25 +0900)] 
man/networkd.conf: revert unexpected replacement of PersistLeases= setting

The entry was unexpectedly replaced by the commit
418f2dc75564330d4ff6c86193f4a3c8ffbb1f1b (v256).
This reverts the change.

Fixes #36837.

7 months agouser-record: Allow/strip status for mask/extract privileged helpers
Daan De Meyer [Sun, 23 Mar 2025 21:52:10 +0000 (22:52 +0100)] 
user-record: Allow/strip status for mask/extract privileged helpers

If we're using these helpers, we want to split a user record into two,
one with the privileged section, and one without. This should work even
when the user record has a "status" section, so adapt the helpers to
account for that.

7 months agocore/manager: do not exclude watchdog logic from busy-loop protection 35708/head
Zbigniew Jędrzejewski-Szmek [Fri, 21 Mar 2025 14:06:28 +0000 (15:06 +0100)] 
core/manager: do not exclude watchdog logic from busy-loop protection

As reported in https://github.com/systemd/systemd/issues/35405, if the watchdog
ping failed, we effectively started a busy loop here. The previous commits
should fix this, but in general, the protection here is intended as a safety
net in case the logic is broken somewhere else. We shouldn't exclude the
watchdog stuff from this.

7 months agoshared/watchdog: give up after a few failed pings
Zbigniew Jędrzejewski-Szmek [Fri, 21 Mar 2025 13:39:50 +0000 (14:39 +0100)] 
shared/watchdog: give up after a few failed pings

Closes https://github.com/systemd/systemd/issues/35405. Apparently some
watchdog devices can be opened, but then the pings start failing after some
time. Since the timestamp of the last successful ping is not updated, we try to
ping again immediately, causing a busy loop and excessive logging.

After trying a few different approaches to fit this into the existing framework
without changing the logic too much, I settled on an approach with a second
timestamp. In particular, the timestamp of the last successful ping is public,
exposed as WatchdogLastPingTimestamp over dbus. It'd be wrong to redefine this
to mean the last ping *attempt*. So we need a second timestamp in some form.

Also, if we give up on pinging, we probably should attempt to disarm the
watchdog. It's possible that the pinging fails, but the watchdog would still
fire. I don't think we want that, since it seems that our internal loop is
working, it's just the watchdog that is broken.

Structured message with SD_MESSAGE_WATCHDOG_PING_FAILED is logged if we fail
to ping.

I tested this by attaching gdb to pid 1 and calling close(watchdog_fd).
We get a bunch of warning messages and then an attempt to close the watchdog:
Mar 21 15:46:17 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:20 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:23 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:26 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:29 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:32 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:35 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:37 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:40 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:43 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:46 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:49 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:52 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:55 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0: Bad file descriptor
Mar 21 15:46:58 fedora systemd[1]: Failed to ping hardware watchdog /dev/watchdog0, closing watchdog after 15 attempts: Bad file descriptor
Mar 21 15:46:58 fedora systemd[1]: Failed to disable hardware watchdog, ignoring: Bad file descriptor
Mar 21 15:46:58 fedora systemd[1]: Failed to disarm watchdog timer, ignoring: Bad file descriptor

7 months agonetworkd: add support for setting vlan_tunnel on bridge ports
Erik Larsson [Sat, 22 Mar 2025 14:40:35 +0000 (15:40 +0100)] 
networkd: add support for setting vlan_tunnel on bridge ports

7 months agosome dbus property fixes (#36830)
Luca Boccassi [Sat, 22 Mar 2025 15:54:16 +0000 (15:54 +0000)] 
some dbus property fixes (#36830)

7 months agocore: not sure why but TTYRows/TTYColumns property is 16bit towards outside, 32bit... 36830/head
Lennart Poettering [Fri, 21 Mar 2025 16:51:18 +0000 (17:51 +0100)] 
core: not sure why but TTYRows/TTYColumns property is 16bit towards outside, 32bit inside, handle that properly

7 months agocore: fix C type handler for ExitCode property
Lennart Poettering [Fri, 21 Mar 2025 16:38:26 +0000 (17:38 +0100)] 
core: fix C type handler for ExitCode property

7 months agomkosi: Hide patches on debian instead of removing them
Daan De Meyer [Fri, 21 Mar 2025 21:02:19 +0000 (22:02 +0100)] 
mkosi: Hide patches on debian instead of removing them

7 months agofetch-distro: Fetch before we switch branches
Daan De Meyer [Fri, 21 Mar 2025 20:34:12 +0000 (21:34 +0100)] 
fetch-distro: Fetch before we switch branches

Otherwise the branch we're switching to might not exist yet.

7 months agopackit: Load fmf metadata from rpm spec repository (#36825)
Daan De Meyer [Fri, 21 Mar 2025 16:28:43 +0000 (17:28 +0100)] 
packit: Load fmf metadata from rpm spec repository (#36825)

7 months agopackit: Load fmf metadata from rpm spec repository 36825/head
Daan De Meyer [Fri, 21 Mar 2025 14:13:22 +0000 (15:13 +0100)] 
packit: Load fmf metadata from rpm spec repository

Maintaining the fmf metadata and script upstream makes it painful
to reuse downstream so let's move the metadata and testing script
downstream and load it upstream instead.