nixos/systemd-stage-1: Enable dbus by default

Also fix the scary dbus warning when using systemctl
This commit is contained in:
Will Fancher
2026-04-07 20:32:12 -04:00
parent 6201e203d0
commit 0d7de04c0c
+20 -1
View File
@@ -32,7 +32,19 @@ in
options = {
boot.initrd.systemd.dbus = {
enable = mkEnableOption "dbus in stage 1";
enable = mkEnableOption "dbus in stage 1" // {
# TODO: This isn't really necessary, but it avoids a very
# common red herring error message:
#
# $ systemctl ...
# Failed to connect to system scope bus via local transport: No such file or directory.
#
# When systemctl tries and fails to control the system manager
# over dbus, it fals back to a private bus socket after
# printing this message. It works, but users often think it is
# the source of their problem when it isn't.
default = true;
};
};
services.dbus = {
@@ -163,6 +175,13 @@ in
"${config.boot.initrd.systemd.package}/share/dbus-1/system.d"
];
targets.sockets.wants = [ "dbus.socket" ];
# Otherwise, dbus waits on cryptsetup, and systemctl says the
# bus couldn't be found. This isn't an error (systemctl will
# fall back to a private bus with PID 1), but it's confusing
# to unaware users.
services.dbus.unitConfig.DefaultDependencies = false;
sockets.dbus.unitConfig.DefaultDependencies = false;
};
})