Coder Social home page Coder Social logo

bus1 / dbus-broker Goto Github PK

View Code? Open in Web Editor NEW
652.0 40.0 76.0 2.45 MB

Linux D-Bus Message Broker

Home Page: https://github.com/bus1/dbus-broker/wiki

License: Apache License 2.0

Meson 1.15% C 98.39% Makefile 0.32% Dockerfile 0.08% Shell 0.06%
d-bus linux ipc c system message-broker

dbus-broker's Introduction

dbus-broker - Linux D-Bus Message Broker

The dbus-broker project is an implementation of a message bus as defined by the D-Bus specification. Its aim is to provide high performance and reliability, while keeping compatibility to the D-Bus reference implementation. It is exclusively written for Linux systems, and makes use of many modern features provided by recent linux kernel releases.

WIKI: https://github.com/bus1/dbus-broker/wiki

BUG REPORTS: https://github.com/bus1/dbus-broker/issues

GIT:

  Cloning over ssh: [email protected]:bus1/dbus-broker.git
  Cloning over https: https://github.com/bus1/dbus-broker.git

GITWEB: https://github.com/bus1/dbus-broker

MAILINGLIST: https://groups.google.com/forum/#!forum/bus1-devel

Requirements

The requirements for dbus-broker are:

  Linux kernel >= 4.17
  glibc >= 2.16
  libaudit >= 3.0               (optional)
  libcap-ng >= 0.6              (optional)
  libselinux >= 3.2             (optional)

Additionally, the compatibility launcher requires:

  systemd >= 230
  expat >= 2.2

At build-time, the following software is required:

  meson >= 0.60
  pkg-config >= 0.29
  python-docutils >= 0.13
  linux-api-headers >= 4.13
  dbus >= 1.10                (optional: only for tests)

Install

The meson build-system is used for dbus-broker. Contact upstream documentation for detailed help. In most situations the following commands are sufficient to build and install dbus-broker from source:

  $ meson setup build
  $ meson compile -C build
  $ meson test -C build
  $ meson install -C build

For custom configuration options see meson_options.txt.

License

Apache Software License 2.0 See AUTHORS for details.

dbus-broker's People

Contributors

adamel avatar asciiwolf avatar bigon avatar bluca avatar dnicolodi avatar dvdhrm avatar evverx avatar floppym avatar georgmu avatar keruspe avatar keszybz avatar kraj avatar michich avatar mrc0mmand avatar msizanoen1 avatar pebenito avatar sre avatar teg avatar timgates42 avatar tmuehlbacher avatar yaneti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dbus-broker's Issues

dbus-broker falls back to nss with 4.13 kernel

I'm using latest stable kernel 4.13.4 which have SO_PEERGROUPS support but dbus-broker still warns about it:
dbus-broker-launch: Falling back to resolving auxillary groups using nss, this is racy and may cause deadlocks. Update to a kernel with SO_PEERGROUPS support.

Is there specific config option need to be enabled in kernel or is this false warning?

dbus-broker-launch fails to start if there are multiple service files providing the same dbus name

On this particular test system, I have both KDE and GNOME installed.
When trying to run systemctl --user start dbus-broker.service I get:

Aug 28 02:47:34 pluto systemd[1961]: Started D-Bus User Message Bus.
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Listening on inherited socket
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.Metadata.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Epiphany.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Weather.BackgroundService.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.kde.kdesvnd.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Software.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.kde.kscreen.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.kde.dolphin.FileManager1.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.taquin.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.kde.kssld5.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Telepathy.Client.Vino.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.zeitgeist.Engine.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.GoaVolumeMonitor.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Documents.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.AfcVolumeMonitor.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Dictionary.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.ColorHelper.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.hexchat.service.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Sushi.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.kde.knotify.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.impl.portal.desktop.gtk.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.systemd1.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Todo.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/ca.desrt.dconf-editor.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Rhythmbox3.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.fedoraproject.Config.Printing.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Tracker1.Writeback.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Contacts.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.portal.Desktop.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.evolution.dataserver.Calendar.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.ControlCenter.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.MTPVolumeMonitor.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.Daemon.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.impl.portal.PermissionStore.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.kde.fontinst.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Cheese.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.keyring.SystemPrompter.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.GConf.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.a11y.Bus.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.kde.kwalletd5.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Calculator.SearchProvider.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Photos.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.knopwob.dunst.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Rygel1.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Logs.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Userguides.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.OnlineMiners.Facebook.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Weather.Application.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.keyring.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Shell.PortalHelper.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.kde.kglobalaccel.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.seahorse.Application.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/us.kirkland.terminals.byobu.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Characters.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.Totem.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.evince.Daemon.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Flatpak.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/com.gexperts.Tilix.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/com.intel.dleyna-server.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Telepathy.Client.Logger.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.seahorse.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.gedit.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.evolution.dataserver.Sources.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Files.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.gnome.OnlineAccounts.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Loading service '/usr/share/dbus-1/services/org.freedesktop.FileManager1.service'
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: ERROR manager_load_service @ ../src/launch/main.c +653: Input/output error
Aug 28 02:47:34 pluto dbus-broker-launch[1988]:       manager_load_services @ ../src/launch/main.c +714
Aug 28 02:47:34 pluto dbus-broker-launch[1988]:       manager_run @ ../src/launch/main.c +856
Aug 28 02:47:34 pluto dbus-broker-launch[1988]:       run @ ../src/launch/main.c +1021
Aug 28 02:47:34 pluto dbus-broker-launch[1988]:       main @ ../src/launch/main.c +1054
Aug 28 02:47:34 pluto dbus-broker-launch[1988]: Exiting due to fatal error: -5
Aug 28 02:47:59 pluto systemd[1961]: dbus-broker.service: Main process exited, code=exited, status=1/FAILURE
Aug 28 02:47:59 pluto systemd[1961]: dbus-broker.service: Unit entered failed state.

The problem afaics is this:

$ grep FileManager /usr/share/dbus-1/services/*.service
/usr/share/dbus-1/services/org.freedesktop.FileManager1.service:Name=org.freedesktop.FileManager1
/usr/share/dbus-1/services/org.kde.dolphin.FileManager1.service:Name=org.freedesktop.FileManager1

I.e. I have two service files providing the same D-Bus name.
The spec is not totally clear in that regard. Afaik, dbus (the reference implementation) basically picks one of the service files at random.
dbus-broker-launch should handle this more gracefully. Maybe log an error message about this and either pick one (at random) or ignore all service files which provide/claim the same name.

this might be a good opportunity to replace calls to avc_has_perm() with calls to selinux_access_check() in selinux.c

avc_has_perm() is a legacy compatibility interface provided with libselinux, and it should ideally be replaced with calls to selinux_access_check()

as more important components like systemd become more dependent on dbus it becomes more important that the selinux code is up-to-date.

i understand that you may not see it as your duty to address this issue, but i am taking the opportunity to inform you that selinux.c is calling legacy compatibility interfaces, just in case you feel up to the task.

this might be a good opportunity to revisit dbus calls to legacy and compatibility interfaces provided by libselinux

SELinuxProject/selinux#34

[wiki] fix command enabling user dbus-broker.service globally

The command proposed in wiki is wrong:
systemctl --global --user enable dbus-broker.service

it works same as below, which enable user srvice locally.
systemctl --user enable dbus-broker.service

The correct command should be:
systemctl --global enable dbus-broker.service

https://www.freedesktop.org/software/systemd/man/systemctl.html

--global

When used with enable and disable, operate on the global user configuration directory, thus enabling or disabling a unit file globally for all future logins of all users.

user activated service not being activated without SystemdService=

In the wiki is states that direct activation is no longer support and that in the event a activated service cannot be started via a systemd unit, that dbus-broker will start it with a transient unit.

However, I have such a scenario: dunst in the past was activated directly by dbus --session, however it looks like dbus-broker now just ignores /usr/share/dbus-1/services/org.knopwob.dunst.service (ie. busctl --user does not list this as activateable). I have no indication that my dbus-broker user instance is trying to create/start a transient unit either

To reproduce:

install dunst & make sure you have no other notification daemon
use notify-send to trigger activation
also confirm that busctl --user doesnt list org.knopwob.dunst.service as activate-able

managed to crash dbus-broker

Oct 19 12:07:13 julius dbus-broker-launch[1109]: Caught SIGCHLD of broker
Oct 19 12:07:13 julius systemd[1]: dbus-broker.service: Failed with result 'exit-code'.
Oct 19 12:07:13 julius polkitd[1118]: Lost the name org.freedesktop.PolicyKit1 - exiting
Oct 19 12:07:13 julius dbus-broker-launch[1109]: Exiting due to fatal error: -13
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       main @ ../src/broker/main.c +268
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       run @ ../src/broker/main.c +244
Oct 19 12:07:13 julius systemd[1]: dbus-broker.service: Main process exited, code=exited, status=1/FAILURE
Oct 19 12:07:13 julius bluetoothd[1115]: Disconnected from D-Bus. Exiting.
Oct 19 12:07:13 julius audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=sys.id:sys.role:systemd.system.subj:s0 msg='unit=dbus-broker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Oct 19 12:07:13 julius avahi-daemon[1119]: avahi-daemon 0.7 exiting.
Oct 19 12:07:13 julius avahi-daemon[1119]: Leaving mDNS multicast group on interface wlp3s0.IPv4 with address 192.168.1.21.
Oct 19 12:07:13 julius avahi-daemon[1119]: Leaving mDNS multicast group on interface wlp3s0.IPv6 with address fe80::582:b79c:c415:63a4.
Oct 19 12:07:13 julius avahi-daemon[1119]: Got SIGTERM, quitting.
Oct 19 12:07:13 julius avahi-daemon[1119]: Disconnected from D-Bus, exiting.
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       broker_run @ ../src/broker/broker.c +168
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       dispatch_context_dispatch @ ../src/util/dispatch.c +345
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       peer_dispatch @ ../src/bus/peer.c +121
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       peer_dispatch_connection @ ../src/bus/peer.c +59
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       driver_dispatch @ ../src/bus/driver.c +1902
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       driver_dispatch_internal @ ../src/bus/driver.c +1808
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       driver_forward_unicast @ ../src/bus/driver.c +1763
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       peer_queue_call @ ../src/bus/peer.c +574
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       bus_log_commit_policy @ ../src/bus/bus.c +110
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       log_commit_journal @ ../src/util/log.c +504
Oct 19 12:07:13 julius dbus-broker-launch[1109]:       log_commit_journal @ ../src/util/log.c +498
Oct 19 12:07:13 julius dbus-broker-launch[1109]: ERROR log_alloc @ ../src/util/log.c +234: Permission denied
Oct 19 12:07:13 julius audit: PROCTITLE proctitle=646275732D62726F6B6572002D76002D2D6C6F670034002D2D636F6E74726F6C6C65720038
Oct 19 12:07:13 julius audit[1110]: SYSCALL arch=c000003e syscall=77 success=no exit=-13 a0=21 a1=10000000 a2=562553f59fa2 a3=23b items=0 ppid=1109 pid=1110 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="dbus-broker" exe="/usr/bin/dbus-broker" subj=sys.id:sys.role:dbus.system.subj:s0 key=(null)
Oct 19 12:07:13 julius audit[1110]: AVC avc:  denied  { write } for  pid=1110 comm="dbus-broker" name="memfd:dbus-broker-log" dev="tmpfs" ino=1331363 scontext=sys.id:sys.role:dbus.system.subj:s0 tcontext=sys.id:sys.role:fs.tmpfs.fs:s0 tclass=file permissive=0
Oct 19 12:07:13 julius audit[1110]: USER_AVC pid=1110 uid=0 auid=4294967295 ses=4294967295 subj=sys.id:sys.role:dbus.system.subj:s0 msg='avc:  denied  { send_msg } for  scontext=wheel.id:sysadm.role:wheel_cockpit_bridge_priv.subj:s0 tcontext=sys.id:sys.role:tune.daemon.subj:s0 tclass=dbus permissive=0
                                     exe="/usr/bin/dbus-broker" sauid=0 hostname=? addr=? terminal=?'

can anyone please tell me a little about dbus-broker-log? it seems that this log file is created on some tmpfs (likely either /tmp or /dev/shm?) Why is that?

dbus-broker and tmux issue

This is more of an inherent issue from systemd, but nonetheless a regression compared to a session running on the dbus-daemon.

I have a terminal emulator called Germinal, which follows gnome guidelines for dbus-activatable gapplications (https://wiki.gnome.org/HowDoI/DBusApplicationLaunching).
Germinal launches tmux as its child, attaching to an existing session or creating a new one.

With dbus-daemon, all the process are listed as children of dbus.service by systemd-cgls.
With dbus-broker, each activated dbus service gets its own unit and systemd-cgls lists tmux as part of dbus-org.gnome.Germinal.service

If for some reason I close my terminal, and launch it again, with dbus-daemon the old tmux session gets attached as it still lives as part of dbus.service, whilst with dbus-broker all the process are killed as part of the service, so I get a new tmux session.

What would be the right way of making that work with dbus-broker correctly?

dbus-broker user instances shouldnt try to log to audit

unlike the dbus-broker system instance, user instances arent allowed to log to audit.

therefore user instances shouldnt try to log to audit, and instead log to regular places like journal

to reproduce the issue on fedora:

  1. echo "(auditallow domain domain (dbus (all)))" > mytest.cil && semodule -i mytest.cil
  2. $ busctl --user
  3. journalctl -rb | grep -i granted

note how the journal is polluted by messages that audit blocked messages unpriv dbus-broker instances

systemd faced similar issue and that was dealt with not log ago so you should be able to get some inspiration from their fix (unfortunatly i wasnt able to find the issue/commit on github since their search facility seemingly requires a PhD)

still can't boot fedora 26

just built from master :

Sep 01 23:37:11 sheepora-X220 auditd[609]: Error setting audit daemon pid (Invalid argument)
Sep 02 01:37:44 sheepora-X220 kernel: RAS: Correctable Errors collector initialized.
Sep 01 23:37:46 sheepora-X220 kernel: iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-6000-6.ucode failed with error -2
Sep 01 23:37:46 sheepora-X220 kernel: iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-6000-5.ucode failed with error -2
Sep 01 23:37:47 sheepora-X220 dbus-broker-launch[642]: Reply/Error policy in /usr/share/dbus-1/system.conf +56: Explicit policies on replies and error
s are deprecated and ignored
Sep 01 23:37:47 sheepora-X220 dbus-broker-launch[642]: Reply/Error policy in /usr/share/dbus-1/system.conf +57: Explicit policies on replies and error
s are deprecated and ignored
Sep 01 23:37:47 sheepora-X220 dbus-broker-launch[642]: Reply/Error policy in /usr/share/dbus-1/system.conf +61: Explicit policies on replies and error
s are deprecated and ignored
Sep 01 23:37:47 sheepora-X220 dbus-broker-launch[642]: Reply/Error policy in /usr/share/dbus-1/system.conf +62: Explicit policies on replies and error
s are deprecated and ignored
Sep 01 23:37:48 sheepora-X220 gdm[726]: GdmLocalDisplayFactory: Failed to issue method call: GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: Co
uld not activate remote peer.
Sep 01 23:37:48 sheepora-X220 libvirtd[719]: 2017-09-01 21:37:48.819+0000: 777: error : virNodeSuspendSupportsTarget:336 : internal error: Cannot probe for supported suspend types

Why is Linux 4.10 needed?

The README file calls out Linux kernel >= 4.10 as a requirement. Does dbus-broker use some feature that landed in 4.10?

I am currently on the 4.9 stable series, and I would prefer not to jump off it if possible.

Build depends on git?

[   20s] + /usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/lib --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload . build
[   20s] Traceback (most recent call last):
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 338, in run
[   20s]     app.generate()
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 181, in generate
[   20s]     intr.run()
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreter.py", line 2728, in run
[   20s]     super().run()
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 148, in run
[   20s]     self.evaluate_codeblock(self.ast, start=1)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 170, in evaluate_codeblock
[   20s]     raise e
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 164, in evaluate_codeblock
[   20s]     self.evaluate_statement(cur)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 177, in evaluate_statement
[   20s]     return self.assignment(cur)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 572, in assignment
[   20s]     value = self.evaluate_statement(node.value)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 175, in evaluate_statement
[   20s]     return self.function_call(cur)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 385, in function_call
[   20s]     return self.funcs[func_name](node, self.flatten(posargs), kwargs)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 77, in wrapped
[   20s]     return f(s, node_or_state, args, kwargs)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 55, in wrapped
[   20s]     return f(self, node, args, kwargs)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreter.py", line 1625, in func_subproject
[   20s]     return self.do_subproject(dirname, kwargs)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/interpreter.py", line 1637, in do_subproject
[   20s]     resolved = r.resolve(dirname)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/wrap/wrap.py", line 123, in resolve
[   20s]     if self.resolve_git_submodule(dirname):
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/wrap/wrap.py", line 154, in resolve_git_submodule
[   20s]     ret, out = quiet_git(['rev-parse'], self.subdir_root)
[   20s]   File "/usr/lib/python3.6/site-packages/mesonbuild/wrap/wrap.py", line 43, in quiet_git
[   20s]     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
[   20s]   File "/usr/lib64/python3.6/subprocess.py", line 707, in __init__
[   20s]     restore_signals, start_new_session)
[   20s]   File "/usr/lib64/python3.6/subprocess.py", line 1333, in _execute_child
[   20s]     raise child_exception_type(errno_num, err_msg)
[   20s] FileNotFoundError: [Errno 2] No such file or directory: 'git'
[   20s] The Meson build system
[   20s] Version: 0.42.0
[   20s] Source dir: /home/abuild/rpmbuild/BUILD/dbus-broker-4
[   20s] Build dir: /home/abuild/rpmbuild/BUILD/dbus-broker-4/build
[   20s] Build type: native build
[   20s] Project name: dbus-broker
[   20s] Native C compiler: cc (gcc 7.2.1)
[   20s] Appending CFLAGS from environment: '-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g'
[   20s] Build machine cpu family: x86_64
[   20s] Build machine cpu: x86_64
[   20s] error: Bad exit status from /var/tmp/rpm-tmp.5TOu6B (%build)

Build fails with system c-dvar - missing c-dvar-type.h

When c-dvar is installed systemwide as a shared library, dbus-broker fails to build with the following error:

FAILED: src/dbus-broker-private@sta/bus_driver.c.o
x86_64-pc-linux-gnu-gcc  -Isrc/dbus-broker-private@sta -Isrc -I../dbus-broker-3/src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=c11 -D_GNU_SOURCE -DPACKAGE_VERSION=3 -O2 -march=amdfam10 -fPIC -fvisibility=hidden -fno-common -MMD -MQ 'src/dbus-broker-private@sta/bus_driver.c.o' -MF 'src/dbus-broker-private@sta/bus_driver.c.o.d' -o 'src/dbus-broker-private@sta/bus_driver.c.o' -c ../dbus-broker-3/src/bus/driver.c
../dbus-broker-3/src/bus/driver.c:6:25: fatal error: c-dvar-type.h: No such file or directory
 #include <c-dvar-type.h>
                         ^
compilation terminated.

dbus-broker timeouts during system startup

On minimal Fedora 28 Server installation with package from updates-testing repo (dbus-broker-13-1.fc28.x86_64), dbus-broker timeouts during system startup by waiting for NSS to resolve UID of gdm which in minimal installation is not present.

May 07 02:07:31 node01 systemd[1]: Starting D-Bus System Message Bus...
May 07 02:07:31 node01 dbus-broker-launch[406]: Looking up UID for user 'gdm' over NSS...
May 07 02:09:01 node01 systemd[1]: dbus-broker.service: Start operation timed out. Terminating.
May 07 02:10:31 node01 systemd[1]: dbus-broker.service: State 'stop-sigterm' timed out. Killing.
May 07 02:10:31 node01 systemd[1]: dbus-broker.service: Killing process 406 (dbus-broker-lau) with signal SIGKILL.
May 07 02:10:31 node01 systemd[1]: dbus-broker.service: Failed with result 'timeout'.
May 07 02:10:31 node01 systemd[1]: Failed to start D-Bus System Message Bus.
May 07 02:10:31 node01 systemd[1]: dbus-broker.service: Consumed 13ms CPU time

fails to boot

v3 installed by copr repo fails to boot my fedora 26 on a thinkpad x220

org.freedesktop.DBus.ReloadConfig missing

dbus-daemon provides a ReloadConfig method. With dbus-broker I get:

# dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
Error org.freedesktop.DBus.Error.UnknownMethod: Invalid method call

Would it make sense to provide compatibility with the reference implementation in that regard?

activation_deinit: Assertion `c_list_is_empty(&activation->activation_messages)' failed.

Failed to login into a system with user instance of dbus-broker enabled.
Arch Linux
kernel 4.12.8-2-ARCH
dbus-broker 3-1 from AUR

…
Aug 23 17:02:42 NekLaptop systemd[692]: Started D-Bus User Message Bus.
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Listening on inherited socket
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.freedesktop.impl.portal.PermissionStore.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.xfce.Tumbler.Manager1.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.xfce.calendar.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.kde.kioexecd.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.gnome.evolution.dataserver.UserPrompter.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.xfce.Thunar.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.gnome.Identity.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.kde.kwalletd5.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.kde.kiod5.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.a11y.Bus.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.gnome.evolution.dataserver.Calendar.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.gnome.evolution.dataserver.AddressBook.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.gnome.FileRoller.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.gnome.OnlineAccounts.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Loading service '/usr/share/dbus-1/services/org.xfce.orage.service'
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: dbus-broker: ../dbus-broker/src/bus/activation.c:72: activation_deinit: Assertion `c_list_is_empty(&activation->activation_messages)' failed.
Aug 23 17:02:42 NekLaptop systemd[1]: Created slice system-systemd\x2dcoredump.slice.
Aug 23 17:02:42 NekLaptop systemd[1]: Started Process Core Dump (PID 877/UID 0).
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: ERROR manager_load_service @ ../dbus-broker/src/launch/main.c +653: Connection reset by peer
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]:       manager_load_services @ ../dbus-broker/src/launch/main.c +714
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]:       manager_run @ ../dbus-broker/src/launch/main.c +856
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]:       run @ ../dbus-broker/src/launch/main.c +1021
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]:       main @ ../dbus-broker/src/launch/main.c +1054
Aug 23 17:02:42 NekLaptop dbus-broker-launch[875]: Exiting due to fatal error: -104
Aug 23 17:02:42 NekLaptop systemd-coredump[878]: Process 876 (dbus-broker) of user 1000 dumped core.
                                                 
                                                 Stack trace of thread 876:
                                                 #0  0x00007f3e123d88c0 raise (libc.so.6)
                                                 #1  0x00007f3e123d9f72 abort (libc.so.6)
                                                 #2  0x00007f3e123d15be __assert_fail_base (libc.so.6)
                                                 #3  0x00007f3e123d1633 __assert_fail (libc.so.6)
                                                 #4  0x000055b9f082c719 n/a (dbus-broker)
                                                 #5  0x000055b9f08329f3 n/a (dbus-broker)
                                                 #6  0x000055b9f0828f17 n/a (dbus-broker)
                                                 #7  0x000055b9f0830e03 n/a (dbus-broker)
                                                 #8  0x000055b9f082af64 n/a (dbus-broker)
                                                 #9  0x000055b9f08219b4 n/a (dbus-broker)
                                                 #10 0x00007f3e123c54ca __libc_start_main (libc.so.6)
                                                 #11 0x000055b9f082240a n/a (dbus-broker)
…
Aug 23 17:03:07 NekLaptop systemd[692]: Failed to subscribe to activation signal: Connection timed out
Aug 23 17:03:07 NekLaptop systemd[692]: Failed to register name: Connection timed out
Aug 23 17:03:07 NekLaptop systemd[692]: Failed to set up API bus: Connection timed out
Aug 23 17:03:07 NekLaptop systemd[692]: dbus-broker.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 17:03:07 NekLaptop systemd[692]: dbus-broker.service: Unit entered failed state.
Aug 23 17:03:07 NekLaptop systemd[692]: dbus-broker.service: Failed with result 'exit-code'.
Aug 23 17:03:07 NekLaptop systemd[692]: Looping too fast. Throttling execution a little.
…

cant build on systems without systemd

build fails with

Meson encountered an error in file meson.build, line 41, column 8:
Native dependency 'libsystemd' not found

on systems with different init procedures.

dbus-broker should not depend on systemd.

Driver API test failure

Our tinderbox ran into a test failure on dbus-broker v9.

33/34 dbus-broker / Driver API                FAIL     0.12 s

--- command ---
/var/tmp/portage/sys-apps/dbus-broker-9/work/dbus-broker-9-build/test/dbus/test-driver
--- stderr ---
test-driver: ../dbus-broker-9/test/dbus/util-broker.c:466: util_broker_terminate: Assertion `!value' failed.
-------

A full build log is attached to the Gentoo bug report: https://bugs.gentoo.org/640876

I am unable to reproduce the failure myself, but perhaps you can provide some ideas to further diagnose it.

Problem parsing Exec= lines with quotes in dbus service files

While investigating why certain gnome-shell extension didn't work when using dbus-broker, I discovered an issue with dbus .service files, where the command in the Exec= line contains quotes.

I confirmed the issue using dbus services with the following Exec= lines, each of which should send a notification with TEST in the notification title when activated. I used gdbus wait --session --activate <service> for service activation.

These two work without issue:

Exec=/bin/notify-send TEST
Exec=/bin/env notify-send TEST

The following sends the notification, but the quotation marks follow to the notification, i.e. notification title becomes "TEST", while it should still be TEST without quotations:

Exec=/bin/notify-send "TEST"

With this one, the command doesn't seem to execute at all. The behavior appears to be the same with any service, where the Exec= line contains a command with space somewhere between the quotation marks. This is also causing the issue with the gnome-shell extension mentioned above:

Exec=/bin/sh -c "notify-send TEST"

All of the above work as intended when dbus-broker is disabled.
Tested with dbus-broker v13.

Request to own name refused by policy when you add a policy at runtime

On a running system with dbus-broker when you install a package that acquires a name on the bus and installs a system.d/ policy.conf then access is denied (probably because dbus-broker isnt aware of the newly installed policy file):

DBusException: org.freedesktop.DBus.Error.AccessDenied: Request to own name refused by policy

To reproduce:

dnf install tuned
systemctl enable tuned
systemctl start tuned

(watch it hang until it times out trying to get a name on the bus)

A reboot fixes the issue (probably because dbus-broker re-reads /etc/dbus-1/

fails to build ../src/util/selinux.c:152:36: error: ‘C_RBTREE_INIT’ undeclared (first use in this function); did you mean ‘C_RBNODE_INIT’?

$ meson build
The Meson build system
Version: 0.41.2
Source dir: /home/michael/git/dbus-broker
Build dir: /home/michael/git/dbus-broker/build
Build type: native build
Project name: dbus-broker
Native c compiler: cc (gcc 7.2.0)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29)

Executing subproject c-dvar.

Project name: c-dvar
Native c compiler: cc (gcc 7.2.0)
Dependency libdbus-typenum found: NO
Build targets in project: 7

Subproject c-dvar finished.
Found a fallback subproject subprojects/c-dvar for libcdvar

Executing subproject c-list.

Project name: c-rbtree
Native c compiler: cc (gcc 7.2.0)
Build targets in project: 9

Subproject c-list finished.
Found a fallback subproject subprojects/c-list for libclist

Executing subproject c-rbtree.

Project name: c-rbtree
Native c compiler: cc (gcc 7.2.0)
Build targets in project: 16

Subproject c-rbtree finished.
Found a fallback subproject subprojects/c-rbtree for libcrbtree

Executing subproject c-sundry.

Project name: c-sundry
Native c compiler: cc (gcc 7.2.0)
Build targets in project: 19

Subproject c-sundry finished.
Found a fallback subproject subprojects/c-sundry for libcsundry
Native dependency dbus-1 found: YES 1.10.22
Native dependency glib-2.0 found: YES 2.53.6
Native dependency libselinux found: YES 2.6
Native dependency libsystemd found: YES 234
Library m found: YES
Native dependency systemd found: YES 234
Dependency threads found: YES
Native dependency expat found: YES 2.2.3
Configuring dbus-broker.service using configuration
Configuring dbus-broker.service using configuration
Build targets in project: 41


$ ninja -C build/
ninja: Entering directory `build/'
[28/114] Compiling C object 'src/dbus-broker-private@sta/util_selinux.c.o'.
FAILED: src/dbus-broker-private@sta/util_selinux.c.o 
cc  -Isrc/dbus-broker-private@sta -Isrc -I../src -Isubprojects/c-dvar/src -I../subprojects/c-dvar/src -Isubprojects/c-list/src -I../subprojects/c-list/src -Isubprojects/c-rbtree/src -I../subprojects/c-rbtree/src -Isubprojects/c-sundry/src -I../subprojects/c-sundry/src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -O0 -g -D_GNU_SOURCE -DPACKAGE_VERSION=3 -fPIC -fvisibility=hidden -fno-common -MMD -MQ 'src/dbus-broker-private@sta/util_selinux.c.o' -MF 'src/dbus-broker-private@sta/util_selinux.c.o.d' -o 'src/dbus-broker-private@sta/util_selinux.c.o' -c ../src/util/selinux.c
../src/util/selinux.c: In function ‘bus_selinux_registry_new’:
../src/util/selinux.c:152:36: error: ‘C_RBTREE_INIT’ undeclared (first use in this function); did you mean ‘C_RBNODE_INIT’?
         registry->names = (CRBTree)C_RBTREE_INIT;
                                    ^~~~~~~~~~~~~
                                    C_RBNODE_INIT
../src/util/selinux.c:152:36: note: each undeclared identifier is reported only once for each function it appears in
../src/util/selinux.c: In function ‘bus_selinux_registry_free’:
../src/util/selinux.c:163:9: warning: implicit declaration of function ‘c_rbtree_for_each_entry_unlink’; did you mean ‘c_rbtree_find_entry’? [-Wimplicit-function-declaration]
         c_rbtree_for_each_entry_unlink(name, name_safe, &registry->names, rb)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         c_rbtree_find_entry
../src/util/selinux.c:163:75: error: ‘rb’ undeclared (first use in this function)
         c_rbtree_for_each_entry_unlink(name, name_safe, &registry->names, rb)
                                                                           ^~
../src/util/selinux.c:164:17: error: expected ‘;’ before ‘bus_selinux_name_free’
                 bus_selinux_name_free(name);
                 ^~~~~~~~~~~~~~~~~~~~~
[33/114] Generating symbol file 'subprojects/c-rbtree/src/crbtree@sha/subprojects/c-rbtree/src/libcrbtree.so.0.symbols'.
ninja: build stopped: subcommand failed.

Small difference in behaviour from dbus-daemon

After a day running dbus-broker as a session bus, I only noticed that little difference:

I have a gnome-shell extension which uses a GDBusProxy to start and interact with a daemon. It contains a switch representing the state of a boolean dbus property from the daemon.
If the default state from the daemon is "on", with dbus-daemon, the switch is on too, as expected, but with dbus-broker it appears off. If I explicitely re-set the dbus property to true and the PropertiesChanged signal is emitted, the switch is now on as expected.

I'm not sure if I'm clear enough, but fwiw, during the kdbus days I had exactly the same issue for a long time.

Please use audit to log SELinux denials

Hello,

I was quickly looking at the code and I can see that you are using avc_has_perm_noaudit() this means that dbus-broker will not log SELinux denials.

Ideally, everything that is denied by SELinux must be logged using the audit framework. Could you please use the avc_has_perm() variant and log to audit?

dbus-broker-launch does not respect XDG_DATA_DIRS

My first attempt at working around #38 was to create an empty file /usr/local/share/dbus-1/services/org.kde.dolphin.FileManager1.service

It seems though as if dbus-broker-launch completely ignores any paths set via XDG_DATA_DIRS and only looks at /usr/share/dbus-1/services.

make test error

ERROR driver_send_reply @ ../src/driver.c +416: State not recoverable
driver_method_get_connection_selinux_security_context @ ../src/driver.c +1226
driver_handle_method @ ../src/driver.c +1554
driver_dispatch_internal @ ../src/driver.c +1752
driver_dispatch @ ../src/driver.c +1881
peer_dispatch @ ../src/peer.c +73
dispatch_context_dispatch @ ../src/util/dispatch.c +203
manager_run @ ../src/broker/manager.c +202
test-driver: ../src/broker/test-driver.c:758: test_driver_api: Assertion `r >= 0' failed.
run @ ../src/broker/main.c +123
main @ ../src/broker/main.c +136
Exiting due to fatal error: -131

systemd-login fails to start when dbus-broker is enabled

I had a similar problem when messagebus group was not in /etc/group and /etc/passwd (not from dbus-broker)
This is on Gentoo, Linux-4.9.44, Systemd-234, dbus-1.10.22
with dbus-broker commit cf08097

....
systemd-logind[439]: Failed to add match for JobRemoved: Connection timed out
systemd-logind[439]: Failed to fully start up daemon: Connection timed out
systemd[1]: Failed to subscribe to NameOwnerChanged signal for 'org.freedesktop.login1': Connection timed out
systemd[1]: Failed to subscribe to NameOwnerChanged signal for 'org.freedesktop.NetworkManager': Connection timed out
systemd[1]: Failed to subscribe to activation signal: Connection timed out
systemd[1]: Failed to register name: Connection timed out
systemd[1]: Failed to set up API bus: Connection timed out
....
systemd[1]: systemd-logind.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Login Service.
systemd[1]: systemd-logind.service: Unit entered failed state.
systemd[1]: systemd-logind.service: Failed with result 'exit-code'.
....

What I did:

~ # systemctl enable dbus-broker.service
~ # systemctl reboot

dbus-broker-launch fails to start if service file name does not match dbus name

After working around #38 by moving org.kde.dolphin.FileManager1.service away, I still get failures trying to start dbus-broker in the user session. This time the error message is:

Aug 28 02:52:27 pluto systemd[1820]: Started D-Bus User Message Bus.
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Listening on inherited socket
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.Metadata.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Epiphany.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Weather.BackgroundService.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kdesvnd.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Software.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kscreen.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.taquin.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kssld5.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Telepathy.Client.Vino.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.zeitgeist.Engine.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.GoaVolumeMonitor.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Documents.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.AfcVolumeMonitor.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Dictionary.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.ColorHelper.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.hexchat.service.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Sushi.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.knotify.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.impl.portal.desktop.gtk.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.systemd1.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Todo.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/ca.desrt.dconf-editor.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Rhythmbox3.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.fedoraproject.Config.Printing.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Tracker1.Writeback.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Contacts.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.portal.Desktop.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.evolution.dataserver.Calendar.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.ControlCenter.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.MTPVolumeMonitor.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.Daemon.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.impl.portal.PermissionStore.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.fontinst.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Cheese.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.keyring.SystemPrompter.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.GConf.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.a11y.Bus.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kwalletd5.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Calculator.SearchProvider.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Photos.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.knopwob.dunst.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Rygel1.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Logs.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Userguides.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.OnlineMiners.Facebook.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Weather.Application.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.keyring.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Shell.PortalHelper.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kglobalaccel.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.seahorse.Application.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/us.kirkland.terminals.byobu.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Characters.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Totem.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.evince.Daemon.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Flatpak.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/com.gexperts.Tilix.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/com.intel.dleyna-server.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Telepathy.Client.Logger.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.seahorse.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.gedit.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.evolution.dataserver.Sources.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Files.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.OnlineAccounts.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Telepathy.Logger.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Camera.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kpasswdserver.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gtk.vfs.UDisks2VolumeMonitor.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kuiserver.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Shell.HotplugSniffer.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.DiskUtility.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kwalletd.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.evolution.dataserver.UserPrompter.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.keyring.PrivatePrompter.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Books.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Applications.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Caribou.Daemon.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.baobab.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kiod5.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.ChromeGnomeShell.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.secrets.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.zeitgeist.SimpleIndexer.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Shell.CalendarServer.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.OnlineMiners.Zpj.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Telepathy.Client.Vinagre.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.jackaudio.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Calendar.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.OnlineMiners.MediaServer.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.Terminal.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.font-viewer.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.kde.kded5.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Extract.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/org.gnome.FileRoller.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Loading service '/usr/share/dbus-1/services/kf5_org.kde.kuiserver.service'
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: ERROR manager_load_service @ ../src/launch/main.c +653: Input/output error
Aug 28 02:52:27 pluto dbus-broker-launch[1857]:       manager_load_services @ ../src/launch/main.c +714
Aug 28 02:52:27 pluto dbus-broker-launch[1857]:       manager_run @ ../src/launch/main.c +856
Aug 28 02:52:27 pluto dbus-broker-launch[1857]:       run @ ../src/launch/main.c +1021
Aug 28 02:52:27 pluto dbus-broker-launch[1857]:       main @ ../src/launch/main.c +1054
Aug 28 02:52:27 pluto dbus-broker-launch[1857]: Exiting due to fatal error: -5
Aug 28 02:52:52 pluto systemd[1820]: dbus-broker.service: Main process exited, code=exited, status=1/FAILURE
Aug 28 02:52:52 pluto systemd[1820]: dbus-broker.service: Unit entered failed state.
Aug 28 02:52:52 pluto systemd[1820]: dbus-broker.service: Failed with result 'exit-code'.

Looking at the offending file:

$ cat /usr/share/dbus-1/services/kf5_org.kde.kuiserver.service 
[D-BUS Service]
Name=org.kde.kuiserver
Exec=/usr/bin/kuiserver5

This is arguably an issue with the service file which should be named after the dbus name. Not entirely sure if that is required by the spec or not. In any case, dbus-broker-launch should handle this more gracefully (again, logging an error message and ignoring the file seems like a possible solution).

Subprocesses spawned by services get killed on service exit

When services spawn subprocesses, because systemd defaults to KillMode=control-group, these processes get killed as well when the main process exits.

This is unfortunate as it also applies to applications spawned when e.g. opening files in Nautilus or via Nautilus' search provider.

If the D-Bus service configures a SystemdService, this can be fixed by setting KillMode=process in the unit file. So far, so good.

However, this does not work for the transient units generated by dbus-broker; supplying KillMode process results in a different problem: If the control group still exists, starting the transient unit will fail.

build fails on debian 9.x

It fails in the ninja step.
{standard input}: Assembler messages:
{standard input}:12630: Warning: end of file not at end of a line; newline inserted
{standard input}:13456: Error: unknown pseudo-op: `.'
{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive
cc: internal compiler error: Terminated (program cc1)

Any ideas? I'm stumped.

Here is the complete build output.

debian@beaglebone:~/dbus-broker/dbus-broker/build$ /usr/local/bin/meson setup
The Meson build system
Version: 0.46.0
Source dir: /home/debian/dbus-broker/dbus-broker
Build dir: /home/debian/dbus-broker/dbus-broker/build
Build type: native build
Project name: dbus-broker
Native C compiler: cc (gcc 6.3.0 "cc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516")
Build machine cpu family: arm
Build machine cpu: armv7l
Program rst2man found: YES (/usr/bin/rst2man)

|
|Executing subproject c-dvar.
|
|Project name: c-dvar
|Native C compiler: cc (gcc 6.3.0 "cc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516")
|
||
||Executing subproject c-utf8.
||
||Project name: c-utf8
||Native C compiler: cc (gcc 6.3.0 "cc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516")
||Build targets in project: 6
||
||Subproject c-utf8 finished.
|Found pkg-config: /usr/bin/pkg-config (0.29)
|Dependency libdbus-typenum found: NO
|Build targets in project: 12
|
|Subproject c-dvar finished.

|
|Executing subproject c-list.
|
|Project name: c-list
|Native C compiler: cc (gcc 6.3.0 "cc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516")
|Build targets in project: 15
|
|Subproject c-list finished.

|
|Executing subproject c-rbtree.
|
|Project name: c-rbtree
|Native C compiler: cc (gcc 6.3.0 "cc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516")
|Build targets in project: 23
|
|Subproject c-rbtree finished.

|
|Executing subproject c-sundry.
|
|Project name: c-sundry
|Native C compiler: cc (gcc 6.3.0 "cc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516")
|Build targets in project: 27
|
|Subproject c-sundry finished.
Library m found: YES
Dependency threads found: YES
Native dependency dbus-1 found: YES 1.10.26
Native dependency expat found: YES 2.2.0
Native dependency glib-2.0 found: YES 2.50.3
Native dependency libsystemd found: YES 232
Native dependency systemd found: YES 232
Configuring dbus-broker.service using configuration
Configuring dbus-broker.service using configuration
Build targets in project: 52
`Found ninja-1.7.2 at /usr/bin/ninja
debian@beaglebone:~/dbus-broker/dbus-broker/build$ ninja
[8/138] Compiling C object 'subprojects/c-utf8/src/subprojects@c-utf8@src@@bench-ascii@exe/bench-ascii.c.o'.
../subprojects/c-utf8/src/bench-ascii.c: In function ‘test_trivial_utf8’:
../subprojects/c-utf8/src/bench-ascii.c:30:65: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
         fprintf(stderr, "UTF-8 verify ASCII string (trivial): %lu MB/s\n", n_string * 1000 * 1000 * 1000 / 1024 / 1024 / (test_get_time() - ts));
                                                                 ^
../subprojects/c-utf8/src/bench-ascii.c: In function ‘test_utf8’:
../subprojects/c-utf8/src/bench-ascii.c:40:55: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
         fprintf(stderr, "UTF-8 verify ASCII string: %lu MB/s\n", n_string * 1000 * 1000 * 1000 / 1024 / 1024 / (test_get_time() - ts));
                                                       ^
../subprojects/c-utf8/src/bench-ascii.c: In function ‘test_strlen’:
../subprojects/c-utf8/src/bench-ascii.c:50:54: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
         fprintf(stderr, "strlen() of ASCII string: %lu MB/s\n", n_string * 1000 * 1000 * 1000 / 1024 / 1024 / (test_get_time() - ts));
                                                      ^
[10/138] Compiling C object 'subprojects/c-utf8/src/subprojects@c-utf8@src@@bench-multibyte@exe/bench-multibyte.c.o'.
../subprojects/c-utf8/src/bench-multibyte.c: In function ‘test_trivial_utf8’:
../subprojects/c-utf8/src/bench-multibyte.c:30:82: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
         fprintf(stderr, "UTF-8 verify string of %zu-byte characters (trivial): %lu Mchar/s\n", n_bytes, n_string / n_bytes * 1000 * 1000 * 1000 / 1024 / 1024 / (test_get_time() - ts));
                                                                                  ^
../subprojects/c-utf8/src/bench-multibyte.c: In function ‘test_utf8’:
../subprojects/c-utf8/src/bench-multibyte.c:40:72: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
         fprintf(stderr, "UTF-8 verify string of %zu-byte characters: %lu Mchar/s\n", n_bytes, n_string / n_bytes * 1000 * 1000 * 1000 / 1024 / 1024 / (test_get_time() - ts));
                                                                        ^
[70/138] Compiling C object 'src/src@@bus-static@sta/bus_driver.c.o'.
FAILED: src/src@@bus-static@sta/bus_driver.c.o
cc -Isrc/src@@bus-static@sta -Isrc -I../src -Isubprojects/c-dvar/src -I../subprojects/c-dvar/src -Isubprojects/c-list/src -I../subprojects/c-list/src -Isubprojects/c-rbtree/src -I../subprojects/c-rbtree/src -Isubprojects/c-sundry/src -I../subprojects/c-sundry/src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -O0 -g -D_GNU_SOURCE -DPACKAGE_VERSION=11 '-DBINDIR="/usr/local/bin"' -DSYSTEMUIDMAX=999 -DSYSTEM_CONSOLE_USERS= -fPIC -fvisibility=hidden -fno-common  -MD -MQ 'src/src@@bus-static@sta/bus_driver.c.o' -MF 'src/src@@bus-static@sta/bus_driver.c.o.d' -o 'src/src@@bus-static@sta/bus_driver.c.o' -c ../src/bus/driver.c
{standard input}: Assembler messages:
{standard input}:12630: Warning: end of file not at end of a line; newline inserted
{standard input}:13456: Error: unknown pseudo-op: `.'
{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive
cc: internal compiler error: Terminated (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
[71/138] Compiling C object 'src/src@@bus-static@sta/dbus_message.c.o'.
ninja: build stopped: subcommand failed.
debian@beaglebone:~/dbus-broker/dbus-broker/build$

[RFC] Workarounds for at_console=

So at_console= is deprecated upstream, and I don't see us implementing it. We decided against it in the past [1] and I am unaware of a solution to the problems described.

In short: Implementing it requires running a custom hook on EVERY message transaction. This is a no-go for dbus-broker.

Now, while ignoring it works mostly fine, there still remain users of it. Namely, BlueZ, ConnMan, OFono, and more [2]. All of them are already on the debian-lintian bug-list, but they remain unfixed until today. While we can commit to fixing those, I'd rather first consider possible workarounds. Before doing so, lets summarize how at_console works:

The at_console= feature adds two mutually exclusive policy contexts. Depending whether a connection is considered at the console, the correct context is picked and pinned with that connection. At Hello(), dbus-daemon(1) invokes one of several callbacks to determine whether a connection is at the console. If systemd is used, it resolves to sd_uid_get_seats() returning at least one seat. This means, if the uid of the connection is logged in on at least one physical seat at the time of Hello(), it is considered at the console.

Possible workarounds in the comments. Lets keep this issue open to track this.

[1] https://github.com/bus1/dbus-broker/wiki/Deviations
[2] https://lintian.debian.org/tags/dbus-policy-at-console.html

Required minimum meson version is 0.44

The newly introduced system-console-users build option is of type array which is supported starting from meson 0.44 while the README still lists meson 0.42 as the minimum required version.

Assertion failure in activation_free

#0  0x00007fc6f8fa7620 in raise () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6                            
No symbol table info available.                                                                           
#1  0x00007fc6f8fa8ca0 in abort () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6                            
No symbol table info available.                                                                           
#2  0x00007fc6f8fa045a in __assert_fail_base () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6               
No symbol table info available.                                                                           
#3  0x00007fc6f8fa04d2 in __assert_fail () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6                    
No symbol table info available.                                                                           
#4  0x000000000040bc09 in activation_free (activation=0xc60a20) at ../dbus-broker-scm/src/activation.c:71 
        __PRETTY_FUNCTION__ = "activation_free"                                                           
#5  0x000000000040bf28 in activation_registry_flush (registry=0xc5f058) at ../dbus-broker-scm/src/activation.c:141                                                                                                   
        activation = 0xc60a20                                                                             
        safe = 0x0                                                                                        
#6  0x0000000000404cc8 in manager_run (manager=0xc5f010) at ../dbus-broker-scm/src/broker/manager.c:218   
        signew = {__val = {16386, 0 <repeats 15 times>}}                                                  
        sigold = {__val = {81922, 12972376, 0, 0, 4307939624, 140725417619688, 140725417619744, 4213473, 30064771072, 140725417619760, 16386, 0, 0, 0, 0, 0}}                                                        
        listener = 0x0                                                                                    
        safe = 0x7ffd30873268                                                                             
        r = -131                                                                                          
        __func__ = "manager_run"                                                                          
#7  0x0000000000403e1f in run () at ../dbus-broker-scm/src/broker/main.c:121                              
        manager = 0xc5f010                                                                                
        r = 0                                                                                             
        __func__ = "run"                                                                                  
#8  0x0000000000403e9b in main (argc=4, argv=0x7ffd30873268) at ../dbus-broker-scm/src/broker/main.c:133  
        r = 0                                                                                             
        __func__ = "main"                                         

activation of a masked unit results in long timeout

Description:
After I switched to dbus-broker, logging in to Gnome Shell takes a long time (tens of seconds), and so does starting any application. I traced the problem to activation of masked units. Instead of failing immediately, such activation requests time out.

Steps to reproduce:
systemctl --user mask --now at-spi-dbus-bus.service
time busctl --user get-property org.a11y.Bus /org/a11y/bus org.a11y.Status ScreenReaderEnabled

Actual result:
Connection timed out
real 0m25.032s

Expected result (actual result when using dbus-daemon):
Unit at-spi-dbus-bus.service is masked.
real 0m0.005s

Additional information:
dbus-broker-launch sends the activation request signal ("org.freedesktop.systemd1.Activator", "ActivationRequest") to systemd, but it implements no handling of systemd's signal about the activation failure ("org.freedesktop.systemd1.Activator", "ActivationFailure").

Tests fail

Which kernel version is needed at least to have SO_PEERGROUPS support?

I've compiled dbus-broker-git. Tests 28 and 34 failed. Here is my testlog:

testlog.txt

SO_PEERSEC test fails when ran in a ptrace-based sandbox

All our builds are sandboxed using ptrace and seccomp, and for some reason this test fails. Disabling the sadbox allows it to pass.
Relevant log:

test-peersec: ../dbus-broker-scm/src/util/test-peersec.c:147: test_peersec: Assertion `!r' failed.

typos in the wiki pages

I spotted a few typos in the wiki pages. It is not possible to send pull requests for those so I will attach a diff here for my fixes for the obvious cases.

In the section "Method calls" in the Reliability pages the last sentence does not make sense. Not sure what to do with that so no fix:

If, in turn, the error from the driver cannot be delivered, this is handled, as described in the nelike any other error message, as

https://github.com/bus1/dbus-broker/wiki/Reliability#method-calls

Is system-console-users sustainable?

Hi, I'm wondering about new build option system-console-users which needs every display manager system user provided as an argument.

If I understand this correctly every distro package have to provide all known relevant system-users (mostly used by display managers) at build time. Is this option sustainable knowing there are many display managers (gdm,sddm,lightdm, etc.) which can be configured with specific system user account? Does dbus-broker maintainers have to know them all beforehand?

Moreover if someone want to change those users they have to rebuild dbus-broker on their own. If someone want to use display manager unsupported by distro, they have to rebuild dbus-broker again.

Having system-console-users as build-time option isn't sustainable in my opinion. Runtime option will be better or some other solution.

Disclaimer: upgrading to v11 broke my display manager.

Support restarting dbus-broker

Filing this to summarize our in-person conversations during DevConf and track any required work. Please let me know if I got anything wrong.

Currently restarting dbus-broker disconnects all clients from the bus. This mimics dbus-daemon behavior, and in fact dbus-daemon upstream recommends never restarting the daemon and rebooting the system instead. This is problematic for server deployments where reboots can be expensive, especially in case one needs to widely roll out a security update quickly. The scenarios are:

  • support restarting a running dbus-broker service; this requires essentially checkpointing the current state (fds, connections, in flight messages, etc.) for the new process to restore
  • support restarting dbus-broker after a bugfix/security update; this also requires updating the checkpointed state with any changes the new version might require
  • support restarting dbus-broker after a major/feature update; this is an extension of the previous case

One way to handle this could be the "zero-downtime restart" approach where the old process forks off the new one, then stops accepting new connections and self terminates when it's done handling in-flight ones (nginx or haproxy are examples of this), using sd_notify to make systemd aware of the change; however, due to the nature of dbus this can potentially take an unbounded amount of time, so it may not be feasible in practice.

GNOME Bluetooth settings break

When the system broker is in use, the Bluetooth panel in the GNOME Control Center is unusable. Also, it seems Bluetooth isn't enabled with the session even if it should be. The Shell can still control Bluetooth, though.

I see the following message in the journal: gnome-bluetooth-panel.desktop[17923]: Agent registration failed: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Sender is not authorized to send message

obexd also repeatedly complains about AccessDenied.

dbus-broker v1
GNOME 3.24
Arch Linux x86_64

Fedora 26 does not boot with dbus-broker

Once dbus-broker is enabled for root and users, Fedora 26 does not boot anymore.

The following messages appear in the log:

Aug 23 21:27:28 xxxxxxxxxxxxxxxxxxxxxxxxxxx systemd[1]: dbus.socket: Failed to listen on sockets: Permission denied
Aug 23 21:27:28 xxxxxxxxxxxxxxxxxxxxxxxxxxx systemd[1]: dbus-broker.service: Job dbus-broker.service/start failed with result 'dependency'.
Aug 23 21:27:28 xxxxxxxxxxxxxxxxxxxxxxxxxxx systemd[1]: dbus.socket: Unit entered failed state.
Aug 23 21:27:28 xxxxxxxxxxxxxxxxxxxxxxxxxxx libvirtd[778]: 2017-08-23 19:27:28.641+0000: 799: error : virDBusGetSystemBus:109 : internal error: Unable to get DBus system bus connection: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
Aug 23 21:27:28 xxxxxxxxxxxxxxxxxxxxxxxxxxx libvirtd[778]: 2017-08-23 19:27:28.642+0000: 799: warning : networkStateInitialize:787 : DBus not available, disabling firewalld support in bridge_network_driver: internal error: Unable to get DBus system bus connection: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
Aug 23 21:27:56 xxxxxxxxxxxxxxxxxxxxxxxxxxx libvirtd[778]: 2017-08-23 19:27:56.573+0000: 778: error : virDBusGetSystemBus:109 : internal error: Unable to get DBus system bus connection: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory

seamless takeover from dbus-daemon

The documentation mentions that to switch from dbus-daemon to dbus-broker a reboot is required. For systems where rebooting is expensive and/or impractical, it would be useful to have the option to effect a seamless transition where dbus-broker takes over from dbus-daemon on a live system.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.