Mike Yuan [Tue, 27 May 2025 00:10:07 +0000 (02:10 +0200)]
fs-util: prefer linkat(AT_EMPTY_PATH) over /proc/self/fd/ shenanigans
The permission check got relaxed in kernel v6.10, so let's
switch the fallback order around.
This also effectively reverts 94d94f0c0a7d28816c815dc9770cc659769fe980,
as I just realized that link_fd() involves multiple paths and
we can't tell which one tripped ENOENT...
Mike Yuan [Mon, 26 May 2025 20:32:12 +0000 (22:32 +0200)]
cgroup-util: remove now unused cg_read_event()
cg_get_keyed_attribute() is a more generic version of this,
and cg_is_empty_recursive() was the only user of this function,
which got converted in the previous commit.
Mike Yuan [Mon, 26 May 2025 20:27:26 +0000 (22:27 +0200)]
cgroup-util: drop handcrafted cg_is_empty(), always check cgroup.events populated field
This effectively renames cg_is_empty_recursive() to cg_is_empty().
Note that all existing code calls the former and not the latter,
hence with cgv1 support being dropped it's trivial to consult
cgroup.events directly for populated state everywhere.
Additionally, use more generic cg_get_keyed_attribute() helper
rather than cg_read_event().
Dusty Mabe [Fri, 23 May 2025 13:18:12 +0000 (09:18 -0400)]
src/core/manager.c: log preset activity on first boot
This gives us a little more information about what units were enabled
or disabled on that first boot and will be useful for OS developers
tracking down the source of unit state.
An example with this enabled looks like:
```
NET: Registered PF_VSOCK protocol family
systemd[1]: Applying preset policy.
systemd[1]: Unit /etc/systemd/system/dnsmasq.service is masked, ignoring.
systemd[1]: Unit /etc/systemd/system/systemd-repart.service is masked, ignoring.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket'.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir.mount' → '/etc/systemd/system/var-mnt-workdir.mount'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir\x2dtmp.mount' → '/etc/systemd/system/var-mnt-workdir\x2dtmp.mount'.
systemd[1]: Created symlink '/etc/systemd/system/afterburn-sshkeys.target.requires/afterburn-sshkeys@core.service' → '/usr/lib/systemd/system/afterburn-sshkeys@.service'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket' → '/usr/lib/systemd/system/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket' → '/usr/lib/systemd/system/systemd-resolved-monitor.socket'.
systemd[1]: Populated /etc with preset unit settings.
```
Considering it only happens on first boot and not on every boot I think
the extra information is worth the extra verbosity in the logs just for
that boot.
Daan De Meyer [Mon, 26 May 2025 14:11:06 +0000 (16:11 +0200)]
tree-wide: Handle EINVAL as not supported for chattr_xxx()
F2FS returns EINVAL from FS_IOC_SETFLAGS when trying to set
FS_NOCOW_FL. Let's handle this by treating EINVAL as not supported.
While we're at it, make sure we use ERRNO_IS_IOCTL_NOT_SUPPORTED()
across the tree instead of ERRNO_IS_NOT_SUPPORTED() when calling any
of the chattr_xxx() functions.
Daan De Meyer [Fri, 23 May 2025 11:54:46 +0000 (13:54 +0200)]
clangd: Enable UnusedIncludes feature again
Now that the entire free doesn't trigger any clang unused include
violations anymore, let's re-enable the clangd option as it's much
more useful now that the tree is clean.
Daan De Meyer [Fri, 23 May 2025 11:03:57 +0000 (13:03 +0200)]
clang-tidy: Skip public headers
We're very limited in our ability to change these due to backwards
compat, so let's skip them from analysis since we won't be able to
fix the errors anyway.
Daan De Meyer [Thu, 22 May 2025 09:27:45 +0000 (11:27 +0200)]
libsystemd: Clean up includes
For libsystemd's headers, the changes made depend on whether the
header is installed or not. For installed headers, the only change
made is that commonly included headers were moved to _sd-common.h.
For these headers, there should be no noticeable change in behavior
when including them. For non-installed headers, includes were replaced
with forward declarations where possible as usual.
Mike Yuan [Fri, 23 May 2025 15:46:26 +0000 (17:46 +0200)]
core: renames in io.systemd.Manager (#37582)
1. rename sources to follow `core/varlink-*` patter per @YHNdnzj's
comment in
https://github.com/systemd/systemd/pull/35098#issuecomment-2876509919
2. camelCase Context/Runtime in varlink spec. Varlink fields are
camelCase unless well defined config names.
Yu Watanabe [Fri, 23 May 2025 14:17:01 +0000 (23:17 +0900)]
hostname: add hardware family, sku and version (#36956)
Add support for the hardware family, SKU (Stock-Keeping Unit) and
version. The values are read from the file /etc/machine-info or DMI as
fallback.
The entries are useful to provide an unified interface to collect detail
hardware information. The /etc/machine-info entries enable embedded
devices without UEFI support to provide the information via a common
interface.
per Daan's explanation:
other subtests running as testuser apparently use systemd-run --user
--machine testuser@.host which turns user tracking in logind into "by
pin" mode. when the last pinning session exits it terminates the user.
Luca Boccassi [Wed, 21 May 2025 23:56:18 +0000 (00:56 +0100)]
Revert "logind: always enclose list fields (that may contain spaces) in quotes"
This breaks GNOME on Wayland, login no longer works:
gnome-shell[2250]: Running GNOME Shell (using mutter 48.2) as a Wayland display server
gnome-shell[2250]: Failed to setup: Failed to find any matching session
systemd[2054]: org.gnome.Shell@wayland.service: Failed with result 'protocol'.
systemd[2054]: Failed to start org.gnome.Shell@wayland.service - GNOME Shell on Wayland.
Matteo Croce [Thu, 22 May 2025 03:41:49 +0000 (05:41 +0200)]
networkd: print a meaningful error on failure
test_keep_configuration_on_restart() works, but the error printed is
misleading because self.assertNotEmpty() doesn't exist.
Add a working assert statement so, when the unmanaged interface is
altered, the test fails with a meaningful error, like:
### ip monitor dev unmanaged0 BEGIN
222:33::/64 proto kernel metric 256 pref medium
FAIL
[...]
Traceback (most recent call last):
File "/work/src/test/test-network/systemd-networkd-tests.py", line 5085, in test_keep_configuration_on_restart
self.assertEqual(line, '')
AssertionError: '222:33::/64 proto kernel metric 256 pref medium' != ''
- 222:33::/64 proto kernel metric 256 pref medium
While at it, strip the trailing newline so we can print easily the
string (and in future build more a robust regexp which uses the $ token)
Add support for the hardware version. The version describes a distinct
version of compatibility hardware. The value is read from the file
/etc/machine-info or DMI as fallback.
The integration provides an unified interface to collect detail hardware
information. The /etc/machine-info entry enables embedded devices
without UEFI support to read the information from a custom store.