Commit Graph
9053 Commits
Author SHA1 Message Date
Lennart Poettering 3a7ae4ba62 shared: get rid of fileio-label.[ch]
Move the renaming function to reboot-util.h (since it writes out
/run/nologin at shutdown), and let's get rid of fileio-label.[ch] now
that it serves no purpose anymore.
2024-10-22 17:51:26 +02:00
Lennart Poettering 8eeb870971 fileio: port write_string_file() to LabelOps, and thus add WRITE_STRING_FILE_LABEL flag
Given that we have the LabelOps abstraction these days, we can teach
write_string_file() to use it, which means we can get rid of
fileio-label.[ch] as a separate concept.

(The only reason that fileio-label.[ch] exists independently of
fileio.[ch] was that the former linekd to libselinux potentially, and
thus had to be in src/shared/ while the other always was in src/basic/.
But the LabelOps vtable provides us with a nice work-around)
2024-10-22 17:51:26 +02:00
Lennart Poettering d49449c89b label: tweak LabelOps post() hook to take "created" boolean
We have two distinct implementations of the post hook.

1. For SELinux we just reset the selinux label we told the kernel
   earlier to use for new inodes.

2. For SMACK we might apply an xattr to the specified file.

The two calls are quite different: the first call we want to call in all
cases (failure or success), the latter only if we actually managed to
create an inode, in which case it is called on the inode.
2024-10-22 17:51:26 +02:00
Daan De Meyer a95aacc851 Merge pull request #34851 from DaanDeMeyer/medium
bus-util: Return ENOMEDIUM if XDG_RUNTIME_DIR is unset
2024-10-22 13:37:59 +02:00
Daan De Meyer d64a5b30f1 bus-util: Fix bus_log_connect_error() 2024-10-22 12:32:02 +02:00
Daan De Meyer d0316b7a0d bus-util: Special case when DBUS_SESSION_BUS_ADDRESS is set and XDG_RUNTIME_DIR isn't
We noticed some failures because we have code that connects to user
managers by setting DBUS_SESSION_BUS_ADDRESS without setting XDG_RUNTIME_DIR.
If that's the case, connect to the user session bus instead of the
private manager bus as we can't connect to the latter if XDG_RUNTIME_DIR
is not set.
2024-10-22 11:17:40 +02:00
Daan De Meyer c5698fe907 bus-util: Return ENOMEDIUM if XDG_RUNTIME_DIR is unset
bus_log_connect_error() checks for ENOMEDIUM, not ENXIO.
2024-10-22 10:59:27 +02:00
Lennart Poettering 35f51be4f8 Merge pull request #34761 from ikruglov/ikruglov/io-systemd-Machine-GetAddresses
machine: add Addresses, OSRelease, and UIDShift fields in varlink io.systemd.Machine.List output
2024-10-22 09:06:56 +02:00
Lennart Poettering 2d74427a7c Merge pull request #30952 from rpigott/resolved-dnr
RFC9463: Discovery of Network-designated Resolvers
2024-10-22 09:05:36 +02:00
Ronan Pigott ee2108dcd5 resolve: move sd-* api into libsystemd-network
This duplicates the svc param constants for the benefit of the
resolved-core library.
2024-10-21 09:10:20 -07:00
Ronan Pigott 7823f8a784 network: add dnr resolvers to networkctl status json output 2024-10-21 09:10:20 -07:00
Ivan Kruglov 9de215219c machine: use AcquireMetadata in io.systemd.MachineImage.List method 2024-10-21 17:42:37 +02:00
Ivan Kruglov 45755275e5 machine: add Addresses field in varlink io.systemd.Machine.List output
This is equivalent to DBus implementation of GetMachineAddresses.
2024-10-21 17:38:29 +02:00
Ivan Kruglov a94fbcaa35 machine: add OSRelease and UIDShift fields in varlink io.systemd.Machine.List output
This commit adds support of the above mentioned fields. This is equivalent to DBus implementation of:
- GetMachineOSRelease
- GetMachineUIDShift
2024-10-21 17:38:28 +02:00
Lennart Poettering 2ee6fa552e ask-password-api: don't accidentally create a dir, when we don't want one
Previously, we were using touch(), which usually works fine, because the
path should always refer to an existing directory, in which case it just
updates the timestamp. However, if the dir does not exist yet (which
shouldn't happen), it would be created as regular file, which is just
wrong.

Hence, let's instead create the dir as dir if it is missing, and then
update its timestamp.
2024-10-21 14:14:16 +02:00
Lennart Poettering 4dd2748b65 ask-password-api: add support for querying pws from unpriv agents 2024-10-21 14:14:05 +02:00
Lennart Poettering dbdec4b195 ask-password-api: minor modernizations 2024-10-21 14:14:02 +02:00
Lennart Poettering ec572753c3 tty-ask-password-agent: support for watching both system-wide and per-user askpw dir
Fixes: #1232 #2217
2024-10-21 14:13:45 +02:00
Yu Watanabe 12e58ab18d Merge pull request #34820 from poettering/dissect-image-uclean
dissect-image: generate better log message for EUCLEAN dissect error
2024-10-19 02:15:01 +09:00
Lennart Poettering 2186334e00 dissect-image: generate better log message for EUCLEAN dissect error
Fixes: #31799
2024-10-18 14:16:53 +02:00
Lennart Poettering 620a03f669 dissect-image: uppercase first char of dissect error message systematically
Some of the log message stricts used proper uppercasing, others didn't.
Fix that to make it uniform.
2024-10-18 14:16:15 +02:00
Lennart Poettering 2e2826d7d9 resolved: add some more comments to varlink interface
This is by no means complete, but gets us a bit closer.
2024-10-18 19:17:36 +09:00
Lennart Poettering 33dd894546 fdset: optionally, close remaining fds asynchronously 2024-10-17 09:48:05 +02:00
Ryan Wilson 63d4c4271c cgroup: Add ManagedOOMMemoryPressureDurationSec= override setting for units
This will allow units (scopes/slices/services) to override the default
systemd-oomd setting DefaultMemoryPressureDurationSec=.

The semantics of ManagedOOMMemoryPressureDurationSec= are:
- If >= 1 second, overrides DefaultMemoryPressureDurationSec= from oomd.conf
- If is empty, uses DefaultMemoryPressureDurationSec= from oomd.conf
- Ignored if ManagedOOMMemoryPressure= is not "kill"
- Disallowed if < 1 second

Note the corresponding dbus property is DefaultMemoryPressureDurationUSec
which is in microseconds. This is consistent with other time-based
dbus properties.
2024-10-16 20:12:38 -07:00
Daan De Meyer 04f0a17e92 mount-util: Make get_submounts() a public function 2024-10-16 11:37:57 +01:00
Lennart Poettering 5048a6bd65 dropin: use WRITE_STRING_FILE_MKDIR_0755 to create drop-in prefix path 2024-10-15 18:21:00 +02:00
Lennart Poettering db21bf5ae9 shared: modernize drop_in_file() a bit
Make the return parameters optional, since we don't actually need them
in all cases (see later commits).
2024-10-15 18:20:57 +02:00
Lennart Poettering 8a0adc973a fileio: clean up write_string_file() naming
let's rename the "_ts" flavour of these calls "_full" instead, exposing
the full functionality. And then keep two more minimal versions around:
one "_at" (which has the ts parameter suppressed, but keeps the dir_fd
one). And one without suffix (which supresses both).

Do the same for the label versions of these calls.
2024-10-15 18:20:27 +02:00
Lennart Poettering 69cc4ee134 userdb: return ESRCH if userdb service refuses a user/group name as invalid
if a userdb service refuse a user/group name as invalid, let's turn this
into ESRCH client-side following that there definitely is no user/group
record for a completely invalid user/group name.

Replaces: #34558
2024-10-15 14:15:21 +02:00
Yu Watanabe 7a3ee9217e machine: add MachineImage interface
Follow-up for fb0ea6a6a3.
Fixes #34772.
2024-10-15 20:44:13 +09:00
Lennart Poettering 6f9826b6d8 Merge pull request #34723 from poettering/machined-pidref-more
machined: switch remaining Varlink overs over to use json_dispatch_pidref() and friends
2024-10-15 11:37:39 +02:00
Mike Yuan 70ae9dc4f6 hibernate-resume-generator: don't initiate resume if soft-rebooted
This is just paranoia, to ensure that we don't accidentally
initiate resume if the initrd is entered through soft-reboot
rather than the initial one for booting up.
2024-10-15 01:18:26 +02:00
Mike Yuan f5dc74de2e shared/exec-util: modernize execute_strv() and friends a bit
do_spawn() is also called during execute_strv(), so rename
"direxec" to "exec-inner".
2024-10-15 01:16:57 +02:00
Mike Yuan 8e39ba3e5a shared/exec-util: minor rearrangement, drop unused EXEC_DIR_NONE 2024-10-15 01:16:57 +02:00
Yu Watanabe c9dea52941 Merge pull request #34743 from yuwata/bus-message-dump-fd
bus-message-util: introduce bus_message_dump_fd() and _string()
2024-10-15 05:58:03 +09:00
Yu Watanabe 40fbde9571 Merge pull request #34745 from yuwata/local-outbounds-prefsrc
local-addresses: honor RTA_PREFSRC field of gateway
2024-10-15 05:57:34 +09:00
Lennart Poettering 6bca1a7c6c machined: port all varlink APIs over to new PidRef serialization 2024-10-14 12:47:17 +02:00
Ivan Kruglov 7809bd3ba7 machine: introduce io.systemd.MachineImage.Update varlink method
io.systemd.MachineImage.Update implements the following dbus org.freedesktop.machine1.Manager interfaces:

- RenameImage
- MarkImageReadOnly
- SetImageLimit
2024-10-14 11:09:18 +02:00
Ivan Kruglov fb0ea6a6a3 machine: introduce io.systemd.MachineImage.List varlink method
io.systemd.MachineImage.List implements the following dbus org.freedesktop.machine1.Manager interfaces:

- GetImage
- ListImages
- GetImageHostname
- GetImageMachineID
- GetImageMachineInfo
- GetImageOSRelease
2024-10-14 10:57:36 +02:00
Ivan Kruglov 4439679892 machine: fix misnamed params in src/shared/discover-image.h 2024-10-14 10:42:47 +02:00
Yu Watanabe 4adf2653e2 local-addresses: honor RTA_PREFSRC field of gateway
Fixes #34739.
2024-10-13 06:56:41 +09:00
Yu Watanabe 418641f73f local-addresses: use FOREACH_ARRAY() macro 2024-10-13 06:30:58 +09:00
Yu Watanabe 058bccbecb bus-message-util: introduce bus_message_dump_fd() and _string()
Then, use them in analyze and oomctl.
2024-10-13 05:44:19 +09:00
Arthur ShauandMatteo Croce cc0ab8c810 timer: introduce DeferReactivation setting
By default, in instances where timers are running on a realtime schedule,
if a service takes longer to run than the interval of a timer, the
service will immediately start again when the previous invocation finishes.
This is caused by the fact that the next elapse is calculated based on
the last trigger time, which, combined with the fact that the interval
is shorter than the runtime of the service, causes that elapse to be in
the past, which in turn means the timer will trigger as soon as the
service finishes running.

This behavior can be changed by enabling the new DeferReactivation setting,
which will cause the next calendar elapse to be calculated based on when
the trigger unit enters inactivity, rather than the last trigger time.

Thus, if a timer is on an realtime interval, the trigger will always
adhere to that specified interval.
E.g. if you have a timer that runs on a minutely interval, the setting
guarantees that triggers will happen at *:*:00 times, whereas by default
this may skew depending on how long the service runs.

Co-authored-by: Matteo Croce <teknoraver@meta.com>
2024-10-11 22:54:16 +02:00
Yu Watanabe 8cde9f6c5a conf-parser: introduce config_parse_in_addr_prefix()
It is not used currently, but will be used later.
2024-10-12 03:26:04 +09:00
Lennart Poettering d00dd3d3c0 Merge pull request #34717 from anonymix007/fundamental-boot-changes
Fundamental and boot changes for multi-dt UKIs
2024-10-11 17:55:06 +02:00
Mike Yuan 8c9c8e304e shared/bus-util: re-break comment, insert missing newline before case
Follow-up for a178ffdfcd
2024-10-11 15:30:04 +02:00
Daan De Meyer 051441e559 Merge pull request #34686 from DaanDeMeyer/bus-fallback
Make sure bus_connect_transport_systemd() actually connects to the private manager bus
2024-10-11 15:16:54 +02:00
anonymix007 33af044178 fundamental: Add EFI_GUID userspace definition 2024-10-11 15:23:54 +03:00
Lennart Poettering 1fef1773c0 Merge pull request #34703 from poettering/pidref-varlink
Serialize "PidRef" in a reasonable way in Varlink interfaces
2024-10-11 13:33:44 +02:00