summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2024-05-04 18:12:54 +0200
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2024-05-05 18:58:35 +0000
commit813fd4dfe0d1a3fbffc06c4e9374b263ca67035a (patch)
tree3787ad5273b1df4b1dc76cbfec692357397f8a22
parentMerge pull request #309340 from drupol/backport-309337-to-release-23.11 (diff)
downloadnixpkgs-origin/backport-309068-to-release-23.11.tar.gz
nixos/dbus: fix switching from dbus-broker to dbusorigin/backport-309068-to-release-23.11
(cherry picked from commit 21ab17debeab844336d2c064471ba984200b3c8a)
-rw-r--r--nixos/modules/services/system/dbus.nix12
-rwxr-xr-xnixos/modules/system/activation/switch-to-configuration.pl3
2 files changed, 15 insertions, 0 deletions
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index 8d5b25e61762..7d6b85e2b79b 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -145,6 +145,10 @@ in
};
systemd.services.dbus = {
+ aliases = [
+ # hack aiding to prevent dbus from restarting when switching from dbus-broker back to dbus
+ "dbus-broker.service"
+ ];
# Don't restart dbus-daemon. Bad things tend to happen if we do.
reloadIfChanged = true;
restartTriggers = [
@@ -156,6 +160,10 @@ in
};
systemd.user.services.dbus = {
+ aliases = [
+ # hack aiding to prevent dbus from restarting when switching from dbus-broker back to dbus
+ "dbus-broker.service"
+ ];
# Don't restart dbus-daemon. Bad things tend to happen if we do.
reloadIfChanged = true;
restartTriggers = [
@@ -182,6 +190,8 @@ in
# https://github.com/NixOS/nixpkgs/issues/108643
systemd.services.dbus-broker = {
aliases = [
+ # allow other services to just depend on dbus,
+ # but also a hack aiding to prevent dbus from restarting when switching from dbus-broker back to dbus
"dbus.service"
];
# Don't restart dbus. Bad things tend to happen if we do.
@@ -196,6 +206,8 @@ in
systemd.user.services.dbus-broker = {
aliases = [
+ # allow other services to just depend on dbus,
+ # but also a hack aiding to prevent dbus from restarting when switching from dbus-broker back to dbus
"dbus.service"
];
# Don't restart dbus. Bad things tend to happen if we do.
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index e2f66a287bc4..15045f023f0e 100755
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -472,6 +472,9 @@ sub handle_modified_unit { ## no critic(Subroutines::ProhibitManyArgs, Subroutin
$units_to_reload->{$unit} = 1;
record_unit($reload_list_file, $unit);
}
+ elsif ($unit eq "dbus.service" || $unit eq "dbus-broker.service") {
+ # dbus service should only ever be reloaded, not started/stoped/restarted as that would break the system.
+ }
elsif (!parse_systemd_bool(\%new_unit_info, "Service", "X-RestartIfChanged", 1) || parse_systemd_bool(\%new_unit_info, "Unit", "RefuseManualStop", 0) || parse_systemd_bool(\%new_unit_info, "Unit", "X-OnlyManualStart", 0)) {
$units_to_skip->{$unit} = 1;
} else {