]> git.ipfire.org Git - thirdparty/systemd.git/commit
sysext: Skip refresh if no changes are found 39980/head
authorKai Lueke <kailuke@microsoft.com>
Tue, 25 Nov 2025 15:04:43 +0000 (00:04 +0900)
committerKai Lüke <kai@amutable.com>
Tue, 3 Feb 2026 23:05:24 +0000 (00:05 +0100)
commit23115eeaf10ab551b44b7de68b8c23923bcf28e9
treefd31fe70f80da09932ba20c2f59bfc9e7e5ca71a
parent2e4c2f8df781902db47f31ebe48b1e819955edf9
sysext: Skip refresh if no changes are found

When the extensions for the final system are already set up from the
initrd we should avoid disrupting the boot process with the remount
(which currently isn't atomic) and the daemon reload for
systemd-confext and systemd-sysext. Similarly, when sysupdate ran and
updated extensions it's best to avoid the remount and daemon reload if
no changes are found.
To do this, encode the current extension state in more detail than
before where only the names of the extensions where encoded in the
overlay mount. This can also be used to provide more details about the
extension origin in "systemd-sysext status (--json=)". During the
refresh add a check whether the old state matches the new state and in
this case skip the refresh unless the user provides a flag to always
refresh. Besides the extension name and the resolved path the best
method for identification is the verity hash but that is not available
for plain image files or directories. Therefore, also include data to
check for file/directory replacements. The creation/modification times
are not always real on reproducible images or extracted archive content.
The file handle together with the unique mount ID is the next best
identifier we can use when we have no verity hash. Fall back to an inode
when we get no handle. With the creation/modification time and the path
this should be good enough. Using a unique mount ID is important (with
a fallback to the regular non-unique mount ID) instead of st_dev because
st_dev gets reused too easily, e.g., by a loop device mount and the
mount ID helps to catch this. For the mount ID to be valid it has to be
resolved before we enter the new mount namespace. Thus, it gets provided
by the image dissect logic and handed over to the sysext subprocess
which runs in a new mount namespace.
Luckily, we can rule out online modification of directories or image
files because this is anyway not well supported with overlay mounts, so
we don't do a file checksum nor do we recurse into a directory to look
for the most recently touched files.  But, as said, with the
always-refresh flag one can force a reload.
man/systemd-sysext.xml
shell-completion/bash/systemd-sysext
src/basic/mountpoint-util.c
src/basic/mountpoint-util.h
src/include/override/fcntl.h
src/shared/discover-image.c
src/shared/discover-image.h
src/shared/varlink-io.systemd.sysext.c
src/sysext/sysext.c
test/units/TEST-50-DISSECT.sysext.sh