]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 months agomeson: bump version to 256.14 v256.14
Zbigniew Jędrzejewski-Szmek [Thu, 29 May 2025 16:42:40 +0000 (18:42 +0200)] 
meson: bump version to 256.14

5 months agocoredump: get rid of a bogus assertion
Zbigniew Jędrzejewski-Szmek [Mon, 26 May 2025 13:24:04 +0000 (15:24 +0200)] 
coredump: get rid of a bogus assertion

The check looks plausible, but when I started checking whether it needs
to be lowered for the recent changes, I realized that it doesn't make
much sense.

context_parse_iovw() is called from a few places, e.g.:
- process_socket(), where the other side controls the contents of the
  message. We already do other checks on the correctness of the message
  and this assert is not needed.
- gather_pid_metadata_from_argv(), which is called after
  inserting MESSAGE_ID= and PRIORITY= into the array, so there is no
  direct relation between _META_ARGV_MAX and the number of args in the
  iovw.
- gather_pid_metadata_from_procfs(), where we insert a bazillion fields,
  but without any relation to _META_ARGV_MAX.

Since we already separately check if the required stuff was set, drop this
misleading check.

(cherry picked from commit 13902e025321242b1d95c6d8b4e482b37f58cdef)
(cherry picked from commit 4c424072b3cc6a68265345cef2d29a6903081dcf)

5 months agocoredump: also stop forwarding non-dumpable processes
Zbigniew Jędrzejewski-Szmek [Mon, 5 May 2025 13:48:40 +0000 (15:48 +0200)] 
coredump: also stop forwarding non-dumpable processes

See the comment in the patch for details.

Suggested-by: Qualys Security Advisory <qsa@qualys.com>
(cherry-picked from 8fc7b2a211eb13ef1a94250b28e1c79cab8bdcb9)
(cherry-picked from 101058955eb41023e0dba5766f6bfb190ebbb4f6)

5 months agocoredump: use %d in kernel core pattern
Zbigniew Jędrzejewski-Szmek [Tue, 29 Apr 2025 12:47:59 +0000 (14:47 +0200)] 
coredump: use %d in kernel core pattern

The kernel provides %d which is documented as
"dump mode—same as value returned by prctl(2) PR_GET_DUMPABLE".

We already query /proc/pid/auxv for this information, but unfortunately this
check is subject to a race, because the crashed process may be replaced by an
attacker before we read this data, for example replacing a SUID process that
was killed by a signal with another process that is not SUID, tricking us into
making the coredump of the original process readable by the attacker.

With this patch, we effectively add one more check to the list of conditions
that need be satisfied if we are to make the coredump accessible to the user.

Reportedy-by: Qualys Security Advisory <qsa@qualys.com>
(cherry-picked from 0c49e0049b7665bb7769a13ef346fef92e1ad4d6)
(cherry-picked from c58a8a6ec9817275bb4babaa2c08e0e35090d4e3)

5 months agocoredump: get rid of _META_MANDATORY_MAX
Zbigniew Jędrzejewski-Szmek [Mon, 26 May 2025 10:04:44 +0000 (12:04 +0200)] 
coredump: get rid of _META_MANDATORY_MAX

No functional change. This change is done in preparation for future changes.
Currently, the list of fields which are received on the command line is a
strict subset of the fields which are always expected to be received on a
socket. But when we add new kernel args in the future, we'll have two
non-overlapping sets and this approach will not work. Get rid of the variable
and enumerate the required fields. This set will never change, so this is
actually more maintainable.

The message with the hint where to add new fields is switched with
_META_ARGV_MAX. The new order is more correct.

(cherry-picked from 49f1f2d4a7612bbed5211a73d11d6a94fbe3bb69)
(cherry-picked from aea6a631bca93e8b04a11aaced694f25f4da155e)

5 months agotest: fix TEST-84-STORAGETM with nvme-cli < 2.7
Luca Boccassi [Wed, 28 May 2025 22:48:27 +0000 (23:48 +0100)] 
test: fix TEST-84-STORAGETM with nvme-cli < 2.7

The -vv parameter was added in version 2.7, check before using it

Follow-up for ebc0514a6507d51e536b269e30a036a7992beeb7

(cherry picked from commit 60491ceb12aac9f2b9423490158bd9291d735b36)
(cherry picked from commit f75ca4648efd92e6a7a5a244a5de09187a30e43c)

5 months agoCI: drop .packit.yml
Luca Boccassi [Wed, 28 May 2025 12:24:12 +0000 (13:24 +0100)] 
CI: drop .packit.yml

It fails on this branch, and nobody knows how to fix it:

'Cannot create a new Copr project (owner=packit project=systemd-systemd-37643 chroots=[]): chroots: '[]' is not a valid choice for this field..'

Disable it, as it just generates noise

5 months agocore/manager: do not pop gc_unit_queue before unit_gc_sweep()
Mike Yuan [Sat, 17 May 2025 14:59:32 +0000 (16:59 +0200)] 
core/manager: do not pop gc_unit_queue before unit_gc_sweep()

Follow-up for 52e3671bf7e6321c58c6d3a6c8ad8e167259a569

unit_gc_sweep() might try to add the unit to gc queue again.
While that becomes no-op as Unit.in_gc_queue is not cleared
yet, it induces minor inconsistency of states.

(cherry picked from commit 741a184a31127305fb4363833ca9d97a1057fc68)
(cherry picked from commit 9645e946f9e323965116d89fce8009cc86418c9d)

5 months agotest: fix test_qdisc_tbf regex with iproute2 v6.15
Luca Boccassi [Tue, 27 May 2025 13:56:32 +0000 (14:56 +0100)] 
test: fix test_qdisc_tbf regex with iproute2 v6.15

iproute2 v6.15 fixed some rounding errors in the reported stats:

https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=d947f365602b30657d1b797e7464000d0ab88d5a

so the current regex doesn't work anymore. Fix it to check for both
old and new values.

systemd-networkd-tests.py[523]: FAIL: test_qdisc_tbf (__main__.NetworkdTCTests.test_qdisc_tbf)
systemd-networkd-tests.py[523]: ----------------------------------------------------------------------
systemd-networkd-tests.py[523]: Traceback (most recent call last):
systemd-networkd-tests.py[523]:   File "/usr/lib/systemd/tests/testdata/test-network/systemd-networkd-tests.py", line 5402, in test_qdisc_tbf
systemd-networkd-tests.py[523]:     self.assertRegex(output, 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70(.0)?ms')
systemd-networkd-tests.py[523]:     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
systemd-networkd-tests.py[523]: AssertionError: Regex didn't match: 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70(.0)?ms' not found in 'qdisc tbf 35: root refcnt 2 rate 1Gbit burst 5000b peakrate 100Gbit minburst 999200b lat 70ms \nqdisc pfifo 37: parent 35: limit 100000p'

(cherry picked from commit f9a85b74903f5588d08f54ea7d9b53edc639b824)
(cherry picked from commit 6e67969b10d111177f72a53f9f7158bf9f14d2a3)

5 months agohomed: generate proper error if we cannot create mountpoint for homedir
Lennart Poettering [Fri, 23 May 2025 10:15:45 +0000 (12:15 +0200)] 
homed: generate proper error if we cannot create mountpoint for homedir

Let's make this easier to debug. (When this failed for me due to disk
full it took me a bit to figure out what was going on.)

(cherry picked from commit 5b759bf5fd3a915a5b4756590caff7faf43a9693)
(cherry picked from commit 8158c87c36d5725818a2a9cda4270b8839553f86)

5 months agodocs: add man pages for sd_device_enumerator_[new,ref,unref,unrefp] (#37586)
Shubhendra Kushwaha [Sat, 24 May 2025 20:01:27 +0000 (01:31 +0530)] 
docs: add man pages for sd_device_enumerator_[new,ref,unref,unrefp] (#37586)

For #20929.

(cherry picked from commit ac8ed83947237956b867de9cfbf5fcd26de8ea96)
(cherry picked from commit 17e5c276b90f45bd0ed496352d254105ecdea935)

5 months agojournald: clarify doc for usage-related values cap (#37528)
TheHillBright [Wed, 21 May 2025 10:38:12 +0000 (18:38 +0800)] 
journald: clarify doc for usage-related values cap (#37528)

The old description makes users wrongly assume that the cap of 4G
applied, even when the user specifies a value that will result in higher
than 4G. This commit avoids this misunderstanding.

(cherry picked from commit 33084145315029775748a89da836465783d65bb3)
(cherry picked from commit 137d765b2d01dc93a0ec182654ddf4b9b4114bcf)

5 months agoshell-completion: improve completion of systemd-tmpfiles
Eisuke Kawashima [Thu, 15 May 2025 22:46:46 +0000 (07:46 +0900)] 
shell-completion: improve completion of systemd-tmpfiles

(cherry picked from commit b9df3d6447955e59f4e83e2b10ca97d4a484a6a5)
(cherry picked from commit 8462cb0b9dd502a31df23745b74791a7fe74fb32)

5 months agonetwork: do not drop duplicated entries in loop
Yu Watanabe [Wed, 14 May 2025 21:36:55 +0000 (06:36 +0900)] 
network: do not drop duplicated entries in loop

Fixes #37456.

(cherry picked from commit 6a4fe38f7fed6b1a94caad49c5aa3dd102658df4)
(cherry picked from commit 936cba12c9ab098948b996723cde42b613343f8c)

5 months agoman: correct version information when $REMOTE_ADDR/$REMOTE_PORT where added
Lennart Poettering [Thu, 15 May 2025 07:44:02 +0000 (09:44 +0200)] 
man: correct version information when $REMOTE_ADDR/$REMOTE_PORT where added

This was in commit 3b1c524154c876aecebc98787975cc2943100210, i.e. in the
v220 cycle.

(cherry picked from commit 3bdcd994cd707bcf34664edaa21afff6025d15d2)
(cherry picked from commit 89b4f52775fdd455990a54094bf61d5f71c7d4ed)

5 months agoman/systemd-run: --wait shows more than CPU accounting data
Mike Yuan [Wed, 14 May 2025 16:47:16 +0000 (18:47 +0200)] 
man/systemd-run: --wait shows more than CPU accounting data

(cherry picked from commit 72594d6771a68fbb7d5ebe1d004f4d942a1fac97)
(cherry picked from commit b7acbc464b38e1bee42a993b1bd0346d8e5c186f)

5 months agoTEST-73-LOCALE: skip lv keymap and friends
Yu Watanabe [Fri, 9 May 2025 07:33:12 +0000 (16:33 +0900)] 
TEST-73-LOCALE: skip lv keymap and friends

The following failure should be in libxkbcommon and/or sanitizer.
There is nothing we can do here. Let's skip it.

```
TEST-73-LOCALE.sh[3733]: + assert_rc 0 localectl set-keymap lv
TEST-73-LOCALE.sh[6699]: + set +ex
TEST-73-LOCALE.sh[6700]: Failed to set keymap: Remote peer disconnected
TEST-73-LOCALE.sh[6703]: FAIL: expected: '0' actual: '1'
TEST-73-LOCALE.sh[157]: + rm -f /etc/dbus-1/system.d/systemd-localed-read-only.conf
[FAILED] Failed to start TEST-73-LOCALE.service - TEST-73-LOCALE.
```
```
==3719==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fa51f161000 at pc 0x7fa521250be4 bp 0x7ffe49130a80 sp 0x7ffe49130240
READ of size 19126 at 0x7fa51f161000 thread T0
    #0 0x7fa521250be3 in strndup (/usr/lib/clang/20/lib/x86_64-redhat-linux-gnu/libclang_rt.asan.so+0x50be3) (BuildId: aa6231e817f72469c44a6c6cee9f0694a87db7fb)
    #1 0x7fa51f128325  (/lib64/libxkbcommon.so.0+0x1c325) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #2 0x7fa51f121952  (/lib64/libxkbcommon.so.0+0x15952) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #3 0x7fa51f123d3a  (/lib64/libxkbcommon.so.0+0x17d3a) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #4 0x7fa51f117c86  (/lib64/libxkbcommon.so.0+0xbc86) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #5 0x7fa51f12548f  (/lib64/libxkbcommon.so.0+0x1948f) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #6 0x7fa51f125c9e  (/lib64/libxkbcommon.so.0+0x19c9e) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #7 0x7fa51f126a59  (/lib64/libxkbcommon.so.0+0x1aa59) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #8 0x7fa51f12cec6  (/lib64/libxkbcommon.so.0+0x20ec6) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #9 0x7fa51f12e3c2  (/lib64/libxkbcommon.so.0+0x223c2) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #10 0x7fa51f12a4e5 in xkb_keymap_new_from_names (/lib64/libxkbcommon.so.0+0x1e4e5) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #11 0x5574dd63f864 in verify_xkb_rmlvo /usr/src/debug/systemd/src/locale/xkbcommon-util.c:69:14
(snip)
```

(cherry picked from commit 18609909d93a4d17e962b47e51fffe38845e99f5)
(cherry picked from commit 5d7d60b8dd01282adbe89084b479a51aaff4cf47)

5 months agocoredump: restore compatibility with older patterns
Zbigniew Jędrzejewski-Szmek [Tue, 29 Apr 2025 12:47:59 +0000 (14:47 +0200)] 
coredump: restore compatibility with older patterns

This was broken in f45b8015513d38ee5f7cc361db9c5b88c9aae704. Unfortunately
the review does not talk about backward compatibility at all. There are
two places where it matters:
- During upgrades, the replacement of kernel.core_pattern is asynchronous.
  For example, during rpm upgrades, it would be updated a post-transaction
  file trigger. In other scenarios, the update might only happen after
  reboot. We have a potentially long window where the old pattern is in
  place. We need to capture coredumps during upgrades too.
- With --backtrace. The interface of --backtrace, in hindsight, is not
  great. But there are users of --backtrace which were written to use
  a specific set of arguments, and we can't just break compatiblity.
  One example is systemd-coredump-python, but there are also reports of
  users using --backtrace to generate coredump logs.

Thus, we require the original set of args, and will use the additional args if
found.

A test is added to verify that --backtrace works with and without the optional
args.

(cherry picked from commit ded0aac389e647d35bce7ec4a48e718d77c0435b)
(cherry picked from commit f9b8b75c11bba9b63096904be98cc529c304eb97)

5 months agoRevert "core/socket: do not enter failed state when we cannot start service due to...
Luca Boccassi [Tue, 20 May 2025 13:13:07 +0000 (14:13 +0100)] 
Revert "core/socket: do not enter failed state when we cannot start service due to conflicting transaction being queued"

This reverts commit 03be978776f90f28195e412a5babdbd2aba96752.

Post-merge review found problems:
https://github.com/systemd/systemd/pull/37222#pullrequestreview-2848299600

5 months agoRevert "units: stop systemd-udevd before soft-reboot"
Luca Boccassi [Tue, 20 May 2025 13:13:06 +0000 (14:13 +0100)] 
Revert "units: stop systemd-udevd before soft-reboot"

This reverts commit fd7b8e12aa9437ecc4df8ba1d0ad11972601f65f.

Post-merge review found problems:
https://github.com/systemd/systemd/pull/37222#pullrequestreview-2848299600

5 months agoRevert "TEST-82-SOFTREBOOT: add test case for uevents generated during soft-reboot"
Luca Boccassi [Tue, 20 May 2025 13:13:05 +0000 (14:13 +0100)] 
Revert "TEST-82-SOFTREBOOT: add test case for uevents generated during soft-reboot"

This reverts commit e8b3b46921ee5aacd9f5d5132c64af79b685d941.

Post-merge review found problems:
https://github.com/systemd/systemd/pull/37222#pullrequestreview-2848299600

5 months agopager: also check for $SUDO_UID
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 12:29:02 +0000 (14:29 +0200)] 
pager: also check for $SUDO_UID

This returns to the original approach proposed in
https://github.com/systemd/systemd/pull/17270. After review, the approach was
changed to use sd_pid_get_owner_uid() instead. Back then, when running in a
typical graphical session, sd_pid_get_owner_uid() would usually return the user
UID, and when running under sudo, geteuid() would return 0, so we'd trigger the
secure path.

sudo may allocate a new session if is invoked outside of a session (depending
on the PAM config). Since nowadays desktop environments usually start the user
shell through user units, the typical shell in a terminal emulator is not part
of a session, and when sudo is invoked, a new session is allocated, and
sd_pid_get_owner_uid() returns 0 too. Technically, the code still works as
documented in the man page, but in the common case, it doesn't do the expected
thing.

$ build/test-sd-login |& rg 'get_(owner_uid|cgroup|session)'
sd_pid_get_session(0) → No data available
sd_pid_get_owner_uid(0) → 1000
sd_pid_get_cgroup(0) → /user.slice/user-1000.slice/user@1000.service/app.slice/app-ghostty-transient-5088.scope/surfaces/556FAF50BA40.scope

$ sudo build/test-sd-login |& rg 'get_(owner_uid|cgroup|session)'
sd_pid_get_session(0) → c289
sd_pid_get_owner_uid(0) → 0
sd_pid_get_cgroup(0) → /user.slice/user-0.slice/session-c289.scope

I think it's worth checking for sudo because it is a common case used by users.
There obviously are other mechanims, so the man page is extended to say that
only some common mechanisms are supported, and to (again) recommend setting
SYSTEMD_LESSSECURE explicitly. The other option would be to set "secure mode"
by default. But this would create an inconvenience for users doing the right
thing, running systemctl and other tools directly, because then they can't run
privileged commands from the pager, e.g. to save the output to a file. (Or the
user would need to explicitly set SYSTEMD_LESSSECURE. One option would be to
set it always in the environment and to rely on sudo and other tools stripping
it from the environment before running privileged code. But that is also fairly
fragile and it obviously relies on the user doing a complicated setup to
support a fairly common use case. I think this decreases usability of the
system quite a bit. I don't think we should build solutions that work in
priniciple, but are painfully inconvenient in common cases.)

Fixes https://yeswehack.com/vulnerability-center/reports/346802.

Also see https://github.com/polkit-org/polkit/pull/562, which adds support for
$SUDO_UID/$SUDO_GID to pkexec.

(cherry picked from commit cd93478af8b9dc69478d5667f113b67d175090fa)
(cherry picked from commit b93f53c122124582fa80ae246343791063d65074)

5 months agoman: rework the description of $SYSTEMD_PAGER and $PAGER
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 09:37:26 +0000 (11:37 +0200)] 
man: rework the description of $SYSTEMD_PAGER and $PAGER

$PAGER wasn't documented, but actually we treat it same as $SYSTEMD_PAGER,
except for lower priority. And the two variables can be used to disable the
pager, even if $SYSTEMD_PAGERSECURE is not set.

Behaviour is (obviously) not changed by this patch, it intentionally just
updates the docs to match the code.

(cherry picked from commit b6b78170e17727ca0ec320d5703b36d0597d0cc9)
(cherry picked from commit affb45d6b2dfdb3a87da2e0241be8c5c5c9a9d8f)

5 months agoman: reword the description of "secure pager" handling
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 09:14:10 +0000 (11:14 +0200)] 
man: reword the description of "secure pager" handling

The existing description was not *wrong*, but it was a bit muddled. Let's
reorder the text to give a short intro and then describe what the options
actually do and the clear "true" and "false" cases first, and then describe
autodetection.

Related to https://yeswehack.com/vulnerability-center/reports/346802.

(cherry picked from commit 718dbdb2ca4458cf91711cd9a7de3a972e46658e)
(cherry picked from commit d8659058f40186f07799bc2a8e624aece33412ac)

5 months agosystemct: show all in output of systemctl clean --what=help
Jörg Behrmann [Tue, 13 May 2025 15:21:02 +0000 (17:21 +0200)] 
systemct: show all in output of systemctl clean --what=help

(cherry picked from commit 68b6289a9e4a8a9cc3567f066f921388e99da9d9)
(cherry picked from commit f9e68aa2b5dd14e0be29d13ea0c45f50bfe6b986)

5 months agoman: note for systemctl clean --what that commas separate values
Jörg Behrmann [Tue, 13 May 2025 15:20:37 +0000 (17:20 +0200)] 
man: note for systemctl clean --what that commas separate values

(cherry picked from commit 652e4dd7434d1603866c059aa8a67eaf8b73346f)
(cherry picked from commit 2d5982e4f2c76e41fa1d5524fcbcdfcbecdf656c)

5 months agoman, systemctl: document --what=help
Jörg Behrmann [Tue, 13 May 2025 15:19:39 +0000 (17:19 +0200)] 
man, systemctl: document --what=help

(cherry picked from commit 028de7292d6923c4b77c5d03d47097aeda24fc1d)
(cherry picked from commit d865854eae9d11e755f5f12e043d5e741c4a1fe1)

5 months agoman: add missing fdstore in systemctl clean --what documentation
Jörg Behrmann [Tue, 13 May 2025 15:19:02 +0000 (17:19 +0200)] 
man: add missing fdstore in systemctl clean --what documentation

(cherry picked from commit 5689365a909362d82ad4959d3fec9ebacfd5ec96)
(cherry picked from commit cca8e2077f982e5cf636137a92eb7f177a0b4a29)

5 months agoshell-completion: fix completion of `systemctl --user unset-environment` (#37409)
Eisuke Kawashima [Tue, 13 May 2025 00:04:52 +0000 (09:04 +0900)] 
shell-completion: fix completion of `systemctl --user unset-environment` (#37409)

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
(cherry picked from commit 6d07d23b022d48898d9a2e7181ab6493d3d61c43)
(cherry picked from commit 11c16d414ebbcb13e39971d90ece4a1e0db183d2)

5 months agolog: fix declaration of log_dispatch_internal()
Antonio Alvarez Feijoo [Mon, 12 May 2025 13:26:32 +0000 (15:26 +0200)] 
log: fix declaration of log_dispatch_internal()

(cherry picked from commit 0425fc5eb72d8a66e3c2634f0d61e50ef2c53e41)
(cherry picked from commit 764be0a316a5a8ac1cb46aa748c12c70e23355cb)

5 months agoflush_ports: flush POSIX message queues properly
Todd C. Miller [Tue, 6 May 2025 22:39:14 +0000 (16:39 -0600)] 
flush_ports: flush POSIX message queues properly

On Linux, read() on a message queue descriptor returns the message
queue statistics, not the actual message queue data.  We need to use
mq_receive() to drain the queues instead.

Fixes a problem where a POSIX message queue socket unit with messages
in the queue at shutdown time could result in a hang on reboot/shutdown.

(cherry picked from commit ffb6adb76367d5ab7d43937ccaac5947717b5b78)
(cherry picked from commit 4ab235b029f2107ed53f6580a7b57a48b63b4035)

5 months agocore/socket: trivial coding style cleanups
Mike Yuan [Mon, 16 Dec 2024 00:29:35 +0000 (01:29 +0100)] 
core/socket: trivial coding style cleanups

(cherry picked from commit 2fbdfe0b0d355d0bd6ea8b93a000f92bc7f5fe5f)
(cherry picked from commit 7f3bc9fef15ef7ba3cf8458c7841760ba3036e89)

5 months agoman/systemd.exec: reword description of RestrictAddressFamilies=
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 18:59:59 +0000 (20:59 +0200)] 
man/systemd.exec: reword description of RestrictAddressFamilies=

The text is reordered and broken into more paragraphs.
A recommendation to combine RestrictAddressFamilies= with
SystemCallFilter=@service is added.

(cherry picked from commit 2dc4e87849e2ae2ea93e9ccf6365c44ad1602ac6)
(cherry picked from commit 523197c2432b265275a3ec9ff76aa7f617e07eb7)

5 months agoman/systemd.exec: reword description of SystemCallFilter=
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 19:04:00 +0000 (21:04 +0200)] 
man/systemd.exec: reword description of SystemCallFilter=

The existing text grew organically as features were added and was
not very organized. Reorder it and break into paragraphs grouped
by topic. The description of the :errno syntax is replaced by a short
reference to the SystemCallErrorNumber= setting. This makes the
text shorter and makes it easier to explain how the two settings combine.

(cherry picked from commit 802d23fcfbcacd3c33f421e0fb1bd372658beeef)
(cherry picked from commit 0ff20b0486f39579c3296ff51c4f09515889a9f2)

5 months agomeson: Ensure that distribution packages own systemenvgeneratordir
Debarshi Ray [Fri, 2 May 2025 19:08:55 +0000 (21:08 +0200)] 
meson: Ensure that distribution packages own systemenvgeneratordir

Currently, Fedora's systemd RPM doesn't own systemenvgeneratordir
(ie., /usr/lib/systemd/system-environment-generators) [1] because it's
not created when systemd is installed.  In contrast, userenvgeneratordir
(ie., /usr/lib/systemd/user-environment-generators) is created, unless
the environment-d Meson option is explicitly disabled.

While this can be worked around elsewhere, it's better if the upstream
build system created the directories consistently.  It will avoid
repetition, and prevent silly bugs or deviations from creeping in.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2284085

(cherry picked from commit ab46feb3e28eee0b9be3dece49f5e4c63f21dc37)
(cherry picked from commit bd27edd3de9b3b30f7225994a799e46fba930568)

5 months agoman/systemctl: add preposition for clarity
Alexander Stepchenko [Mon, 5 May 2025 10:48:30 +0000 (13:48 +0300)] 
man/systemctl: add preposition for clarity

(cherry picked from commit 0cf03a36f287ef898679868a5bc828b17faf797e)
(cherry picked from commit e76121a0d2eb288ea02c61b9359b86053fd6ee5f)

5 months agoman/network: Note .link early boot caveat, and .network .netdev usage.
Tim Small [Fri, 2 May 2025 12:40:00 +0000 (13:40 +0100)] 
man/network: Note .link early boot caveat, and .network .netdev usage.

Document .link .network and .netdev file type distinctions in early
introductory text, and document distro-specific need to sync link files
with early-boot copies, see Debian bug 1005282:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1005282 for an
example.

(cherry picked from commit a50fa2a40f4a91d49503d3588a3dd29ea05e559b)
(cherry picked from commit 1f654739f8a05110b68461cf483d5c07b2ef7723)

5 months agovmspawn: don't use vmgenid on aarch64 as it's not supported
Arian van Putten [Thu, 1 May 2025 11:19:24 +0000 (13:19 +0200)] 
vmspawn: don't use vmgenid on aarch64 as it's not supported

fixes:

```
qemu-kvm: -device vmgenid,guid=5f303a47-6fae-4dd7-969c-6c1ea61e816e: 'vmgenid' is not a valid device model name
```

(cherry picked from commit f17247c70181edb1a4b767996021c3589ecace64)
(cherry picked from commit ddda4deda6b0d2864cb13839771e2543415f43e2)

5 months agobusctl: validate argvs on get-property/set-property too
Luca Boccassi [Wed, 30 Apr 2025 14:24:20 +0000 (15:24 +0100)] 
busctl: validate argvs on get-property/set-property too

Otherwise passing invalid data means asserts get hit instead of
handling it gracefully. Other verbs already do the same checks.

busctl get-property org.freedesktop.systemd1 '*' org.freedesktop.systemd1.Manager Version
Assertion 'object_path_is_valid(path)' failed at src/libsystemd/sd-bus/bus-message.c:562, function sd_bus_message_new_method_call(). Aborting.
Aborted (core dumped)

(cherry picked from commit b16e6fd76788e74ce7424404445e822655abd6c9)
(cherry picked from commit 6961d8ac6e0cc8d81c20c7de07595834ffabd556)

5 months agonetwork/ndisc: drop only default gateway via the host when a neighbor announcement...
Yu Watanabe [Sat, 26 Apr 2025 01:50:26 +0000 (10:50 +0900)] 
network/ndisc: drop only default gateway via the host when a neighbor announcement without router flag is received

A host can send Router Advertisements (RAs) without acting as a router.
In such cases, the lifetime of the RA header should be zero, but may
contain several options, and clients can configure addresses, routes,
and so on with the message. The host may (should?) send Neighbor
Announcements (NAs) without the router flag in that case.

So, when a NA without the router flag is received, let's not drop
configurations based on the previous RA options, but only drop the
default gateway configured based on the RA header.

See RFC 4861 Neighbor Discovery in IPv6, section 6.3.4:
https://www.rfc-editor.org/rfc/rfc4861#section-6.3.4:~:text=%2D%20The%20IsRouter%20flag,as%20a%20host.
> - The IsRouter flag in the cache entry MUST be set based on the Router
>   flag in the received advertisement. In those cases where the IsRouter
>   flag changes from TRUE to FALSE as a result of this update, the node
>   MUST remove that router from the Default Router List and update the
>   Destination Cache entries for all destinations using that neighbor as
>   a router as specified in Section 7.3.3. This is needed to detect when
>   a node that is used as a router stops forwarding packets due to being
>   configured as a host.

Fixes a regression caused by 87a33c0740524e894a170f75638012c2c5f90f24 (v256).
Fixes #37198.

(cherry picked from commit 9142bd5a8e9ed94ecbb1e335305e24760b90ad2a)
(cherry picked from commit a98e9764e348262906ce9480b825a568a4d01cd7)

5 months agoman/network: clarify SR-IOV section description and usage
Tim Small [Sun, 27 Apr 2025 11:47:53 +0000 (12:47 +0100)] 
man/network: clarify SR-IOV section description and usage

Document effect of the SR-IOV section in .link vs .network files and
restructure the SR-IOV section introduction for clarity.

(cherry picked from commit 8e24558e611e2ef66552b1da0b62b7ee1220e255)
(cherry picked from commit 3a668aae1398762438b9ffee75622e552f9d7f11)

5 months agosd-varlink: refuse accepting more than 253 fds to send along with a Varlink message
Lennart Poettering [Fri, 25 Apr 2025 17:58:22 +0000 (19:58 +0200)] 
sd-varlink: refuse accepting more than 253 fds to send along with a Varlink message

253 is the max number of fds one can send at once on a Linux AF_UNIX
socket. Hence refuse to send more early.

(cherry picked from commit 92c52a9ba6eea2d3bbb6289a512eeca083ec2578)
(cherry picked from commit d80f2b149cb282c9a0737a6cdf847be2ee81bfeb)

5 months agosd-daemon: add fd array size safety check to sd_notify_with_fds()
Lennart Poettering [Mon, 4 Nov 2024 10:18:29 +0000 (11:18 +0100)] 
sd-daemon: add fd array size safety check to sd_notify_with_fds()

The previous commit removed the UINT_MAX check for the fd array. Let's
now re-add one, but at a better place, and with a more useful limit. As
it turns out the kernel does not allow passing more than 253 fds at the
same time, hence use that as limit. And do so immediately before
calculating the control buffer size, so that we catch multiplication
overflows.

(cherry picked from commit cb42df5310e701b751331ae62432e3fb0df2f660)

5 months agobasic/time-util: fix error handling of clock_nanosleep()
David Rheinsberg [Mon, 28 Apr 2025 11:13:10 +0000 (13:13 +0200)] 
basic/time-util: fix error handling of clock_nanosleep()

`clock_nanosleep()` returns error codes directly, rather than using
`errno`. Ensure that we use those codes, rather than checking for `<0`.

(cherry picked from commit 81660754981ce66d194df9f1773edd22840f3daa)
(cherry picked from commit b61ef0b632991b6083c1bb19a014f4925629d8f7)

5 months agoman/busctl: many other commands can take --json=/-j
Yu Watanabe [Sat, 26 Apr 2025 01:35:38 +0000 (10:35 +0900)] 
man/busctl: many other commands can take --json=/-j

Also, in a futre remaining commands may also support the option.
Let's not mention which command support the options.

Closes #37210.

(cherry picked from commit 531cf425e839dfc5eff2c1177ba2bf172de3170b)
(cherry picked from commit 3d2283f4010d5f177f076b67a740c0b6aad29ce4)

5 months agoman/sd_bus_slot_set_floating: Improve wording around b parameter
Jesper Nilsson [Sat, 26 Apr 2025 15:39:56 +0000 (17:39 +0200)] 
man/sd_bus_slot_set_floating: Improve wording around b parameter

(cherry picked from commit d93292bc599311d07e2b86d048a6a01b96d3e27d)
(cherry picked from commit df3529008ef31b4312b7c7e6fab39868f6499a5a)

5 months agoman: update fedora release to F42
Zbigniew Jędrzejewski-Szmek [Fri, 25 Apr 2025 11:58:07 +0000 (13:58 +0200)] 
man: update fedora release to F42

F42 was released a few weeks ago.

(cherry picked from commit f6d524a0e6eee4a746ba709db63d3a6e278739f1)
(cherry picked from commit 259c2aa79b34609905289f1fc865627196cd9264)

5 months agoTEST-82-SOFTREBOOT: add test case for uevents generated during soft-reboot
Yu Watanabe [Wed, 9 Apr 2025 13:14:56 +0000 (22:14 +0900)] 
TEST-82-SOFTREBOOT: add test case for uevents generated during soft-reboot

(cherry picked from commit 28659e1eacbe09b75ace4b4cb07a1d5dd1eb8c66)
(cherry picked from commit bfddf144a878a1632e6aee13306cb2cc95500874)

5 months agounits: stop systemd-udevd before soft-reboot
Yu Watanabe [Mon, 7 Apr 2025 08:31:05 +0000 (17:31 +0900)] 
units: stop systemd-udevd before soft-reboot

Otherwise, queued uevents may be lost on soft-reboot.

Similar to f89985ca494b79b2beed47e1f10d46ef2d59ce3e, but for
systemd-udevd.

(cherry picked from commit 0d1819e791a97367c2c0cead738111cfcc1e7491)
(cherry picked from commit af18de3f7f65a22d0dacbb6d35345f5199a56172)

5 months agocore/socket: do not enter failed state when we cannot start service due to conflictin...
Yu Watanabe [Wed, 9 Apr 2025 13:10:42 +0000 (22:10 +0900)] 
core/socket: do not enter failed state when we cannot start service due to conflicting transaction being queued

Otherwise, e.g. on soft-reboot, socket unit may enter the failed state
and the socket buffer will be cleared.

(cherry picked from commit b50f6dbe574b0421db7dbf200ad951186382277d)
(cherry picked from commit 4ebbe41bc09922c47e341549fea9b8462a026dc0)

5 months agotest-specifier: replace /dev/initctl with /dev/fd
Yu Watanabe [Tue, 22 Apr 2025 00:24:39 +0000 (09:24 +0900)] 
test-specifier: replace /dev/initctl with /dev/fd

To make the test work even when systemd is built without SysV compat.

(cherry picked from commit b4d51152648fe9c1cd89b04ab84806756f453084)
(cherry picked from commit 094865105c10534d6bda3003ffbbea02c00794fd)

5 months agoman/systemd: fix mapping from SysV runlevel to actual target name
Yu Watanabe [Mon, 21 Apr 2025 01:50:57 +0000 (10:50 +0900)] 
man/systemd: fix mapping from SysV runlevel to actual target name

See runlevel_to_target() in src/shared/unit-file.c.

(cherry picked from commit 70fd998c40649c898b98b413517c142991a29657)
(cherry picked from commit 9e2a25fad629dd9d676c829b8b15e76bda6b5460)

5 months agoman/systemctl: list-sockets command sorts the result
Yu Watanabe [Sun, 20 Apr 2025 20:30:09 +0000 (05:30 +0900)] 
man/systemctl: list-sockets command sorts the result

This updates the example output of list-sockets command.

(cherry picked from commit f7586abfe0ea4c0fa63819148a770851d84506c8)
(cherry picked from commit fc078eda7b0a53e0bac3450101c2a6027a6220f5)

5 months agoman/sd-bus: Add at least one reference per sd-bus function man page
igo95862 [Sun, 20 Apr 2025 16:02:01 +0000 (17:02 +0100)] 
man/sd-bus: Add at least one reference per sd-bus function man page

Some sd-bus man pages did not have any references on the main
 sd-bus man page. Unless you accidentally stumbled on them from
other pages  it was difficult to discover them.

(cherry picked from commit 399a358a387aad8df97ba25d9268cbc42f805519)
(cherry picked from commit 856f703c8029e376bbf4550c3ff71d7482d0a3b0)

5 months agoman/sd_bus_emit_signal: Fix extra const for strv functions
igo95862 [Sun, 20 Apr 2025 15:14:23 +0000 (16:14 +0100)] 
man/sd_bus_emit_signal: Fix extra const for strv functions

The functions `sd_bus_emit_interfaces_added_strv`, `sd_bus_emit_interfaces_removed_strv`
and `sd_bus_emit_properties_changed_strv` take an `char **` not
`const char **` as last argument.

See `src/systemd/sd-bus.h` for the function definition.

(cherry picked from commit 3f75684028da5e5e035e51bde773b77e135be26a)
(cherry picked from commit 196a1c3ccb81033e1b54076ba984bfbbbe0dd9de)

5 months agodocs/MEMORY_PRESSURE: Replace incorrect "packages" with correct "pages"
Alexander Kurtz [Sun, 20 Apr 2025 08:31:22 +0000 (10:31 +0200)] 
docs/MEMORY_PRESSURE: Replace incorrect "packages" with correct "pages"

(cherry picked from commit e8939ebcd376da4ab90f8840e8eaa4db5bd83210)
(cherry picked from commit 8acffbf0abfcaa4de82a81e62d0acee7b896f122)

5 months agoshutdown: handle gracefully if a device disappears while we detach it
Lennart Poettering [Thu, 17 Apr 2025 12:39:34 +0000 (14:39 +0200)] 
shutdown: handle gracefully if a device disappears while we detach it

Let's gracefully handle cases where a device disappears in the time we
between our discovery and when we want to detach it, due to "auto-clear"
or a similar logic.

The loopback case already handled this quite OK, do the same for MD and
swap too.

Switch to ERRNO_IS_DEVICE_ABSENT() for all checks, just in case.

Also improve debug logging for all these cases, so we know exactly what
is going on.

This is inspired by #37160, but shouldn't really fix anything there, I
am pretty sure the ENODEV seen in that output stems from the STOP_ARRAY
call, not from the open().

Note that this does not change anything for the device mapper case,
because the DM subsystem does not return useful error codes to
userspace, hence everything is a complete mess there.

(cherry picked from commit 2791b2bc3d84efe674d05e45fa85333eea05ad6f)
(cherry picked from commit 4f0a4976dfe64399bc5a3c6b8f00675e2548b067)

5 months agolocale-util: fix argument for munmap()
Yu Watanabe [Fri, 11 Apr 2025 00:11:05 +0000 (09:11 +0900)] 
locale-util: fix argument for munmap()

(cherry picked from commit 90abb64fd508e8efd937178b3379a62ac97b49ec)
(cherry picked from commit 445b4931807089bb7c7b12a8b09f3a580f63f643)

5 months agoman: mention special functionality for reload-or-restart with --marked (#37076)
Christian Hesse [Wed, 9 Apr 2025 21:03:06 +0000 (23:03 +0200)] 
man: mention special functionality for reload-or-restart with --marked (#37076)

We had a downstream discussion on what `systemctl reload-or-restart
--marked` does, until upstream chimed in and pointed on very special
behavior for that combination. 😜

The second references the first, but not vice versa. Let's fix this.

(cherry picked from commit e1a932f3c53c7cc4dded01240d6d9d49d861304b)
(cherry picked from commit 5aec47af8894bd6a901c0e5b7e0bc3f375ef2f65)

5 months agoshared/calendarspec: fix normalization when DST is negative
kmeaw [Sun, 30 Mar 2025 12:08:38 +0000 (13:08 +0100)] 
shared/calendarspec: fix normalization when DST is negative

When trying to calculate the next firing of 'hourly', we'd lose the
tm_isdst value on the next iteration.

On most systems in Europe/Dublin it would cause a 100% cpu hang due to
timers restarting.

This happens in Europe/Dublin because Ireland defines the Irish Standard Time
as UTC+1, so winter time is encoded in tzdata as negative 1 hour of daylight
saving.

Before this patch:
$ env TZ=IST-1GMT-0,M10.5.0/1,M3.5.0/1 systemd-analyze calendar --base-time='Sat 2025-03-29 22:00:00 UTC' --iterations=5 'hourly'
  Original form: hourly
Normalized form: *-*-* *:00:00
    Next elapse: Sat 2025-03-29 23:00:00 GMT
       (in UTC): Sat 2025-03-29 23:00:00 UTC
       From now: 13h ago
   Iteration #2: Sun 2025-03-30 00:00:00 GMT
       (in UTC): Sun 2025-03-30 00:00:00 UTC
       From now: 12h ago
   Iteration #3: Sun 2025-03-30 00:00:00 GMT  <-- note every next iteration having the same firing time
       (in UTC): Sun 2025-03-30 00:00:00 UTC
       From now: 12h ago
...

With this patch:
$ env TZ=IST-1GMT-0,M10.5.0/1,M3.5.0/1 systemd-analyze calendar --base-time='Sat 2025-03-29 22:00:00 UTC' --iterations=5 'hourly'
  Original form: hourly
Normalized form: *-*-* *:00:00
    Next elapse: Sat 2025-03-29 23:00:00 GMT
       (in UTC): Sat 2025-03-29 23:00:00 UTC
       From now: 13h ago
   Iteration #2: Sun 2025-03-30 00:00:00 GMT
       (in UTC): Sun 2025-03-30 00:00:00 UTC
       From now: 12h ago
   Iteration #3: Sun 2025-03-30 02:00:00 IST  <-- the expected 1 hour jump
       (in UTC): Sun 2025-03-30 01:00:00 UTC
       From now: 11h ago
...

This bug isn't reproduced on Debian and Ubuntu because they mitigate it by
using the rearguard version of tzdata. ArchLinux and NixOS don't, so it would
cause pid1 to spin during DST transition.

This is how the affected tzdata looks like:
$ zdump -V -c 2024,2025 Europe/Dublin
Europe/Dublin  Sun Mar 31 00:59:59 2024 UT = Sun Mar 31 00:59:59 2024 GMT isdst=1 gmtoff=0
Europe/Dublin  Sun Mar 31 01:00:00 2024 UT = Sun Mar 31 02:00:00 2024 IST isdst=0 gmtoff=3600
Europe/Dublin  Sun Oct 27 00:59:59 2024 UT = Sun Oct 27 01:59:59 2024 IST isdst=0 gmtoff=3600
Europe/Dublin  Sun Oct 27 01:00:00 2024 UT = Sun Oct 27 01:00:00 2024 GMT isdst=1 gmtoff=0

Compare it to Europe/London:
$ zdump -V -c 2024,2025 Europe/London
Europe/London  Sun Mar 31 00:59:59 2024 UT = Sun Mar 31 00:59:59 2024 GMT isdst=0 gmtoff=0
Europe/London  Sun Mar 31 01:00:00 2024 UT = Sun Mar 31 02:00:00 2024 BST isdst=1 gmtoff=3600
Europe/London  Sun Oct 27 00:59:59 2024 UT = Sun Oct 27 01:59:59 2024 BST isdst=1 gmtoff=3600
Europe/London  Sun Oct 27 01:00:00 2024 UT = Sun Oct 27 01:00:00 2024 GMT isdst=0 gmtoff=0

Fixes #32039.

(cherry picked from commit e4bb033e2fcea504f7496df90be7a3556fcea44b)
(cherry picked from commit 07c01efc82d4a239ef0d14da54d36053294ad203)

There were some conflicts related to the skipping of
6f5cf41570776f489967d1a7de18260b2bc9acf9, but the tests pass with and the
example output above also looks good, so I think the backport is correct.

5 months agobasic/namespace-util: obtain uid and gid before unsharing user namespace
Michal Sekletar [Fri, 7 Feb 2025 19:18:49 +0000 (20:18 +0100)] 
basic/namespace-util: obtain uid and gid before unsharing user namespace

Getting user and group after unsharing user namespace is too late
because without any mapping, i.e. just after unshare(), we are mapped to
nobody.

(cherry picked from commit 8b5e3be88eeb1bdba50c87cb24d9e6b31e825f38)

The chunk in test-namespace that used pidref_in_same_namespace() was dropped.

(cherry picked from commit 071e18561043e9fed12171cf795973ef1866d373)

5 months agoAdd ASSERT_OK_ZERO_ERRNO() and ASSERT_OK_EQ_ERRNO()
Daan De Meyer [Thu, 19 Sep 2024 09:38:47 +0000 (11:38 +0200)] 
Add ASSERT_OK_ZERO_ERRNO() and ASSERT_OK_EQ_ERRNO()

(cherry picked from commit 1d8a81eb4ea8e8c1fc82e839cb9f2a65da5346ad)

5 months agoTEST-04-JOURNAL: include util.sh before calling cgroupfs_supports_user_xattrs()
Yu Watanabe [Mon, 7 Apr 2025 17:49:07 +0000 (02:49 +0900)] 
TEST-04-JOURNAL: include util.sh before calling cgroupfs_supports_user_xattrs()

Fixes a bug introduced by 46322f27427ab10ef4fca4d189f8eed27d1b5eaf (v256).
Fixes #36991.

(cherry picked from commit 86d59686b720acbf967b09049fb3d63d34039f87)
(cherry picked from commit 02220b9edc5b6ccb4a3a44c55235a7eb061de5cd)

5 months agofstab-generator: fix options in systemd.mount-extra= arg
Jules Lamur [Mon, 7 Apr 2025 16:49:26 +0000 (18:49 +0200)] 
fstab-generator: fix options in systemd.mount-extra= arg

Fixes a bug introduced by 55365b0a233ae3024411fd0815ad930e20f6a3d6 (v254).

The arguments `(rd.)systemd.mount-extra` take a value that looks like
`WHAT:WHERE[:FSTYPE[:OPTIONS]]`. The `OPTIONS` were parsed into a nulstr
where a comma-separated c-string was expected. This leads to a bug where
only the first option was taken into account by the generator.

For example, if you passed `systemd.mount-extra=/x:/y:baz:ro,defaults`
to the kernel, `systemd-fstab-generator` would translate that into a
nulstr: `ro\0defaults\0`.
Since methods processing options in the generator expected a
comma-separated c-string, they would only see the first option, `ro` in
this case.

(cherry picked from commit 06fadc4286fee6a7505a88659e5ae2e6f3ee60ba)
(cherry picked from commit 0122eae1af270baed63b258852fa26396ea00fc8)

5 months agotest: switch to new config keyword for bind9 >= 9.21
Luca Boccassi [Mon, 7 Apr 2025 19:55:41 +0000 (20:55 +0100)] 
test: switch to new config keyword for bind9 >= 9.21

bind9 9.21 removed the deprecated 'managed-keys', swap it with
'trust-anchors' if the version is 9.21 or newer

[   20.654086] TEST-75-RESOLVED.sh[1217]: + delv -a /etc/bind.keys @ns1.unsigned.test signed.test
[   20.654425] TEST-75-RESOLVED.sh[1218]: + tee /tmp/tmp.D4LNomAKqY
[   20.672599] TEST-75-RESOLVED.sh[1218]: ;; /etc/bind.keys:1: option 'managed-keys' no longer exists

(cherry picked from commit 5f8e5297b4699922aa003353ac1db6559805301f)
(cherry picked from commit 85df0981b27c59649fa75916ba1efb4fe820a4dd)

5 months agobacklight: Drop support for actual_brightness
Mario Limonciello [Fri, 28 Mar 2025 14:19:23 +0000 (09:19 -0500)] 
backlight: Drop support for actual_brightness

Some AMD systems have support for features like custom brightness
curve or adaptive backlight management.  These features allow the
display driver to adjust the brightness based upon other factors
than just the user brightness request.

The user's brightness request is indicated in the 'brightness' file
but the effective result of the logic in the display driver is stored
in the 'actual_brightness' file.

This leads to problems when shutting the system down because the value
of 'actual_brightness' may be lower than 'brightness' and the wrong value
gets stored for the next boot.

For example if the brightness a user requested was 150, the actual_brightness
might be 130. So the next boot the brightness will be "set" to 130, but the
actual brightness might be 115. If the user reboots again it will be set to 115
for the next boot but the actual brightness might be 100. That is this gets worse
and worse each reboot cycle until the system eventually boots up at minimum
brightness.

Furthermore the kernel documentation indicates that the brightness and
actual_brightness files are not guaranteed to be the same values.

Due to this; drop the use of 'actual_brightness' when saving/restoring brightness
and instead rely only upon 'brightness'.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
(cherry picked from commit 9a224c307b36610e3675390eb2620e74d0f4efb0)
(cherry picked from commit 8f93a8c5282397feb30a54687dce6921faa90d84)

5 months agotest: add test case for PAMName= $SHELL acquisition for root
Mike Yuan [Tue, 8 Apr 2025 23:38:52 +0000 (01:38 +0200)] 
test: add test case for PAMName= $SHELL acquisition for root

(cherry picked from commit aadb8f978475d622ead0814db0d970f09592cb25)
(cherry picked from commit b893fb5c41d8eba1abe0279fb40a6a901acee6e3)

5 months agocore/exec-invoke: consult NSS for root user creds if SetLoginEnvironment=/PAMName=
Mike Yuan [Tue, 8 Apr 2025 13:20:21 +0000 (15:20 +0200)] 
core/exec-invoke: consult NSS for root user creds if SetLoginEnvironment=/PAMName=

(cherry picked from commit 9c0d8b8c4f18de76f945e82030db82135e7ffa34)
(cherry picked from commit e558789a228dc34f6a5c60ad9f76f4996f4712d6)

5 months agocore/exec-invoke: never override acquired user cred with fallback one
Mike Yuan [Tue, 8 Apr 2025 14:43:28 +0000 (16:43 +0200)] 
core/exec-invoke: never override acquired user cred with fallback one

(cherry picked from commit 2fb438cc88826399f39305765a7881cbf63b5e49)
(cherry picked from commit a9b4a0f3a56ffaa96d0e9824446bf15588ed6ff0)

5 months agorun0: make sure we submit $SHELL to remote
Mike Yuan [Tue, 8 Apr 2025 20:35:14 +0000 (22:35 +0200)] 
run0: make sure we submit $SHELL to remote

Normally, the service manager sets $SHELL to the target user's
login shell, but run0 always overrides that with either
originating user's shell or value from --setenv=SHELL=. In both cases
$SHELL needs to be sent.

Fixes #35007

(cherry picked from commit ba7fb8cf5f8f6ad26ff5509722ab4795e566bf09)
(cherry picked from commit fbfeda9ff5eefad33dbb40c02c1d51e877a7baa5)

5 months agotest-sd-device: limit the number of iterations when testing device parent/child functions
Zbigniew Jędrzejewski-Szmek [Thu, 10 Apr 2025 11:51:21 +0000 (13:51 +0200)] 
test-sd-device: limit the number of iterations when testing device parent/child functions

The test "hangs" and times out on some arm64 machines. It actually works as
expected, but the machine has 2016 children under /sys/devices/system/memory/,
and the tests do a double loop over this, which is slow enough to hit the 120 s
limit. Add a limit on the number of iterations.

Another option would be to exclude "memory" subsystem. But we may have other
subsystems which have the same problem in the future, so I think it'll be more
robust to not try to limit the fix to a specific subsystem.

(cherry picked from commit 74cb65e45fbf3468cf6b522e4b4fa568d95f12c6)
(cherry picked from commit e35435b0a11e6c61c8c43b0cf8dc65a563b4a670)

5 months agomkosi: Fix arch build script version sed expression
Daan De Meyer [Thu, 3 Apr 2025 20:44:32 +0000 (22:44 +0200)] 
mkosi: Fix arch build script version sed expression

Yours truly got rid of the _tag variable in the Arch Linux PKGBUILD
a while ago, so actually adapt the build script to that by changing
the pkgver= variable instead.

(cherry picked from commit a0ca911d633690a0c2097a4319daf1d3a803fb70)
(cherry picked from commit 9c6be09b236bd33b03ecd9e8b5fbea2e74c8bf08)

7 months agomeson: bump version to 256.13 v256.13
Luca Boccassi [Tue, 8 Apr 2025 19:53:00 +0000 (20:53 +0100)] 
meson: bump version to 256.13

7 months agomkosi: switch rootfs to ext4
Luca Boccassi [Wed, 22 Jan 2025 19:11:55 +0000 (19:11 +0000)] 
mkosi: switch rootfs to ext4

btrfs is currently broken for nspawn on recent kernels, so switch
to the best filesystem until that is solved

(cherry picked from commit f6eed063a63b71ef42bc54c64592a2eeed8a4f8c)
(cherry picked from commit adf4d826718b513dcf53801eff4699225d4e908f)

7 months agofuzz-journal-remote: use ASSERT_OK() and friends
Yu Watanabe [Sat, 28 Dec 2024 05:17:47 +0000 (14:17 +0900)] 
fuzz-journal-remote: use ASSERT_OK() and friends

(cherry picked from commit 27c992dd9fa7f69779adc85607523a1e52296af0)
(cherry picked from commit 20761edab505815296fde8919c592e598a1211ca)

7 months agologs-show: skip journal entry with an invalid timestamp
Yu Watanabe [Sat, 28 Dec 2024 05:09:22 +0000 (14:09 +0900)] 
logs-show: skip journal entry with an invalid timestamp

Follow-up for 275e6be052e690adcad5d2a557acb9dcb5bedbc6.
Fixes oss-fuzz#385221809 (https://issues.oss-fuzz.com/issues/385221809).
Fixes #35737.

(cherry picked from commit f19f640513cf3ededdf1f5cc6f00efca27efc61f)
(cherry picked from commit 65dac0aca471a0ae1c7c9bba849653291623ce2e)

7 months agomeson: Set PYTHONDONTWRITEBYTECODE=1 in test environment
Daan De Meyer [Tue, 1 Apr 2025 14:11:14 +0000 (16:11 +0200)] 
meson: Set PYTHONDONTWRITEBYTECODE=1 in test environment

Let's not pollute the source tree with __pycache__ files.

(cherry picked from commit 51b74abb4809343751a86df6ccba351862a2f88c)
(cherry picked from commit 906ca21039e51853496b944627e813b577b541c7)

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.

(cherry picked from commit c2d2b382b6440dbb3795a3982260cf9534bbf2de)
(cherry picked from commit c95c0f10773c6501367786094864e6062263c2ab)

7 months agotest: rename README.testsuite -> README.md
Yu Watanabe [Thu, 12 Dec 2024 03:02:19 +0000 (12:02 +0900)] 
test: rename README.testsuite -> README.md

(cherry picked from commit 9d8cb69e7f461f4051d4fdd91a2a6a3e0d464722)
(cherry picked from commit ab1f71fbc018429c5d8fa247125101e11d43af14)

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.

(cherry picked from commit 52b4371807eff68c6f3b1806937af0e8a95e7f40)
(cherry picked from commit 6bbe09a4bc14f9b771235fc6dfe1f21ccf28477a)

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

(cherry picked from commit da2498352635921621a636014fee0547c53058b2)
(cherry picked from commit 88a0d3dfcb7f5769ac1b1add3d66d9699252dfe0)

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

(cherry picked from commit 75b16ac59ed25d6aad77d5a39022476312fb3349)
(cherry picked from commit 0a0e4d9bf5817d8f9a36d8dbb4a0d8eaad43dc82)

7 months agotest: replace deprecated --hostid= with --hostnqn=
Yu Watanabe [Tue, 1 Apr 2025 10:00:50 +0000 (19:00 +0900)] 
test: replace deprecated --hostid= with --hostnqn=

Fixes #36908.

(cherry picked from commit c70a113a6c2b02f667498c8385bedd1a873edb2c)
(cherry picked from commit c4eeb99c2192e9318566d045af985712dfd3d02c)

7 months agotest: pass verbose option to nvme-cli
Luca Boccassi [Mon, 31 Mar 2025 14:44:11 +0000 (15:44 +0100)] 
test: pass verbose option to nvme-cli

When the test fails due to nvme-cli/kernel issues it's hard to report it
upstream as there's not enough details, add verbose flags

(cherry picked from commit ebc0514a6507d51e536b269e30a036a7992beeb7)
(cherry picked from commit b87f618a30cb664326d2211d8dd7b30a442318b4)

7 months agoudev: update log messages
Yu Watanabe [Tue, 1 Apr 2025 06:39:37 +0000 (15:39 +0900)] 
udev: update log messages

(cherry picked from commit 6941bf6b7736f1151862ac36e70c846e3ce0398a)
(cherry picked from commit 287ebf79ce6f13f0ee19baefd84be029d6e64315)

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

(cherry picked from commit 521b6bb1177b534db6cab28c889e6550680517c4)
(cherry picked from commit 03605d767ffcd446da876a97de967d4d8b56272c)

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

(cherry picked from commit 94a5969b31a5556ee7bc11d0e9ae337de5a6ff42)
(cherry picked from commit f09ccc2eb4edba77021f6c980e29143a8b7433ba)

7 months agoman/systed.swap: update description of implicit deps
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.

(cherry picked from commit 4dd94e5ba1de7e3aa732176e0b60d94aec50c05e)
(cherry picked from commit 65b3d7f08a8ecf66164eaafba9e467e558e4cf59)

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

(cherry picked from commit 7a468f277b217b8bf25fca89706364afa99e376c)
(cherry picked from commit 2a35f220477ca655d1f49f119348e3f216405d54)

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

(cherry picked from commit b065ff03b1e9a6409d0e4fec10e3b802cc067e8b)
(cherry picked from commit 694aa0115d77e41dbda80891d8a4b766313adfae)

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.

(cherry picked from commit dadaad157edda8d9a659c04c60cbc1c603c1c586)
(cherry picked from commit 1c56f9ec438944ff46d1e3849b30d6ad6cbba237)

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.

(cherry picked from commit f0cfb6a791e2efc7ae7e473ea89ad99b6077d928)
(cherry picked from commit 864900120fb7f49deb730484f05b22ba6554d5c3)

7 months agocore: not sure why but TTYRows/TTYColumns property is 16bit towards outside, 32bit...
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

(cherry picked from commit ed13622bc83deeade066aac31cd96d5c52efe028)
(cherry picked from commit e3b16c73ae0263ded58297e0ed7a080c76217e71)

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

(cherry picked from commit 0b0cb6f33d0c1256e8cc2b77ab361b55ac911105)
(cherry picked from commit aba08e3edb180b620e5152cdbc2bd8922adc8680)

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

(cherry picked from commit fefcb935cd1181f580d9189b733673ce9abcf7e1)
(cherry picked from commit be5114ed3f74cbc55d136a6818778ed52b34eba6)

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.

(cherry picked from commit 07a6e1db06c9603d83e4329099b87a60a35662e7)
(cherry picked from commit 503ecb4914ae11f4a1daafd844125bbd7fe20a84)

7 months agomkosi: Log in mkosi.sync when we don't check out commit
Daan De Meyer [Fri, 21 Mar 2025 13:30:34 +0000 (14:30 +0100)] 
mkosi: Log in mkosi.sync when we don't check out commit

(cherry picked from commit 3ffcbb6b9a0f13325b4f73233a6d9b28ad240310)
(cherry picked from commit 8cd8ac8d92e1628b66b48135a603aae70e2170b1)

7 months agomkosi: Add unix_chkpwd to sanitizer wrapped binaries
Daan De Meyer [Tue, 18 Mar 2025 21:45:17 +0000 (22:45 +0100)] 
mkosi: Add unix_chkpwd to sanitizer wrapped binaries

unix_chkpwd will retrieve the user name of the uid it is invoked as
and as such needs the asan workaround.

(cherry picked from commit 5ecc08e033653fecd90afd7780ab14f54a1e1f54)
(cherry picked from commit c2e287e15f518fe37576a4456a0343dba673ab8b)

7 months agoTEST-73-LOCALE: do not unnecessarily restart systemd-localed
Yu Watanabe [Thu, 13 Mar 2025 03:11:40 +0000 (12:11 +0900)] 
TEST-73-LOCALE: do not unnecessarily restart systemd-localed

It is not necessary to clear previous keymap assignment, as
`localectl set-keymap` will anyway overwrite the previous assignment.

This drops the unnecessary restart of systemd-localed in the loop.
The mkosi test image contains about 500~700 keymaps. The test
performance is greatly improved by reducing the number of restarts,
especially when the test is running with sanitizers.

On Fedora 41 with sanitizers,
Before:
1/1 systemd:integration-tests / TEST-73-LOCALE OK             1157.50s
After:
1/1 systemd:integration-tests / TEST-73-LOCALE OK              104.43s

(cherry picked from commit d8a353552a924592d41a1538ee95d516c9facf30)
(cherry picked from commit 614a284f472c0f162f1ea93092c1b03646138f0b)

7 months agoudev: make udevadm and friends not warn about unknown settings
Yu Watanabe [Fri, 21 Mar 2025 00:54:45 +0000 (09:54 +0900)] 
udev: make udevadm and friends not warn about unknown settings

Without this change, when e.g. event_timeout= is specified in udev.conf,
udevadm and friends which loads udev.conf warn about unknown key:
===
$ udevadm info /sys/class/net/lo
/run/udev/udev.conf.d/test-17.conf:1: Unknown key 'event_timeout', ignoring.
/run/udev/udev.conf.d/test-17.conf:2: Unknown key 'timeout_signal', ignoring.
===

Follow-up for 07f5e35fe7967c824a87f18a3a1d3c22e5be70f5 (v256).

(cherry picked from commit 90670111a9f18aff7d37fa3ec3bc5b73ce3b784d)
(cherry picked from commit b989696f76902558f781a1dc9aae25e0a8dc1cc4)