dbus-daemon Dan

Yang Chengwei chengwei.yang at intel.com
Mon Aug 26 00:58:47 PDT 2013


On Thu, Aug 22, 2013 at 12:15:24PM +0100, Simon McVittie wrote:
> On 21/08/13 21:58, Thiago Macieira wrote:
> > On quarta-feira, 21 de agosto de 2013 14:37:21, m.roth at 5-cent.us
> > wrote:
> >> We recently upgraded several systems from FC17 to FC19, and now,
> >> in the log, we see on all of them dbus-daemon[pid]: Dan
> 
> This is stdout or stderr output from a non-systemd, activatable
> service (one with a file in /usr/share/dbus-1/system-services that
> does not contain the SystemdService setting). On a sysvinit system, it
> would have gone to /dev/null, but on a systemd system, it gets logged.

Yeah, because the common use case in sysvinit system is running
dbus-daemon as daemon (forked). While in systemd recommended practice,
daemon should not daemonized.

However, one can also configure its dbus.service as with --fork argument
and also change Type=forking and PIDFile=/var/run/messagebus.pid

> 
> Look for files in /usr/share/dbus-1/system-services that do not have a
> SystemdService, then either turn them into systemd services (which
> would let you control their logging individually), or use strings(1)
> to find out which one mentions "Dan".
> 
> > Somehow services launched by the system bus fool syslog into
> > thinking the message comes from the D-Bus daemon. I don't know how
> > that is possible.
> 
> D-Bus-activated system services that are not started via systemd
> inherit stdout and stderr from the system dbus-daemon. On a sysvinit
> system, that means /dev/null, but on a systemd system, the
> dbus-daemon's stdout and stderr go to the Journal, and from there to
> syslog.
> 
> I'd accept patches that made dbus-daemon open a new systemd logging fd
> with sd_journal_stream_fd() and pass it to the activated child process
> as its stdout/stderr, when compiled with systemd support. The right
> place to start looking would be near the end of
> bus_activation_activate_service(), but the actual implementation would
> probably have to be by adding a new parameter to
> _dbus_spawn_async_with_babysitter(). I would suggest
> sd_journal_stream_fd (service_name, LOG_WARNING, FALSE) for stderr and
> sd_journal_stream_fd (service_name, LOG_INFO, FALSE) for stdout.

How about just close 0/1/2 at do exec if it's not daemonized? It just
work straight forward and simple. In addition, after the child started,
it's stdout/stderr will catched by systemd too, and

$ journalctl --unit dbus.service

will print it's child services, just perfect that we know that they're
activated by dbus-daemon.


*Before*

[chengwei at localhost ~]$ journalctl -ab --no-pager -u dbus.service | grep
ModemManager
Aug 26 15:06:01 localhost.bj.intel.com dbus[282]: [system] Activating
service name='org.freedesktop.ModemManager' (using servicehelper)
Aug 26 15:06:01 localhost.bj.intel.com dbus-daemon[282]:
modem-manager[353]: <info>  ModemManager (version 0.6.2.0-1.fc19)
starting...
Aug 26 15:06:01 localhost.bj.intel.com modem-manager[353]: <info>
ModemManager (version 0.6.2.0-1.fc19) starting...
Aug 26 15:06:01 localhost.bj.intel.com dbus[282]: [system] Successfully
activated service 'org.freedesktop.ModemManager'

*After*

[chengwei at localhost ~]$ journalctl -ab --no-pager -u dbus.service | grep
ModemManager
Aug 26 15:48:35 localhost.bj.intel.com dbus[274]: [system] Activating
service name='org.freedesktop.ModemManager'
Aug 26 15:48:35 localhost.bj.intel.com modem-manager[351]: <info>
ModemManager (version 0.6.2.0-1.fc19) starting...
Aug 26 15:48:35 localhost.bj.intel.com dbus[274]: [system] Successfully
activated service 'org.freedesktop.ModemManager'


Also filed a ticked on fd.o.
https://bugs.freedesktop.org/show_bug.cgi?id=68559

--
Thanks,
Chengwei

> 
> Please don't add any extra systemd support code in
> dbus-daemon-launch-helper, which is particularly security-sensitive
> (setuid root).
> 
>     S
> 
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130826/459be8fb/attachment.pgp>


More information about the dbus mailing list