]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 months agoci: extend validatefs testcase to validate verity partitions 37434/head
Lennart Poettering [Wed, 14 May 2025 12:24:51 +0000 (14:24 +0200)] 
ci: extend validatefs testcase to validate verity partitions

5 months agoman: document that gpt-label/gpt-type uuid xattrs are now lists
Lennart Poettering [Wed, 14 May 2025 12:36:09 +0000 (14:36 +0200)] 
man: document that gpt-label/gpt-type uuid xattrs are now lists

5 months agorepart: initialize validatefs xattrs to list *all* verity subordinate partitions
Lennart Poettering [Wed, 14 May 2025 10:35:52 +0000 (12:35 +0200)] 
repart: initialize validatefs xattrs to list *all* verity subordinate partitions

Now that we can actually list multiple gpt labels/type uuids in xattrs,
let's start doing so.

Fixes: #37157
5 months agovalidatefs: properly authenticate all subordinate devices of DM devices
Lennart Poettering [Wed, 14 May 2025 10:18:04 +0000 (12:18 +0200)] 
validatefs: properly authenticate all subordinate devices of DM devices

Previously, we'd only authenticate "one" of the subordinate devices of a
DM device, and which one was somewhat undefined, it would be what we
find in slaves/ first. This is in particular a problem with dm-verity
which generally has two subordinate devices: the data device and the
hash device.

Let's fix this properly. This means two things:

1. iterate through *all* subordinate devices of a DM device (i.e.
   iterate through the sysfs slaves/ subdir), not just
   one

2. permit configuring a list of gpt labels and gpt type uuids in the
   xattrs of mount points, so that all valid combinations can be listed.

This only updates the validation like this. The generation of xattrs
that carry multiple type uuids/labels in systemd-repart will follow in a
later commit.

This extends the syntax of the two gpt-related xattrs, to allow lists of
things. This is a true extension, without breaking compat (but even if
it was, it wouldn't matter given that validatefs was added post v257,
i.e. is not included in a stable release.

Fixes: #37157
5 months agovalidatefs: split out validate_fields_check() into three functions
Lennart Poettering [Wed, 14 May 2025 09:30:52 +0000 (11:30 +0200)] 
validatefs: split out validate_fields_check() into three functions

Just some basic refactoring, no actual code changes

5 months agoavoid race between systemd-logind and systemd-udevd in setting ACLs (#36444)
Lennart Poettering [Wed, 14 May 2025 11:03:46 +0000 (13:03 +0200)] 
avoid race between systemd-logind and systemd-udevd in setting ACLs (#36444)

Follow-up for #36408.
Hopefully fixes #24026, #28512, and/or #23547.

5 months agoAddress post-merge issues in the sysfail entry functionality (#37426)
Lennart Poettering [Wed, 14 May 2025 11:03:13 +0000 (13:03 +0200)] 
Address post-merge issues in the sysfail entry functionality (#37426)

5 months agofork-journal: some follow-ups (#37423)
Lennart Poettering [Wed, 14 May 2025 11:02:46 +0000 (13:02 +0200)] 
fork-journal: some follow-ups (#37423)

5 months agojournald: rename primary object from "Server" to "Manager"
Lennart Poettering [Wed, 14 May 2025 09:00:53 +0000 (11:00 +0200)] 
journald: rename primary object from "Server" to "Manager"

In all our daemons the primary entrypoint object is called "Manager".
But so far there was one exception: in journald it was called "Server".
Let's normalize that, and stick to the same nomenclature everywhere, to
make journald less special.

No real code change, just some search&replace.

5 months agoupdate TODO
Lennart Poettering [Wed, 14 May 2025 07:36:15 +0000 (09:36 +0200)] 
update TODO

5 months agoman: run update-man-rules 37426/head
Igor Opaniuk [Wed, 14 May 2025 07:10:52 +0000 (09:10 +0200)] 
man: run update-man-rules

Re-generate meson rules (as systemd-boot-clear-sysfail.service.xml
man page was added).

Fixes: https://github.com/systemd/systemd/issues/37415
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agounits: fix systemd-boot-clear-sysfail description
Igor Opaniuk [Wed, 14 May 2025 07:10:06 +0000 (09:10 +0200)] 
units: fix systemd-boot-clear-sysfail description

Fix 's/systemd-boot-random-seed/systemd-boot-clear-sysfail/g'
copypaste.

Fixes: https://github.com/systemd/systemd/issues/37415
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agoman: fix systemd-boot-clear-sysfail description
Igor Opaniuk [Wed, 14 May 2025 07:06:54 +0000 (09:06 +0200)] 
man: fix systemd-boot-clear-sysfail description

Fix s/systemd-boot-random-seed/systemd-boot-clear-sysfail/g
copypaste.

Fixes: https://github.com/systemd/systemd/issues/37415
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agoUpdate description and uid checks when invoking pager (#37419)
Mike Yuan [Wed, 14 May 2025 01:01:41 +0000 (03:01 +0200)] 
Update description and uid checks when invoking pager (#37419)

5 months agofork-journal: drop unneeded cast 37423/head
Mike Yuan [Tue, 13 May 2025 21:07:17 +0000 (23:07 +0200)] 
fork-journal: drop unneeded cast

5 months agofork-journal: use char* const* for strv input param
Mike Yuan [Tue, 13 May 2025 20:58:02 +0000 (22:58 +0200)] 
fork-journal: use char* const* for strv input param

This is compatible with char** and is what I originally
asked for in
https://github.com/systemd/systemd/pull/36858#discussion_r2086792739
Someone needs to read better ;-)

5 months agojournalctl-show: report VARLINKERROR=
Mike Yuan [Tue, 13 May 2025 20:56:02 +0000 (22:56 +0200)] 
journalctl-show: report VARLINKERROR=

Who knows, maybe one day we'd support spawning journalctl
as varlink socket-activatable service, where this bit of
info would help.

5 months agojournalctl-show: check Context.has_cursor rather than arg_*
Mike Yuan [Tue, 13 May 2025 20:55:15 +0000 (22:55 +0200)] 
journalctl-show: check Context.has_cursor rather than arg_*

5 months agojournal: do not clear individual fields if the struct won't be reused
Mike Yuan [Tue, 13 May 2025 20:54:10 +0000 (22:54 +0200)] 
journal: do not clear individual fields if the struct won't be reused

Especially that only some of the fields are cleared currently.

5 months agosystemctl: make systemctl clean --what= values more discoverable (#37418)
Yu Watanabe [Tue, 13 May 2025 17:16:47 +0000 (02:16 +0900)] 
systemctl: make systemctl clean --what= values more discoverable (#37418)

5 months agoacl-util: make acl_find_uid() static 36444/head
Yu Watanabe [Thu, 27 Feb 2025 02:07:17 +0000 (11:07 +0900)] 
acl-util: make acl_find_uid() static

5 months agoudev: move devnoce_acl() to udev-builtin-uaccess.c
Yu Watanabe [Thu, 27 Feb 2025 01:45:13 +0000 (10:45 +0900)] 
udev: move devnoce_acl() to udev-builtin-uaccess.c

As it is now only used by udev-builtin-uaccess.c.

This also makes devnode_acl() use fd rather than path to device node.

5 months agologin,udev: avoid race between systemd-logind and systemd-udevd in setting ACLs
Yu Watanabe [Tue, 13 May 2025 14:02:13 +0000 (23:02 +0900)] 
login,udev: avoid race between systemd-logind and systemd-udevd in setting ACLs

Previously, both udevd and logind modifies ACLs of a device node. Hence,
there exists a race something like the following:
1. udevd reads an old state file,
2. logind updates the state file, and apply new ACLs,
3. udevd applies ACLs based on the old state file.

This makes logind not update ACLs but trigger uevents for relevant
devices to make ACLs updated by udevd.

5 months agologin: do not call manager_process_seat_device() more than once per event
Yu Watanabe [Tue, 13 May 2025 14:50:22 +0000 (23:50 +0900)] 
login: do not call manager_process_seat_device() more than once per event

When udevd broadcasts an event for e.g. a graphics device with master-of-seat
tag, then previously manager_process_seat_device() was called twice for
the event.

With this commit, the function is called only once even for an event for
such device.

5 months agologin: use FOREACH_STRING() at one more place
Yu Watanabe [Tue, 13 May 2025 15:21:41 +0000 (00:21 +0900)] 
login: use FOREACH_STRING() at one more place

5 months agodevice-util: introduce device_get_seat() helper function
Yu Watanabe [Tue, 13 May 2025 14:39:09 +0000 (23:39 +0900)] 
device-util: introduce device_get_seat() helper function

5 months agodevice-util: introduce several more helper functions
Yu Watanabe [Thu, 27 Feb 2025 04:19:03 +0000 (13:19 +0900)] 
device-util: introduce several more helper functions

This also makes device_in_subsystem() and device_is_devtype() return
negative error on critical error

5 months agobacklight: replace recursion with for loop
Yu Watanabe [Tue, 13 May 2025 15:02:07 +0000 (00:02 +0900)] 
backlight: replace recursion with for loop

5 months agobacklight: use device_get_sysattr_unsigned() at one more place
Yu Watanabe [Tue, 13 May 2025 14:59:50 +0000 (23:59 +0900)] 
backlight: use device_get_sysattr_unsigned() at one more place

5 months agoPrepare for reducing transitive includes in tests.h (#37414)
Daan De Meyer [Tue, 13 May 2025 17:02:12 +0000 (19:02 +0200)] 
Prepare for reducing transitive includes in tests.h (#37414)

5 months agopager: also check for $SUDO_UID 37419/head
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.

5 months agosystemctl: add "systemctl start -v" mode, which shows unit's logs while starting...
Lennart Poettering [Tue, 13 May 2025 16:03:16 +0000 (18:03 +0200)] 
systemctl: add "systemctl start -v" mode, which shows unit's logs while starting the unit (#36858)

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

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

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

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

5 months agohwdb: add bladeRF SDR devices (#37413)
Yu Watanabe [Tue, 13 May 2025 14:44:29 +0000 (23:44 +0900)] 
hwdb: add bladeRF SDR devices (#37413)

5 months agobash: add shell completion 36858/head
Lennart Poettering [Tue, 13 May 2025 10:34:25 +0000 (12:34 +0200)] 
bash: add shell completion

No idea what I am doing, but this might be enough.

5 months agoupdate TODO
Lennart Poettering [Mon, 24 Mar 2025 10:53:39 +0000 (06:53 -0400)] 
update TODO

5 months agocompress: deal with zstd decoder issues gracefully
Lennart Poettering [Thu, 3 Apr 2025 15:28:11 +0000 (17:28 +0200)] 
compress: deal with zstd decoder issues gracefully

If zstd frames are corrupted the initial size returned for the current
frame might be wrong. Don#t assert() on that, but handle it gracefully,
as EBADMSG

5 months agologs-show: use memory_startswith() rather than startswith()
Lennart Poettering [Thu, 3 Apr 2025 13:00:54 +0000 (15:00 +0200)] 
logs-show: use memory_startswith() rather than startswith()

Let's be strict here: this data is conceptually not NUL terminated,
hence use memory_startswith() rather than startswith() (which implies
NUL termination). All other similar cases in logs-show.c got this right.
Fix the remaining three, too.

5 months agologs-show: handle bad messages like EOF
Lennart Poettering [Thu, 3 Apr 2025 13:02:22 +0000 (15:02 +0200)] 
logs-show: handle bad messages like EOF

Similar to the previous commit, but for logs-show.c

5 months agologs-show: drop unused function parameter
Lennart Poettering [Thu, 3 Apr 2025 14:19:12 +0000 (16:19 +0200)] 
logs-show: drop unused function parameter

5 months agojournal-upload-journal: handle partially written fields gracefully
Lennart Poettering [Thu, 3 Apr 2025 12:59:13 +0000 (14:59 +0200)] 
journal-upload-journal: handle partially written fields gracefully

With the more efficient sync semantics it's more likely that
journal-upload-journal will try to read a partially written message.
Previously we'd fail then. Let's instead treat this gracefully,
expecting that this is either the end or will be fixed shortly (and
we'll get notified via inotify about it and recheck).

5 months agojournal-upload-journal: reduce indentation a bit
Lennart Poettering [Thu, 3 Apr 2025 13:03:07 +0000 (15:03 +0200)] 
journal-upload-journal: reduce indentation a bit

5 months agojournal-remote: destroy event sources before MHD context
Lennart Poettering [Thu, 3 Apr 2025 12:57:23 +0000 (14:57 +0200)] 
journal-remote: destroy event sources before MHD context

The MHD context owns the fd we watch via our event source, hence when we
destroy the context before the event source the event source might still
reference the fd that is now invalid. Hence swap the order.

5 months agotest: add test for "systemd-run -v"
Lennart Poettering [Thu, 27 Mar 2025 23:51:08 +0000 (19:51 -0400)] 
test: add test for "systemd-run -v"

5 months agorun: rework final status output to be based on format-table.h APIs
Lennart Poettering [Thu, 27 Mar 2025 23:08:55 +0000 (19:08 -0400)] 
run: rework final status output to be based on format-table.h APIs

5 months agorun: split out result display code into separate helper call
Lennart Poettering [Thu, 27 Mar 2025 22:37:48 +0000 (18:37 -0400)] 
run: split out result display code into separate helper call

5 months agojournald: make journal Varlink IPC accessible to unpriv clients
Lennart Poettering [Wed, 26 Mar 2025 16:35:43 +0000 (12:35 -0400)] 
journald: make journal Varlink IPC accessible to unpriv clients

The Synchronize() function is just too useful for clients, so that we
can make "systemd-run -v --user" actually useful. Hence let's make the
socket accessible without privs. Deny most method calls however, except
for the Synchronize() call.

5 months agojournalctl: make Synchronize() call more lighweight, by not asking for offlining
Lennart Poettering [Wed, 26 Mar 2025 15:29:14 +0000 (11:29 -0400)] 
journalctl: make Synchronize() call more lighweight, by not asking for offlining

5 months agojournald: rework the Synchronize() varlink logic
Lennart Poettering [Tue, 25 Mar 2025 20:46:18 +0000 (16:46 -0400)] 
journald: rework the Synchronize() varlink logic

Previously, if the Synchronize() varlink call is issued we'd wait for
journald to become idle before returning success. That is problematic
however: on a busy system journald might never become idle. Hence, let's
beef up the logic to ensure that we do not wait longer than necessary:
i.e. we make sure we process any data enqueued before the sync request
was submitted, but not more.

Implementing this isn't trivial unfortunately. To deal with this
reasonably, we need to determine somehow for incoming log messages
whether they are from before or after the point in time where the sync
requested was received.

For AF_UNIX/SOCK_DGRAM we can use SO_TIMESTAMP to directly compare
timestamps of incoming messages with the timestamp of the sync request
(unfortunately only CLOCK_REALTIME).

For AF_UNIX/SOCK_STREAM we can call SIOCINQ at the moment we initiate
the sync, and then continue processing incoming traffic, counting down
the bytes until the SIOCINQ returned bytes have been processed. All
further data must have been enqueued later hence.

With those two mechanisms in place we can relatively reliably
synchronize the journal.

This also adds a boolean argument "offline" to the Synchronize() call,
which controls whether to offline the journal after processing the
pending messages. it defaults to true, for compat with the status quo
ante. But for most cases the offlining is probably not necessary, and is
cheaper to do without, hence allow not to do it.

5 months agojournald: downgrade event source priority of kmsg to same as native/syslog inputs
Lennart Poettering [Wed, 23 Apr 2025 09:26:58 +0000 (11:26 +0200)] 
journald: downgrade event source priority of kmsg to same as native/syslog inputs

So far we schduled kmsg events at higher priority than native/syslog
ones. But that's quite problematic, since it means that kmsg events can
drown out native/syslog log events. And this actually shows up in some
CI tests.

Address that, and schedule all three sources at the same priority, so
that the earlier event always is processed first, regarding which
protocol is used.

5 months agosystemctl: add --verbose mode
Lennart Poettering [Sun, 23 Mar 2025 22:38:06 +0000 (18:38 -0400)] 
systemctl: add --verbose mode

5 months agorun: add --verbose mode
Lennart Poettering [Sun, 23 Mar 2025 22:37:45 +0000 (18:37 -0400)] 
run: add --verbose mode

5 months agojournalctl: optionally delay --follow exit for a journal synchronization
Lennart Poettering [Tue, 25 Mar 2025 12:01:50 +0000 (08:01 -0400)] 
journalctl: optionally delay --follow exit for a journal synchronization

Let's optionally issue a Varlink Synchronize() call in --follow mode
when asked to terminate. This is useful so that the tool can be called
and it is guaranteed it processed all messages generated before the
request to exit before it exits.

We want this in "systemd-run -v" in particular, so that we can be sure
we are not missing any log output from the invoked service before it
exits

5 months agojournalctl: make arg_image_policy non-static, just like all other arg_xyz variables
Lennart Poettering [Mon, 24 Mar 2025 16:29:24 +0000 (12:29 -0400)] 
journalctl: make arg_image_policy non-static, just like all other arg_xyz variables

Some refactoring to normalize behaviour here, and make arg_image_policy
less special for no reason.

5 months agofork-journal: add helpers for spawning off journalctl from 'systemctl start' or ...
Lennart Poettering [Sun, 23 Mar 2025 22:39:03 +0000 (18:39 -0400)] 
fork-journal: add helpers for spawning off journalctl from 'systemctl start' or 'systemd-run'

This is modelled after the polkit or askpw agents, but simply invokes
journalctl for the specified unit name, to show logs.

5 months agohwdb: append ID_SOFTWARE_RADIO to hwdb parser 37413/head
Ryan Thompson [Tue, 13 May 2025 00:37:16 +0000 (19:37 -0500)] 
hwdb: append ID_SOFTWARE_RADIO to hwdb parser

5 months agohwdb: add bladeRF SDR devices
Ryan Thompson [Mon, 12 May 2025 23:05:20 +0000 (18:05 -0500)] 
hwdb: add bladeRF SDR devices

Add hwdb entries for bladeRF 1.x, legacy 1.x, and 2.0 micro devices to
enable non-root access through preexisting ID_SOFTWARE_RADIO tag.

References #20561

5 months agojournalctl: send READY=1
Lennart Poettering [Mon, 24 Mar 2025 10:53:32 +0000 (06:53 -0400)] 
journalctl: send READY=1

Allow callers to synchronize on the point in time where the journal file
watches are fully established, in --follow mode.

Tools can invoke journalctl using this, knowing that any log message
happening after the READY=1 is definitely going to be processed by the
journalctl invocation.

5 months agojournalctl: if there's not a single matching log entry, seek to head
Lennart Poettering [Mon, 24 Mar 2025 10:52:53 +0000 (06:52 -0400)] 
journalctl: if there's not a single matching log entry, seek to head

5 months agotest: add sync request until all logging about the test unit is done
Lennart Poettering [Tue, 8 Apr 2025 16:35:35 +0000 (18:35 +0200)] 
test: add sync request until all logging about the test unit is done

5 months agojournald: use log_warning_errno() where appropriate
Lennart Poettering [Tue, 8 Apr 2025 12:35:52 +0000 (14:35 +0200)] 
journald: use log_warning_errno() where appropriate

5 months agosocket-util: add af_unix_get_qlen() helper to determine number of queued connections...
Lennart Poettering [Tue, 8 Apr 2025 10:18:35 +0000 (12:18 +0200)] 
socket-util: add af_unix_get_qlen() helper to determine number of queued connections on AF_UNIX listener socket

5 months agosd-netlink: add minimal support for sock_diag netlink sockets
Lennart Poettering [Tue, 8 Apr 2025 10:16:39 +0000 (12:16 +0200)] 
sd-netlink: add minimal support for sock_diag netlink sockets

This is just enough of the type info to determine AF_UNIX queue lengths
information.

5 months agosd-netlink: allow configuration of flags parameter when creating message object
Lennart Poettering [Tue, 8 Apr 2025 10:13:12 +0000 (12:13 +0200)] 
sd-netlink: allow configuration of flags parameter when creating message object

We soon want to add for sock_diag(7) netlink sockets. Those reuse the
same message type codes for request and response but with different
message formats. Hence we need to look at NLM_F_REQUEST to determine
which message policy to apply. Hence it is essential to know the flags
parameters right away when creating a message, since we cannot do early
validation otherwise.

This only adds support for setting the flags value right at the moment
of creation of the message object, it does not otherwise add
sock_diag(7) support, that is added in a later message.

This also corrects the flag for synthetic NLMSG_ERROR messages which
should not have the NLM_F_REQUEST flag set (since they are responses,
not requests).

5 months agosocket-util: make return parameter to socket_autobind() optional
Lennart Poettering [Tue, 8 Apr 2025 10:11:33 +0000 (12:11 +0200)] 
socket-util: make return parameter to socket_autobind() optional

5 months agonotify-recv: optionally return event source from notify_socket_prepare()
Lennart Poettering [Tue, 13 May 2025 08:00:22 +0000 (10:00 +0200)] 
notify-recv: optionally return event source from notify_socket_prepare()

5 months agomeson: Add missing conditions
Daan De Meyer [Tue, 13 May 2025 11:47:13 +0000 (13:47 +0200)] 
meson: Add missing conditions

Follow up for 6350d2dbd97746440b9c8303ddc140ffda568732

5 months agotests.h: Get rid of TEST_REQ_RUNNING_SYSTEMD() 37414/head
Daan De Meyer [Sun, 11 May 2025 19:21:48 +0000 (21:21 +0200)] 
tests.h: Get rid of TEST_REQ_RUNNING_SYSTEMD()

This only has a single user, let's just inline it and get rid of
the macro.

5 months agotests.h: Move some implementation details into tests.c.
Daan De Meyer [Sun, 11 May 2025 19:21:30 +0000 (21:21 +0200)] 
tests.h: Move some implementation details into tests.c.

5 months agocore: introduce io.systemd.Manager.Describe method (#35098)
Daan De Meyer [Tue, 13 May 2025 09:57:58 +0000 (11:57 +0200)] 
core: introduce io.systemd.Manager.Describe method (#35098)

Let's extend pid1's varlink interface and add a Describe method to get
the global Manager object information as a JSON object
(io.systemd.Manager.Describe).

Because the new varlink interface should be available on both the user
managers and the system manager, we also make the necessary changes to
expose a varlink server on user managers.

This PR is first part of https://github.com/systemd/systemd/pull/33965
with minimal changes to address feedback.

Fixes: #22654
5 months agosd-boot: add support for a sysfail entry (#34856)
Lennart Poettering [Tue, 13 May 2025 09:23:26 +0000 (11:23 +0200)] 
sd-boot: add support for a sysfail entry (#34856)

Add support for a sysfail boot entry. Sysfail boot entries can be used
for optional tweaking the automatic selection order in case a failure
state of the system in some form is detected (boot firmware failure
etc).

The EFI variable `LoaderEntrySysFail` contains the sysfail boot loader
entry to use. It can be set using bootctl:
```
$ bootctl set-sysfail sysfail.conf
```

The `LoaderEntrySysFail` EFI variable would be unset automatically
during next boot by `systemd-boot-clear-sysfail.service` if no system
failure occured, otherwise it would be kept as it is and a system
failure reason will be saved to `LoaderSysFailReason` EFI variable.

`sysfail_check()` expected to be extented to support possibleconditions
when we should boot sysfail("recovery") boot entry.

Also add support for using a sysfail boot entry in case of UEFI firmware
capsule update failure [1]. The status of a firmware update is obtained
from the EFI System Resource Table (ESRT), which provides an optional
mechanism for identifying device and system firmware resources for the
purposes of targeting firmware updates to those resources.

Current implementation uses the value of LastAttemptStatus field from
ESRT, which describes the result of the last firmware update attempt for
the firmware resource entry. The field is updated each time an
`UpdateCapsule()` is attempted for an ESRT entry and is preserved across
reboots (non-volatile).

This can be be used in setups with support for A/B OTA updates, where
the boot firmware and Linux/RootFS might be updated synchronously.

The check is activated by adding "sysfail-firmware-upd" to loader.conf

[1]
https://uefi.org/specs/UEFI/2.10/23_Firmware_Update_and_Reporting.html

5 months agotests: tests for io.systemd.manager.Describe 35098/head
Ivan Kruglov [Thu, 6 Mar 2025 16:38:37 +0000 (08:38 -0800)] 
tests: tests for io.systemd.manager.Describe

5 months agocore: introduce io.systemd.Manager.Describe method
Ivan Kruglov [Thu, 6 Mar 2025 16:40:49 +0000 (08:40 -0800)] 
core: introduce io.systemd.Manager.Describe method

Let's extend pid1's varlink interface and add a Describe method to
get the global Manager object information as a JSON object
(io.systemd.Manager.Describe).

Because the new varlink interface should be available on both the
user managers and the system manager, we also make the necessary
changes to expose a varlink server on user managers.

5 months agoshared: watchdog_get_last_ping_as_dual_timestamp()
Ivan Kruglov [Fri, 7 Mar 2025 09:04:14 +0000 (01:04 -0800)] 
shared: watchdog_get_last_ping_as_dual_timestamp()

5 months agoshared: varlink_server_contains_socket()
Ivan Kruglov [Mon, 12 May 2025 11:18:00 +0000 (04:18 -0700)] 
shared: varlink_server_contains_socket()

5 months agosocket-util: socket_address_equal_unix()
Ivan Kruglov [Mon, 12 May 2025 11:17:38 +0000 (04:17 -0700)] 
socket-util: socket_address_equal_unix()

5 months agocore: common rlimits code and structures
Ivan Kruglov [Thu, 6 Mar 2025 16:37:10 +0000 (08:37 -0800)] 
core: common rlimits code and structures

5 months agolog: log_get_target_max_level()
Ivan Kruglov [Tue, 12 Nov 2024 12:46:20 +0000 (13:46 +0100)] 
log: log_get_target_max_level()

5 months agomeson: introduce PROJECT_VERSION_STR and use it in udev
Ivan Kruglov [Tue, 12 Nov 2024 12:53:13 +0000 (13:53 +0100)] 
meson: introduce PROJECT_VERSION_STR and use it in udev

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>
5 months agoAdd dns0.eu in resolved.conf.in (#37404)
André Monteiro [Mon, 12 May 2025 23:36:22 +0000 (00:36 +0100)] 
Add dns0.eu in resolved.conf.in (#37404)

Add dns0.eu as a dns option in resolved.conf.in
This also adds Quad9 DNS servers as the default fallback servers.

5 months agorun0: drop -a short switch for --area=
Mike Yuan [Mon, 12 May 2025 19:47:01 +0000 (21:47 +0200)] 
run0: drop -a short switch for --area=

Follow-up for f44e7a8c11833563d558c208c76cdcc0df7de022

This breaks the rule stated at the beginning of help_sudo_mode():

> NB: Let's not go overboard with short options: we try to keep a modicum of compatibility with
> sudo's short switches, hence please do not introduce new short switches unless they have a roughly
> equivalent purpose on sudo. Use long options for everything private to run0.

5 months agocore: assorted cleanups (#37410)
Yu Watanabe [Mon, 12 May 2025 23:32:20 +0000 (08:32 +0900)] 
core: assorted cleanups (#37410)

5 months agocore/dbus-unit: remove unneeded else if 37410/head
Mike Yuan [Thu, 17 Apr 2025 15:33:50 +0000 (17:33 +0200)] 
core/dbus-unit: remove unneeded else if

5 months agocore/dbus-execute: always normalize argv[0] to "sh" on EXEC_COMMAND_VIA_SHELL
Mike Yuan [Mon, 12 May 2025 15:07:47 +0000 (17:07 +0200)] 
core/dbus-execute: always normalize argv[0] to "sh" on EXEC_COMMAND_VIA_SHELL

Addresses https://github.com/systemd/systemd/pull/37071#discussion_r2084851759

5 months agocore/slice: remove redundant assertion
Mike Yuan [Tue, 22 Apr 2025 19:01:41 +0000 (21:01 +0200)] 
core/slice: remove redundant assertion

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()

5 months agocore: accept "|" ExecStart= prefix to spawn target user's shell; teach run0 about...
Mike Yuan [Mon, 12 May 2025 14:10:03 +0000 (16:10 +0200)] 
core: accept "|" ExecStart= prefix to spawn target user's shell; teach run0 about the new logic (#37071)

I've always been reluctant to invoke the current user's shell in another
user's context, hence was fully grounded in `sudo -i`. With this bit in
place `run0` will finally be feature-complete on my side ;-)

5 months agomeson: Various improvements (#37395)
Yu Watanabe [Mon, 12 May 2025 14:06:57 +0000 (23:06 +0900)] 
meson: Various improvements (#37395)

5 months agocore/namespace: fix issue in PrivateTmp=disconnected vs var.mount (#37271)
Yu Watanabe [Mon, 12 May 2025 14:05:24 +0000 (23:05 +0900)] 
core/namespace: fix issue in PrivateTmp=disconnected vs var.mount (#37271)

Fixes #37258.
Replaces #37259.

5 months agoudev: sort received events by their seqnum (#37314)
Yu Watanabe [Mon, 12 May 2025 14:04:49 +0000 (23:04 +0900)] 
udev: sort received events by their seqnum (#37314)

The kernel sometimes sends uevents in a random order, so previously the
received events were not sorted by their seqnum. We determine which
event is ready for processing by using the assumption that queued events
are sorted by their seqnum. Let's sort the received events before queue
them, to make events processed in a correct ordering.

5 months agosd-boot: use sysfail entry for UEFI firmware update failure 34856/head
Igor Opaniuk [Thu, 23 Jan 2025 12:31:04 +0000 (13:31 +0100)] 
sd-boot: use sysfail entry for UEFI firmware update failure

Add support for using a sysfail boot entry in case of UEFI firmware
capsule update failure [1]. The status of a firmware update is obtained from
the EFI System Resource Table (ESRT), which provides an optional mechanism
for identifying device and system firmware resources for the purposes of
targeting firmware updates to those resources.

Current implementation uses the value of LastAttemptStatus field from
ESRT, which describes the result of the last firmware update attempt for
the firmware resource entry. The field is updated each time an
UpdateCapsule() is attempted for an ESRT entry and is preserved across
reboots (non-volatile).

This can be be used in setups with support for A/B OTA updates, where
the boot firmware and Linux/RootFS might be updated synchronously.

[1] https://uefi.org/specs/UEFI/2.10/23_Firmware_Update_and_Reporting.html
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agobootctl: configure a sysfail entry
Igor Opaniuk [Mon, 24 Mar 2025 14:33:16 +0000 (15:33 +0100)] 
bootctl: configure a sysfail entry

You can configure the sysfail boot entry using the bootctl command:
$ bootctl set-sysfail sysfail.conf

The value will be stored in the `LoaderEntrySysFail` EFI variable.

The `LoaderEntrySysFail` EFI variable would be unset automatically
during next boot by `systemd-boot-clear-sysfail.service` if no
system failure occured, otherwise it would be kept as it is and a system
failure reason will be saved to `LoaderSysFailReason` EFI variable.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agosd-boot: add support for a sysfail entry
Igor Opaniuk [Mon, 24 Mar 2025 14:30:49 +0000 (15:30 +0100)] 
sd-boot: add support for a sysfail entry

Add support for a sysfail boot entry. Sysfail boot entries can be
used for optional tweaking the automatic selection order in case a
failure state of the system in some form is detected (boot firmware
failure etc).

The EFI variable `LoaderEntrySysFail` holds the boot loader entry to
be used in the event of a system failure. If a failure occurs, the reason
will be stored in the `LoaderSysFailReason` EFI variable.

sysfail_check() expected to be extented to support possible
conditions when we should boot sysfail("recovery") boot entry.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agobless-boot: some fixes (#37375)
Lennart Poettering [Mon, 12 May 2025 13:11:06 +0000 (15:11 +0200)] 
bless-boot: some fixes (#37375)

This mostly makes sure we do something reasonable when our tool is
called from a boot of an entry that was already marked as definitely
"bad" on a previous boot. Such an entry we can return into a "good"
state, but we cannot return it into an "indeterminate" state, because
the status quo ante is already known.

Fixes: #37350
5 months agomeson: Don't create static library target unless option is enabled 37395/head
Daan De Meyer [Sat, 10 May 2025 20:19:22 +0000 (22:19 +0200)] 
meson: Don't create static library target unless option is enabled

While we don't build these by default, all the source files still
get added to the compile_commands.json file by meson, which can confuse
tools as they might end up analyzing the source files twice or analyzing
the wrong one.

To avoid this issue, only define the static library target if the
corresponding option is enabled.

5 months agomeson: Remove unneeded include directories
Daan De Meyer [Fri, 9 May 2025 18:48:51 +0000 (20:48 +0200)] 
meson: Remove unneeded include directories

meson by default adds the current source and build directory as include
directories. Because we structure our meson code by gathering a giant dict
of everything we want to do and then doing all the actual target generation
in the top level meson.build, this behavior does not make sense at all because
we end up adding the top level repository directory as an include directory
which is never what we want.

At the same time, let's also make sure the top level directory of the build
directory is not an include directory, by moving the version.h generation
into the src/version subdirectory and then adding the src/version subdirectory
of the build directory as an include directory instead of the top level
repository directory.

Making this change means that language servers such as clangd can't get
confused when they automatically insert an #include line and insert
"#include "src/basic/fs-util.h" instead of "#include "fs-util.h".