NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.98k stars 13.34k forks source link

Use dbus broker per default #299476

Open LDprg opened 4 months ago

LDprg commented 4 months ago

Is your feature request related to a problem? Please describe. Use dbus broker as default dbus implementation. Dbus broker is considered as a faster and more efficient dbus implementation that is fully compatible to normal dbus. Fedora did switch to dbus broker per default and afaik Arch too.

Describe the solution you'd like Using dbus broker as default implementation.

Priorities

Add :+1: to issues you find important.

SuperSandro2000 commented 4 months ago

That would be

services.dbus.implementation = "broker";
LDprg commented 4 months ago

@SuperSandro2000 Yeah, I was talking about the change of the default value.

NickCao commented 4 months ago

Fedora did switch to fbus broker per default

https://fedoraproject.org/wiki/Changes/DbusBrokerAsTheDefaultDbusImplementation

and afaik Arch too.

https://archlinux.org/news/making-dbus-broker-our-default-d-bus-daemon/

And I've also been using it for a while.

Aleksanaa commented 4 months ago

+1 for this. I've been using it for nearly 2 years with no issues.

norpol commented 4 months ago

I think one issue is that the dbus package has teams.freedesktop.members as maintainers, whilst dbus-broker only has one maintainer in nixpkgs. I know there are bunch of people that are always helping out, but having sufficient enough of people who are willing to jump/maintain such a critical component would be important before switching to default.

SuperSandro2000 commented 4 months ago

That's not really a metric we can go after (unfortunately or fortunately depending on how you look at it). For example to many packages included in the stdenv have the same situation and don't have a "real" maintainer for a long time.

LDprg commented 4 months ago

Would it be possible for teams.freedesktop.members to take over maintainership of dbus-broker. Since dbus and dbus-broker are linked anyway it would be great if both are maintained by roughly the same people.

However not saying somebody should be forced to maintain something. And of course from a strict viewpoint dbus-broker is not part of the freedesktop.org.

LDprg commented 4 months ago

Also something to keep in mind is missing Apparmour support of dbus-broker. Not sure if this is relevant to us though and it is been worked on it.

nixos-discourse commented 4 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/would-it-be-feasible-to-make-dbus-broker-the-default-dbus-implementation/41760/19

SuperSandro2000 commented 4 months ago

As already wrote before, I don't think the maintenance situation is a blocker for this. We have many way more critical packages which are far less maintained and I also don't think that the package requires lots of maintenance and since other distros are also using it, we are not alone with the decision.

apparmor support is not very widespread in NixOS and I am not even sure if dbus had it enabled before, so I don't think that is a blocker either.

A blocker for me would be for example if there are major DEs which do not work with dbus-broker which I am not aware of any.

norpol commented 4 months ago

@SuperSandro2000 If you think this is a sufficient consensus approach? I see you're contributing a lot to nixpkgs, so I'm assuming you know well what the right approach is. I see @Mic92 suggested a while back (2022) to "test it sufficiently" before switching to it as a default, it seems to me as well enough time has passed since then.

I think my only possible concern right now is that switching from dbus to dbus-broker during regular runtime can practically hardlock/crash your system if unlucky. I've been running on NixOS unstable for many years and I barely needed to reboot after running nixos-rebuild switch --upgrade, this change will ?certainly? cause that for some others. Is that acceptable, or are there ways to avoid disturbing users too much?

Other observation:

Currently there is one report with some warning messages, there are other forums with similar warnings, I think they can be ignored but we should at least make sure to track/cleanup appropriately in the future. I have just spotted those message on one of my systems as well, and just double checked those are only shown when I run sudo systemctl reload dbus-broker, with no effect on my system stability.

sudo systemctl reload dbus-broker
Apr 03 21:30:45 italic systemd[1]: Reloading D-Bus System Message Bus...
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Looking up NSS group entry for 'netdev'...
Apr 03 21:30:45 italic dbus-broker-launch[1630]: NSS returned no entry for 'netdev'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Invalid group-name in /nix/store/jdmbxbg28f5wsnybkbbhc5834i5g5xnn-system-path/share/dbus-1/system.d/avahi-dbus.conf +24: group="netdev"
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Looking up NSS user entry for 'nm-openconnect'...
Apr 03 21:30:45 italic dbus-broker-launch[1630]: NSS returned no entry for 'nm-openconnect'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Invalid user-name in /nix/store/jdmbxbg28f5wsnybkbbhc5834i5g5xnn-system-path/share/dbus-1/system.d/nm-openconnect-service.conf +9: user="nm-openconnect"
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Looking up NSS user entry for 'systemd-timesync'...
Apr 03 21:30:45 italic dbus-broker-launch[1630]: NSS returned no entry for 'systemd-timesync'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Invalid user-name in /nix/store/jdmbxbg28f5wsnybkbbhc5834i5g5xnn-system-path/share/dbus-1/system.d/org.freedesktop.timesync1.conf +16: user="systemd-timesync"
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Invalid user-name in /nix/store/3v8fv7c4i34c08s6419rrxilagrfwhbj-NetworkManager-openconnect-1.2.10/share/dbus-1/system.d/nm-openconnect-service.conf +9: user="nm-openconnect"
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Invalid group-name in /nix/store/7f21i5s1xbjr6yba27zffc8n0m9vywhl-avahi-0.8/share/dbus-1/system.d/avahi-dbus.conf +24: group="netdev"
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.opensuse.CupsPkHelper.Mechanism' in service file '/nix/store/3z9d6iir0ikbgwxm9bzg5cpfd5id6r75-cups-pk-helper-0.2.6/share/dbus-1/system-services/org.opensuse.CupsPkHelper.Mechanism.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.ModemManager1' in service file '/nix/store/r8makyq7kwn9mj3b54bagjcfyghjg9kj-modemmanager-1.22.0/share/dbus-1/system-services/org.freedesktop.ModemManager1.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.nm_dispatcher' in service file '/nix/store/3smcvkky0inrnw2kdsflxh34in0sn2qp-networkmanager-1.46.0/share/dbus-1/system-services/org.freedesktop.nm_dispatcher.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.nm_priv_helper' in service file '/nix/store/3smcvkky0inrnw2kdsflxh34in0sn2qp-networkmanager-1.46.0/share/dbus-1/system-services/org.freedesktop.nm_priv_helper.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'fi.w1.wpa_supplicant1' in service file '/nix/store/8fvfgwjygc3lh5vk9k1d6fsvlgxfidrf-wpa_supplicant-2.10/share/dbus-1/system-services/fi.w1.wpa_supplicant1.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.UPower' in service file '/nix/store/l3x8q51rn5cqcwjvhiixcxm1mlmvplig-upower-1.90.2/share/dbus-1/system-services/org.freedesktop.UPower.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.UDisks2' in service file '/nix/store/4drhcgvfw5ajwy9gy10w2bz8c7n03mfl-udisks-2.10.1/share/dbus-1/system-services/org.freedesktop.UDisks2.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.fwupd' in service file '/nix/store/bac40avv36dinia03mb6a7x1wl7vdjdm-fwupd-1.9.15/share/dbus-1/system-services/org.freedesktop.fwupd.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.bluez.mesh' in service file '/nix/store/3y7sp3w7x3nrj7a98klwsgsv3yrgh7rs-bluez-5.72/share/dbus-1/system-services/org.bluez.mesh.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.bluez' in service file '/nix/store/3y7sp3w7x3nrj7a98klwsgsv3yrgh7rs-bluez-5.72/share/dbus-1/system-services/org.bluez.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.GeoClue2' in service file '/nix/store/yjgcfcc77j4yvvqls3b48kkiyfyahafc-geoclue-2.7.0/share/dbus-1/system-services/org.freedesktop.GeoClue2.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.Flatpak.SystemHelper' in service file '/nix/store/19x41k1lh40nxbacvlk9lrn4q00gbgd7-flatpak-1.14.5/share/dbus-1/system-services/org.freedesktop.Flatpak.SystemHelper.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.Accounts' in service file '/nix/store/zaqxvczv831bl2ngv8g8p7jwxlqxil0i-accountsservice-23.13.9/share/dbus-1/system-services/org.freedesktop.Accounts.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.RealtimeKit1' in service file '/nix/store/xf5k74nwvm9wfrrnamk1xak78hnr0zb0-rtkit-0.13/share/dbus-1/system-services/org.freedesktop.RealtimeKit1.service'
Apr 03 21:30:45 italic dbus-broker-launch[1630]: Ignoring duplicate name 'org.freedesktop.PolicyKit1' in service file '/nix/store/8zp2p97y1qcdg0pv8znfzxyvq2byl20m-polkit-123/share/dbus-1/system-services/org.freedesktop.PolicyKit1.service'
Apr 03 21:30:45 italic systemd[1]: Reloaded D-Bus System Message Bus.
LDprg commented 3 months ago

Can someone reopen this, since the PR got reverted? I will create a new PR (draft) after the release of 24.05. This time the systemd team should be more involved and there should be more specific testing to avoid regressions.

nixos-discourse commented 3 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/would-it-be-feasible-to-make-dbus-broker-the-default-dbus-implementation-implemented/41760/20

Atemu commented 3 months ago

While it's cool that there is another implementation that works well enough to be considered the default, I'd like to question the decision to switch the default.

I'm not tied to regular dbus but so far I have not seen a reason for switching other than "the cool kids are doing it too".

The only upsides brought up so far were that it's faster/more efficient but I don't think I was ever even close to hitting a performance bottleneck on plain old dbus.
Dbus as a general concept is simply not a performance critical-thing; even a human could keep up with the traffic going over it. In such cases I'd prefer reliability over speed as a general rule and I've yet to see data that suggests dbus-broker is more reliable than the plain old dbus implementation used for the better part of two decades. I don't think I've ever had an issue with the the dbus server itself.

Are there any benefits to dbus-broker other than that it's faster and newer?

LDprg commented 3 months ago

Dbus-broker provides better logging than dbus, which could help especially for cleaning nix code and troubleshooting.