1
0
mirror of https://github.com/systemd/systemd synced 2025-11-14 14:24:45 +01:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Mike Yuan
f8293452b6
meson: drop dangling reference to gcrypt
... which was also a typo ;)

Follow-up for e9d4b88b817b9711291d8734cffdd4faf94b584a
2025-11-08 02:11:05 +01:00
Yu Watanabe
61fffbfa58 meson: sysupdate requires systemd-pull and friends
Fixes #39635.
2025-11-08 08:54:42 +09:00
Mike Yuan
89e74275ad core/execute: morph exec_output_is_* to _forward_to_*
Follow-up for 379d9ae222c52f93692e06d5b33fb341791b9688

After the commit, the functions are only used to determine
whether journals shall be forwarded to selected targets,
hence rename as such and remove effectively unused condition
on EXEC_OUTPUT_TTY.
2025-11-08 08:54:13 +09:00
Luca Boccassi
2db3e403ae test: rotate journal before invocation test
Occasionally there are truncated journals failing this test:

[  884.181701] H TEST-04-JOURNAL.sh[12104]: ++ journalctl --no-hostname -n 1 -t bash --invocation=fe8122a7d8eb42c7bf357ac5fafa95e1
[  884.181749] H TEST-04-JOURNAL.sh[12091]: + assert_in 'invocation 1 fe8122a7d8eb42c7bf357ac5fafa95e1' 'Nov 06 17:27:10 bash[11985]: invocation 1 fe8122a7d8eb42c7bf357ac5fafa95e1'
[  884.181773] H TEST-04-JOURNAL.sh[12105]: + set +ex
[  884.181819] H TEST-04-JOURNAL.sh[12091]: + read -r idx invocation _
[  884.181819] H TEST-04-JOURNAL.sh[12091]: + i=2
[  884.181865] H TEST-04-JOURNAL.sh[12106]: ++ journalctl --no-hostname -n 1 -t bash --invocation=2 -u invocation-id-test-20992
[  884.181865] H TEST-04-JOURNAL.sh[12106]: Journal file /var/log/journal/936183a66e7c47939693ae37a967e4fd/system.journal is truncated, ignoring file.
[  884.181865] H TEST-04-JOURNAL.sh[12106]: No journal entry found for the invocation (+2).
[  884.181952] H TEST-04-JOURNAL.sh[12091]: + assert_in 'invocation 2 07d0bd6b5c654b148541d798abccaa96' ''
[  884.181972] H TEST-04-JOURNAL.sh[12107]: + set +ex
[  884.181972] H TEST-04-JOURNAL.sh[12107]: FAIL: 'invocation 2 07d0bd6b5c654b148541d798abccaa96' not found in:

Rotate it at the beginning of the test case to try and avoid this.

Fixes https://github.com/systemd/systemd/issues/39601
2025-11-07 21:35:45 +00:00
Yu Watanabe
f0fdb69a8d core: assign TTY to PAM context when TTYPath= is specified
Fixes #38486 again, which was fixed by
1405d46bf998b5a4b6f572a14ac88890828a405d, but regressed again by
f875a8026ec2dfa6026da3ee216782e9f7c04a43.

This also make it use exec_input_is_terminal().

Follow-up for f875a8026ec2dfa6026da3ee216782e9f7c04a43.
2025-11-08 06:12:20 +09:00
Frantisek Sumsal
6d510012b7 test: move the system time to exactly the timer's elapse time
When we moved the time to 1 minute after the timer would've elapsed,
systemd could pick RandomizedDelaySec= <= 1 minute which would then
cause the timer to elapse immediately and the InactiveExitTimestamp=
to get recalculated including a new next elapse time that would be for
the next "window":

systemd[1]: timer-RandomizedDelaySec-30785.timer: Adding 3.634672s random time.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Realtime timer elapses at Fri 2025-11-07 00:10:03 UTC.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Timer elapsed.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Changed waiting -> running
systemd[1]: Found unit timer-RandomizedDelaySec-30785.timer at /run/systemd/system/timer-RandomizedDelaySec-30785.timer (regular file)
systemd[1]: Preset files say disable timer-RandomizedDelaySec-30785.timer.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Got notified about unit deactivation.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Adding 8h 39min 26.166418s random time.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Realtime timer elapses at Sat 2025-11-08 08:49:26 UTC.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Changed running -> waiting
...
TEST-53-TIMER.sh[1008]: InactiveExitTimestamp=Thu 2025-11-06 23:00:00 UTC
TEST-53-TIMER.sh[1010]: ++ systemctl show -P NextElapseUSecRealtime timer-RandomizedDelaySec-30785.timer
TEST-53-TIMER.sh[905]: + NEXT_ELAPSE_REALTIME='Sat 2025-11-08 08:49:26 UTC'
TEST-53-TIMER.sh[1011]: ++ date '--date=Sat 2025-11-08 08:49:26 UTC' +%s
TEST-53-TIMER.sh[905]: + NEXT_ELAPSE_REALTIME_S=1762591766
TEST-53-TIMER.sh[905]: + : 'Next elapse timestamp should be Fri 2025-11-07 00:10:00 UTC <= Sat 2025-11-08 08:49:26 UTC <= Fri 2025-11-07 22:10:00 UTC'
TEST-53-TIMER.sh[905]: + assert_ge 1762591766 1762474200
TEST-53-TIMER.sh[1012]: + set +ex
TEST-53-TIMER.sh[905]: + assert_le 1762591766 1762553400
TEST-53-TIMER.sh[1013]: + set +ex
TEST-53-TIMER.sh[1013]: FAIL: '1762591766' > '1762553400'

Technically, the race is still there, but the window for it should be
_much_ smaller now (< 1s on a reasonably fast system). Let's hope that's
enough.

Resolves: #39594
2025-11-07 20:04:59 +00:00
Yu Watanabe
9d6c34a297 network: fix typo
Follow-up for dd2934d44e2c9cd1a92ae0fd6806985c4bc031e6.
2025-11-08 04:27:57 +09:00
Luca Boccassi
057fe0a6ca NEWS: announce RootImageOptions= et al. incompatible changes 2025-11-08 03:24:47 +09:00
7 changed files with 55 additions and 43 deletions

8
NEWS
View File

@ -2,6 +2,14 @@ systemd System and Service Manager
CHANGES WITH 259 in spe:
Announcements of Future Feature Removals and Incompatible Changes:
* The parsing of RootImageOptions= and the mount image parameters of
ExtensionImages= and MountImages= will be changed so that the last
duplicated definition for a given partition wins and is applied,
rather than the first, to keep these options coherent with other
unit settings.
* The cgroup2 file system is now mounted with the
"memory_hugetlb_accounting" mount option, supported since kernel 6.6.
This means that HugeTLB memory usage is now counted towards the

View File

@ -1534,10 +1534,19 @@ conf.set('DEFAULT_DNSSEC_MODE',
'DNSSEC_' + default_dnssec.underscorify().to_upper())
conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
have = get_option('importd').require(
conf.get('HAVE_LIBCURL') == 1 and
conf.get('HAVE_OPENSSL') == 1 and
conf.get('HAVE_ZLIB') == 1 and
conf.get('HAVE_XZ') == 1,
error_message : 'curl, openssl, zlib and xz required').allowed()
conf.set10('ENABLE_IMPORTD', have)
have = get_option('sysupdate').require(
conf.get('ENABLE_IMPORTD') == 1 and
conf.get('HAVE_OPENSSL') == 1 and
conf.get('HAVE_LIBFDISK') == 1,
error_message : 'fdisk and openssl required').allowed()
error_message : 'systemd-importd, fdisk, and openssl required').allowed()
conf.set10('ENABLE_SYSUPDATE', have)
have2 = get_option('sysupdated')
@ -1556,14 +1565,6 @@ conf.set10('ENABLE_SYSUPDATED', have2)
conf.set10('ENABLE_STORAGETM', get_option('storagetm'))
have = get_option('importd').require(
conf.get('HAVE_LIBCURL') == 1 and
conf.get('HAVE_OPENSSL') == 1 and
conf.get('HAVE_ZLIB') == 1 and
conf.get('HAVE_XZ') == 1,
error_message : 'curl, openssl/grypt, zlib and xz required').allowed()
conf.set10('ENABLE_IMPORTD', have)
have = get_option('homed').require(
conf.get('HAVE_OPENSSL') == 1 and
conf.get('HAVE_LIBFDISK') == 1 and

View File

@ -187,6 +187,18 @@ static int connect_journal_socket(
return r;
}
static bool exec_output_forward_to_console(ExecOutput o) {
return IN_SET(o,
EXEC_OUTPUT_JOURNAL_AND_CONSOLE,
EXEC_OUTPUT_KMSG_AND_CONSOLE);
}
static bool exec_output_forward_to_kmsg(ExecOutput o) {
return IN_SET(o,
EXEC_OUTPUT_KMSG,
EXEC_OUTPUT_KMSG_AND_CONSOLE);
}
static int connect_logger_as(
const ExecContext *context,
const ExecParameters *params,
@ -231,8 +243,8 @@ static int connect_logger_as(
context->syslog_priority,
!!context->syslog_level_prefix,
false,
exec_output_is_kmsg(output),
exec_output_is_terminal(output)) < 0)
exec_output_forward_to_kmsg(output),
exec_output_forward_to_console(output)) < 0)
return -errno;
return move_fd(TAKE_FD(fd), nfd, false);
@ -1237,7 +1249,10 @@ static int exec_context_get_tty_for_pam(const ExecContext *context, char **ret)
return 1;
}
if (!IN_SET(context->std_input, EXEC_INPUT_TTY, EXEC_INPUT_TTY_FAIL, EXEC_INPUT_TTY_FORCE)) {
/* Do not implicitly configure TTY unless TTYPath= or StandardInput=tty is specified. See issue
* #39334. Note, exec_context_tty_path() returns "/dev/console" when TTYPath= is unspecified, hence
* explicitly check context->tty_path here. */
if (!context->tty_path && !exec_input_is_terminal(context->std_input)) {
*ret = NULL;
return 0;
}

View File

@ -470,19 +470,6 @@ static inline bool exec_input_is_terminal(ExecInput i) {
EXEC_INPUT_TTY_FAIL);
}
static inline bool exec_output_is_terminal(ExecOutput o) {
return IN_SET(o,
EXEC_OUTPUT_TTY,
EXEC_OUTPUT_KMSG_AND_CONSOLE,
EXEC_OUTPUT_JOURNAL_AND_CONSOLE);
}
static inline bool exec_output_is_kmsg(ExecOutput o) {
return IN_SET(o,
EXEC_OUTPUT_KMSG,
EXEC_OUTPUT_KMSG_AND_CONSOLE);
}
static inline bool exec_context_has_tty(const ExecContext *context) {
assert(context);

View File

@ -509,7 +509,7 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
SD_VARLINK_DEFINE_FIELD(Model, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("DNS servers configured for this interface"),
SD_VARLINK_DEFINE_FIELD_BY_TYPE(DNS, DNS, SD_VARLINK_ARRAY|SD_VARLINK_NULLABLE),
/* FIXME: DNR Addresses fied (json array or arrays) is incompatible with Varlink type system */
/* FIXME: DNR Addresses field (json array or arrays) is incompatible with Varlink type system */
SD_VARLINK_FIELD_COMMENT("Discovery of Network-designated Resolvers (RFC9463)"),
SD_VARLINK_DEFINE_FIELD(DNR, SD_VARLINK_OBJECT, SD_VARLINK_ARRAY|SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("NTP servers configured for this interface"),

View File

@ -18,6 +18,7 @@ TMP_DIR=$(mktemp -d)
# service stdout will not contain _SYSTEMD_INVOCATION_ID field.
SAVED_LOG_LEVEL=$(systemctl log-level)
systemctl log-level info
journalctl --rotate
# Note, if the service exits extremely fast, journald cannot find the source of the
# stream. Hence, we need to call 'journalctl --sync' before service exits.

View File

@ -75,16 +75,16 @@ check_elapse_timestamp() {
systemctl restart "$UNIT_NAME.timer"
check_elapse_timestamp
# Bump the system date to 1 minute after the original calendar timer would've expired (without any random
# delay!) - systemd should recalculate the next elapse timestamp with a new randomized delay, but it should
# use the original inactive exit timestamp as a "base", so the final timestamp should not end up beyond the
# original calendar timestamp + randomized delay range.
# Bump the system date to exactly the original calendar timer time (without any random delay!) - systemd
# should recalculate the next elapse timestamp with a new randomized delay, but it should use the original
# inactive exit timestamp as a "base", so the final timestamp should not end up beyond the original calendar
# timestamp + randomized delay range.
#
# Similarly, do the same check after doing daemon-reload, as that also forces systemd to recalculate the next
# elapse timestamp (this goes through a slightly different codepath that actually contained the original
# issue).
: "Next elapse timestamp after time jump"
date -s "tomorrow 00:11"
date -s "tomorrow 00:10"
check_elapse_timestamp
: "Next elapse timestamp after daemon-reload"