1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 09:48:03 -08:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Ronan Pigott
de0487f11c
Merge b2347d690a into 33c15ba8e8 2024-12-22 05:19:24 +00:00
Daan De Meyer
33c15ba8e8 Remove leftover .gitmodules file 2024-12-21 22:43:57 +00:00
Daan De Meyer
5495b11360 mkosi: Fix authselect systemd-homed feature name
The feature name is with-systemd-homed, not with-homed.
2024-12-21 21:03:03 +01:00
Daan De Meyer
7655550a49 systemd-homed: Give access to /dev/btrfs-control
Otherwise, we see "WARNING: failed to open /dev/btrfs-control,
skipping device registration: Operation not permitted" in systemd-homed's
logs when creating a btrfs on luks home.
2024-12-21 19:15:01 +01:00
Daan De Meyer
36dd429680 units: Order systemd-oomd after systemd-sysusers
systemd-sysusers might create the systemd-oom system user that
systemd-oomd runs under so let's order systemd-oomd after
systemd-sysusers.
2024-12-21 19:14:30 +01:00
Yu Watanabe
52a2b04947 hwdb: comment out the entry for Logitech MX Keys for Mac
This effectively reverts the commit f70e5620b6,
as the entry seems to match multiple models.

Fixes #35691.
2024-12-21 12:19:08 +00:00
Ronan Pigott
b2347d690a manager: s/deserialized_subscribed/subscribe_serialization
Now that this field may get populated at runtime, the deserialized name
is misleading. Change the name to reflect its updated purpose.
2024-12-14 11:59:31 -07:00
Ronan Pigott
1b58645207 dbus: stash the subscriber list when we disconenct from the bus
If we unexpectly disconnect from the bus, systemd would end up dropping
the list of subscribers, which breaks the ability of clients like logind
to monitor the state of units.

Stash the list of subscribers into the deserialized state in the event
of a disconnect so that when we recover we can renew the broken
subscriptions.
2024-12-14 11:59:31 -07:00
12 changed files with 62 additions and 20 deletions

0
.gitmodules vendored
View File

View File

@ -1451,10 +1451,15 @@ evdev:input:b0003v046DpC309*
KEYBOARD_KEY_c01b6=images # My Pictures (F11)
KEYBOARD_KEY_c01b7=audio # My Music (F12)
# The wireless receiver b0003v046Dp4092* seems to be used by multiple models.
# See issue #35691. Hence, the entry below cannot be enabled by default. If
# you're using the model below, consider copying the entry to a custom hwdb
# file to enable the setting.
#
# Logitech MX Keys for Mac
evdev:input:b0003v046Dp4092*
KEYBOARD_KEY_70035=102nd # '<' key
KEYBOARD_KEY_70064=grave # '^' key
#evdev:input:b0003v046Dp4092*
# KEYBOARD_KEY_70035=102nd # '<' key
# KEYBOARD_KEY_70064=grave # '^' key
###########################################################
# Maxdata

View File

@ -24,8 +24,8 @@ if command -v authselect >/dev/null; then
authselect select "$PROFILE"
if authselect list-features "$PROFILE" | grep -q "with-homed"; then
authselect enable-feature with-homed
if authselect list-features "$PROFILE" | grep -q "with-systemd-homed"; then
authselect enable-feature with-systemd-homed
fi
fi

View File

@ -860,6 +860,10 @@ int bus_init_api(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to set up API bus: %m");
r = bus_track_coldplug(bus, &m->subscribed, /* recursive= */ false, m->subscribe_serialization);
if (r < 0)
return r;
m->subscribe_serialization = strv_free(m->subscribe_serialization);
m->api_bus = TAKE_PTR(bus);
return 0;
@ -1004,8 +1008,19 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
}
/* Get rid of tracked clients on this bus */
if (m->subscribed && sd_bus_track_get_bus(m->subscribed) == *bus)
if (m->subscribed && sd_bus_track_get_bus(m->subscribed) == *bus) {
_cleanup_strv_free_ char **subscribed = NULL;
int r;
r = bus_track_to_strv(m->subscribed, &subscribed);
if (r < 0)
log_error_errno(r, "Failed to serialize api subscribers: %m");
r = strv_extend_strv_consume(&m->subscribe_serialization, TAKE_PTR(subscribed), /* filter_duplicates = */ false);
if (r < 0)
log_error_errno(r, "Failed to record api subscribers: %m");
m->subscribed = sd_bus_track_unref(m->subscribed);
}
HASHMAP_FOREACH(j, m->jobs)
if (j->bus_track && sd_bus_track_get_bus(j->bus_track) == *bus)
@ -1064,7 +1079,6 @@ void bus_done(Manager *m) {
assert(!m->subscribed);
m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
m->polkit_registry = hashmap_free(m->polkit_registry);
}
@ -1153,20 +1167,19 @@ void bus_track_serialize(sd_bus_track *t, FILE *f, const char *prefix) {
}
}
int bus_track_coldplug(Manager *m, sd_bus_track **t, bool recursive, char **l) {
int bus_track_coldplug(sd_bus *bus, sd_bus_track **t, bool recursive, char **l) {
int r;
assert(m);
assert(t);
if (strv_isempty(l))
return 0;
if (!m->api_bus)
if (!bus)
return 0;
if (!*t) {
r = sd_bus_track_new(m->api_bus, t, NULL, NULL);
r = sd_bus_track_new(bus, t, NULL, NULL);
if (r < 0)
return r;
}

View File

@ -19,7 +19,7 @@ void bus_done(Manager *m);
int bus_fdset_add_all(Manager *m, FDSet *fds);
void bus_track_serialize(sd_bus_track *t, FILE *f, const char *prefix);
int bus_track_coldplug(Manager *m, sd_bus_track **t, bool recursive, char **l);
int bus_track_coldplug(sd_bus *bus, sd_bus_track **t, bool recursive, char **l);
int bus_foreach_bus(Manager *m, sd_bus_track *subscribed2, int (*send_message)(sd_bus *bus, void *userdata), void *userdata);

View File

@ -489,7 +489,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
(void) exec_shared_runtime_deserialize_one(m, val, fds);
else if ((val = startswith(l, "subscribed="))) {
r = strv_extend(&m->deserialized_subscribed, val);
r = strv_extend(&m->subscribe_serialization, val);
if (r < 0)
return r;
} else if ((val = startswith(l, "varlink-server-socket-address="))) {

View File

@ -1804,6 +1804,9 @@ Manager* manager_free(Manager *m) {
free(m->switch_root);
free(m->switch_root_init);
sd_bus_track_unref(m->subscribed);
strv_free(m->subscribe_serialization);
unit_defaults_done(&m->defaults);
FOREACH_ARRAY(map, m->units_needing_mounts_for, _UNIT_MOUNT_DEPENDENCY_TYPE_MAX) {
@ -2140,10 +2143,10 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds, const char *roo
manager_setup_bus(m);
/* Now that we are connected to all possible buses, let's deserialize who is tracking us. */
r = bus_track_coldplug(m, &m->subscribed, false, m->deserialized_subscribed);
r = bus_track_coldplug(m->api_bus, &m->subscribed, false, m->subscribe_serialization);
if (r < 0)
log_warning_errno(r, "Failed to deserialized tracked clients, ignoring: %m");
m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
m->subscribe_serialization = strv_free(m->subscribe_serialization);
r = manager_varlink_init(m);
if (r < 0)
@ -3809,9 +3812,6 @@ int manager_reload(Manager *m) {
/* Clean up runtime objects no longer referenced */
manager_vacuum(m);
/* Clean up deserialized tracked clients */
m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
/* Consider the reload process complete now. */
assert(m->n_reloading > 0);
m->n_reloading--;

View File

@ -340,7 +340,7 @@ struct Manager {
considered subscribes, since they last for very short only,
and it is much simpler that way. */
sd_bus_track *subscribed;
char **deserialized_subscribed;
char **subscribe_serialization;
/* This is used during reloading: before the reload we queue
* the reply message here, and afterwards we send it */

View File

@ -698,6 +698,28 @@ int bus_track_add_name_many(sd_bus_track *t, char **l) {
return r;
}
int bus_track_to_strv(sd_bus_track *t, char ***ret) {
_cleanup_strv_free_ char **subscribed = NULL;
int r = 0;
assert(ret);
for (const char *n = sd_bus_track_first(t); n; n = sd_bus_track_next(t)) {
r = sd_bus_track_count_name(t, n);
if (r < 0)
return r;
for (int j = 0; j < r; j++) {
r = strv_extend(&subscribed, n);
if (r < 0)
return r;
}
}
*ret = TAKE_PTR(subscribed);
return r;
}
int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *description) {
_cleanup_(sd_bus_close_unrefp) sd_bus *bus = NULL;
const char *e;

View File

@ -66,6 +66,7 @@ int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id,
int bus_path_decode_unique(const char *path, const char *prefix, char **ret_sender, char **ret_external);
int bus_track_add_name_many(sd_bus_track *t, char **l);
int bus_track_to_strv(sd_bus_track *t, char ***ret);
int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *description);
static inline int bus_open_system_watch_bind(sd_bus **ret) {

View File

@ -18,6 +18,7 @@ BusName=org.freedesktop.home1
CapabilityBoundingSet=CAP_SYS_ADMIN CAP_CHOWN CAP_DAC_OVERRIDE CAP_FOWNER CAP_FSETID CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE CAP_SETPCAP CAP_DAC_READ_SEARCH CAP_SETFCAP
DeviceAllow=/dev/loop-control rw
DeviceAllow=/dev/mapper/control rw
DeviceAllow=/dev/btrfs-control rw
DeviceAllow=block-* rw
DeviceAllow=char-hidraw rw
ExecStart={{LIBEXECDIR}}/systemd-homed

View File

@ -20,7 +20,7 @@ ConditionPathExists=/proc/pressure/cpu
ConditionPathExists=/proc/pressure/io
ConditionPathExists=/proc/pressure/memory
Requires=systemd-oomd.socket
After=systemd-oomd.socket
After=systemd-oomd.socket systemd-sysusers.service
[Service]
AmbientCapabilities=CAP_KILL CAP_DAC_OVERRIDE