Commit Graph
80301 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek bcc1eebd8f gpt-auto-generator: improve log message
We said "exiting", but then the program continues to do other operations
and log additional messages.
2025-03-27 12:04:47 +01:00
Zbigniew Jędrzejewski-Szmek 6bb9caa256 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.
2025-03-27 12:04:43 +01:00
Zbigniew Jędrzejewski-Szmek d193cb77c7 test-execve: minor simplification 2025-03-27 12:04:40 +01:00
Zbigniew Jędrzejewski-Szmek fdfa9fd8ab various: handle the positive condition after strv_skip() first 2025-03-27 12:04:37 +01:00
Zbigniew Jędrzejewski-Szmek 129446ddec busctl: use RET_GATHER 2025-03-27 12:04:33 +01:00
Zbigniew Jędrzejewski-Szmek 635accef79 busctl: use STRV_FOREACH in the usual fashion
Also put positive branch first, do not use 'i' as a char** variable name.
2025-03-27 12:04:30 +01:00
Zbigniew Jędrzejewski-Szmek bc602f32c9 analyze: use STRV_FOREACH in consistent fashion
Also put positive condition first.
2025-03-27 12:04:27 +01:00
Zbigniew Jędrzejewski-Szmek 55a8d118d6 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.
2025-03-27 12:04:23 +01:00
Zbigniew Jędrzejewski-Szmek 872710c437 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.
2025-03-25 10:25:09 +01:00
Zbigniew Jędrzejewski-Szmek 6ba1ee5c7d 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.
2025-03-25 10:17:05 +01:00
Zbigniew Jędrzejewski-Szmek c4876f604b Ratelimit attempts to open watchdog, increase logging (#35708) 2025-03-24 21:06:57 +01:00
Luca Boccassi b065ff03b1 man: fix typo in org.freedesktop.systemd1.xml 2025-03-24 18:25:29 +00:00
Busayo Dada 86960038ef test: update to use the new ASSERT_OK() macro and friends 2025-03-24 15:46:13 +00:00
Yu Watanabe dadaad157e man/timedatectl: add reference to systemd.time(7)
Closes #36839.
2025-03-24 12:59:27 +00:00
Luca Boccassi 5aee5bda1a 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.
2025-03-24 12:58:14 +00:00
Yu Watanabe f0cfb6a791 man/networkd.conf: revert unexpected replacement of PersistLeases= setting
The entry was unexpectedly replaced by the commit
418f2dc755 (v256).
This reverts the change.

Fixes #36837.
2025-03-24 11:30:23 +00:00
Daan De Meyer d2c1242c6d 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.
2025-03-24 11:36:16 +01:00
Zbigniew Jędrzejewski-Szmek a9cee8f4de 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.
2025-03-24 10:45:49 +01:00
Zbigniew Jędrzejewski-Szmek ab596e4cde 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
2025-03-24 10:45:49 +01:00
Erik Larsson c88adbc01d networkd: add support for setting vlan_tunnel on bridge ports 2025-03-24 17:15:19 +09:00
Luca Boccassi 2e3efb1884 some dbus property fixes (#36830) 2025-03-22 15:54:16 +00:00
Lennart Poettering ed13622bc8 core: not sure why but TTYRows/TTYColumns property is 16bit towards outside, 32bit inside, handle that properly 2025-03-22 12:51:25 +01:00
Lennart Poettering 0b0cb6f33d core: fix C type handler for ExitCode property 2025-03-22 12:47:48 +01:00
Daan De Meyer fefcb935cd mkosi: Hide patches on debian instead of removing them 2025-03-21 22:36:27 +01:00
Daan De Meyer 07a6e1db06 fetch-distro: Fetch before we switch branches
Otherwise the branch we're switching to might not exist yet.
2025-03-21 21:21:37 +00:00
Daan De Meyer 655b0365e6 packit: Load fmf metadata from rpm spec repository (#36825) 2025-03-21 17:28:43 +01:00
Daan De Meyer 4d938fa865 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.
2025-03-21 16:30:31 +01:00
Daan De Meyer 04b8dd76bd mkosi: update fedora commit reference
* 2ecfbec1a4 Support specifying extra mkosi repositories to the test script
* f5b47b1302 Use old setup sysusers files on Fedora < 43
* 2da5793357 Merge #196 `Migrate fmf metadata and test script from the upstream repository`
* e346d9f33e Limit sdubby dependency to Fedora
2025-03-21 16:30:12 +01:00
Zbigniew Jędrzejewski-Szmek 236ac39b65 shared/watchdog: add MESSAGE_IDs to logs about watchdog opening
One ID for the success case, with WATCHDOG_DEVICE= showing the device,
and one ID for the failure case, with WATCHDOG_DEVICE= if configured,
and ERRNO= set automatically.
2025-03-21 15:55:50 +01:00
Zbigniew Jędrzejewski-Szmek b27c9279f6 shared/watchdog: ratelimit the number of attempts to open watchdog
We need to retry the open attempts for the watchdog, because the device becomes
available asynchronously.

The watchdog is opened in two places:

- in pid1 in the main loop. The loop has a ratelimit, but during a boot we
  iterate in it fairly quickly. On my test VM with 'iTCO_wdt', version 2:

    $ journalctl -b --grep 'Failed to open any watchdog' | wc -l
    3398

  After the device has been processed by udev, it is initialized successfully.

- in shutdown. In that case, we most likely don't need to try more than once,
  because we mostly care about the case where the watchdog device was present
  and configured previously. But in principle it is possible that we might
  attempt shutdown while the machine was initializing, so we don't want to
  disable retries. Nevertheless, watchdog_ping() is called from a loop that
  might be fairly tight, so we could end up trying to reopen the device fairly
  often. This probably doesn't matter *too* much, but it's still ugly to try to
  open the device without any ratelimit.

Usually the watchdog timeout would be set to something like 30 s or a few
minutes. OTOH, on my VM, the device becomes avaiable at 4.35 s after boot. So
let's use 5 s or half the watchdog timeout, whatever is smaller, as the
interval.
2025-03-21 15:55:50 +01:00
Daan De Meyer 3ffcbb6b9a mkosi: Log in mkosi.sync when we don't check out commit 2025-03-21 15:24:04 +01:00
Jose Ortuno f1d8fb3d1d po: Translated using Weblate (Spanish)
Currently translated at 100.0% (257 of 257 strings)

Co-authored-by: Jose Ortuno <jose_ortuno@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/es/
Translation: systemd/main
2025-03-21 13:41:56 +00:00
Daan De Meyer f37df8c563 test: Check that the journal file was actually created (#36821)
If the test fails in the mkosi setup logic the journal file will never
be created so let's add some checks.
2025-03-21 14:31:20 +01:00
Yu Watanabe 90670111a9 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 07f5e35fe7 (v256).
2025-03-21 12:51:39 +00:00
Daan De Meyer 1fda095113 test: Check that the journal file was actually created
If the test fails in the mkosi setup logic the journal file will never
be created so let's add some checks.
2025-03-21 13:34:41 +01:00
Daan De Meyer 02a21805af packit: Remove --depth=1 from git clone
We need the full history to be able to checkout the right commit
afterwards.
2025-03-21 13:34:41 +01:00
Zbigniew Jędrzejewski-Szmek 2c6397d1c2 pid1: log if we failed to find a watchdog device
I think we need to log at some point if the user configured a watchdog device,
but no devices were found. We can't log ENOENT immediately, because the device
may likely appear during boot. So wait until the end of the initial transaction
and log then.
2025-03-21 11:38:43 +01:00
Zbigniew Jędrzejewski-Szmek 0b291130e8 shared/watchdog: raise log levels for watchdog errors
If we failed to open the watchdog device for any reason, we'd only log at debug
level. This seems iffy: if the user configured a timeout for the watchdog, we
should report when we can't set it up. ENOENT is still logged at debug level
only, since it's somewhat expected to have a watchdog timeout set up, even for
systems which don't have a watchdog, or the device might appear later.

If the device doesn't support WDIOC_GETSUPPORT, still log that we opened a
device.

No change in behaviour, except for the log level threshold. As a side effect,
the reason why we failed to open the device is now stored in watchdog_fd
(previously it was -1 always), but this isn't used for anything.
2025-03-21 11:30:26 +01:00
Zbigniew Jędrzejewski-Szmek 839db33687 test-watchdog: modernize 2025-03-21 11:30:26 +01:00
Zbigniew Jędrzejewski-Szmek ab37e9cdb2 core/watchdog: initialize variables only if they'll be used
This is not a hot path, but let's move the variables to the
minimal scope in which they are needed.

Also, all functions which call watchdog_open() check for fd < 0 first,
so change the conditional return into an assert.
2025-03-21 11:30:26 +01:00
Zbigniew Jędrzejewski-Szmek 18284f5a1b core: drop duplicated check in manager_{set,override}_watchdog
Those functions call watchdog_setup() and watchdog_setup_pretimeout(), which
internally do a similar check against the static variables watchdog_timeout and
watchdog_pretimeout. The second check is not useful.
2025-03-21 11:30:26 +01:00
Daan De Meyer 69369fd322 bootctl: adjust feature message (#36372) 2025-03-21 11:17:00 +01:00
Yu Watanabe 513f4d675a analyze: propagate error code returned by _from_string()
Follow-up for a483c39fc2.
Addresses https://github.com/systemd/systemd/pull/36468#discussion_r2005765024.
2025-03-21 10:31:46 +09:00
Yu Watanabe 3cb0551ecb edit-util: don't leave custom editor args around if we shall fall back (#36813)
Also, let's complain loudly if the editor acquired from envvar is not
present.

Fixes #36796
2025-03-21 08:48:05 +09:00
Yu Watanabe 786f60eb5d man: fix typo
Follow-up for 6fd253753c.
2025-03-21 08:35:36 +09:00
Matteo Croce dcde1e903a match glibc in ConditionVersion
Extend ConditionVersion= to allow matching against glibc version,
as proposed in https://github.com/systemd/systemd/pull/36468#issuecomment-2674600909
2025-03-21 06:57:28 +09:00
Jose Ortuno 966f872880 po: Translated using Weblate (Spanish)
Currently translated at 97.2% (250 of 257 strings)

Co-authored-by: Jose Ortuno <jose_ortuno@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/es/
Translation: systemd/main
2025-03-21 06:46:21 +09:00
Mike Yuan 551d4c91e8 core/meson: libcore doesn't depend on PAM
It's only used by sd-executor.
2025-03-20 21:34:31 +00:00
Lennart Poettering 112a9de6c4 Add --root for systemd-update-done and other small fixups (#36803) 2025-03-20 18:19:17 +01:00
Mike Yuan d2e49d9389 edit-util: don't leave custom editor args around if we shall fall back
Also, let's complain loudly if the editor acquired from envvar
is not present.

Fixes #36796
2025-03-20 17:31:54 +01:00