Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbus service: use /etc/dbus-1 for configuration #22343

Merged
merged 2 commits into from
Feb 1, 2017

Conversation

abbradar
Copy link
Member

@abbradar abbradar commented Feb 1, 2017

Also use upstream systemd units.

Motivation for this change

Fixes #22302 and brings us closer to upstream.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Credits to @layus for noticing that if we use /etc/dbus-1 we can also use upstream systemd ExecStarts as is.

@mention-bot
Copy link

@abbradar, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @peterhoeg and @wkennington to be potential reviewers.

@abbradar abbradar mentioned this pull request Feb 1, 2017
Also use upstream systemd units.
@dezgeg
Copy link
Contributor

dezgeg commented Feb 1, 2017

I think last time we tweaked how dbus reads its config files it became a problem when doing a nixos-rebuild switch from the previous NixOS release to a new release. Might be worth checking it doesn't become a problem again...

@abbradar
Copy link
Member Author

abbradar commented Feb 1, 2017

It should be okay if done 16.09 -> 17.03 because 16.09 already had and used /etc/dbus-1. BTW current master would break that (it uses /run/current-system/dbus instead).

They are already included by dbus from /run/current-system/sw/share/dbus-1.
@abbradar
Copy link
Member Author

abbradar commented Feb 1, 2017

I've noticed that D-Bus actually reads its own config file from /run/current-system/share/dbus-1/{system,session}.conf first, and then goes to include files from /etc/dbus-1. Because of this we can skip copying this configuration to /etc/dbus-1 and instead just copy {system,session}-local.conf.

cc @layus

@layus
Copy link
Member

layus commented Feb 1, 2017

@abbradar Yes, I think it is better not to have twice the (nearly) same file. What still bothers me is

  1. Relying on the default path of /run/current-system/sw/share/dbus-1/system.conf is crappy. That path is a bundle of all the reachable system packages. You could even have a conflict for that path between two versions of dbus. Who knows what version will win ?
  2. relying on the default setting for --system and --session, especially knowing where it comes from, seems a bad idea. From online manuals, I understood that [the] --session option is equivalent to "--config-file=/etc/dbus-1/session.conf" but now I is clear that [the] --session option is equivalent to "--config-file=BDUS_DATADIR/dbus-1/session.conf". Maybe using an explicit path in the service config file would be better than relying on a default that may change in the future.

May I suggest to return to your initial solution, where the service is explicitly started with --config-file=/etc/dbus-1/session.conf ? It feels cleaner to me because 1) anyone reading systemctl cat dbus will know what file is really used by dbus and 2) anyone looking at /etc/dbus-1 will see the files actually used by dbus, as expected (see #20871 (comment))

@layus
Copy link
Member

layus commented Feb 1, 2017

Also, the default system.conf has <includedir>system.d</includedir>. This relative include means that anything in /run/current-system/sw/share/dbus-1/system.d will be loaded by dbus. I prefer loading /etc/dbus-1/system.d than the above.

@abbradar
Copy link
Member Author

abbradar commented Feb 1, 2017

A disadvantage of the older approach is that those who do start dbus-daemon by themselves (like Xfce) will anyway go through $out/share/dbus-1/system.conf, which then includes nearly the same file. This also requires hacks like copying and sedding them, and overriding upstream units. For example, they originally also have a call to reload something in dbus which we have removed by our overrides. Feels fishy to me.

We can be sure that dbus will read its own configuration file, and they definitely won't remove inclusion of /etc/dbus-1/*-local.conf files any time soon (feels like a major breakage to me, for example they still include /etc/dbus-1/local.conf even though they mark it as deprecated). I imagine that other distributions/users rely on this file and it's somewhat standartized.

I don't think explicit config file helps users to understand what's going on much because: /etc/dbus-1/*-local.conf are seemingly well-known files and their local suffixes hint clearly that they are our overrides, not complete upstream config; the config itself resides in the package directory, which is a usual situation for NixOS. Finally, closer to the upstream feels better to me -- both in maintenance and in users' expectations (there are more users familiar with upstream than there are with NixOS).

Your concern about system.d and /run/current-system/sw/share in general goes away if we remove our change of datadir to /run/current-system/sw/share -- then D-Bus will read its configuration files from $out which seems the best way to me.

@abbradar
Copy link
Member Author

abbradar commented Feb 1, 2017

As this creates serious problems for Xfce users (disclosure: myself included but I have a custom nixpkgs branch anyway) I want to merge this sooner and postpone mass-rebuild changes (remove of /run/current-system/sw/share as the data path) for later. However let's wait for a bit -- maybe @layus / others want to express more opinions about both discussed approaches.

@layus
Copy link
Member

layus commented Feb 1, 2017

Your concern about system.d and /run/current-system/sw/share in general goes away if we remove our change of datadir to /run/current-system/sw/share -- then D-Bus will read its configuration files from $out which seems the best way to me.

Yes, indeed. Lets keep it like this, and try to push the datadir change later.

Copy link
Member

@layus layus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me. Let's defer the other changes and merge this to fix the breakage. Thanks for investigating :-)

@abbradar abbradar merged commit c34cfa2 into NixOS:master Feb 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DBus and Xfce
4 participants