dbus_bus_request_name():不允许连接拥有该服务

Man*_*ndy 20 linux dbus avahi busybox

我在arm上构建了一个根文件系统.它应该运行dbus-daemon和avahi-daemon,但是当我尝试运行时avahi-daemon

$ dbus-daemon --system
$ avahi-daemon
Run Code Online (Sandbox Code Playgroud)

我收到这条消息:

Found user 'avahi' (UID 4) and group 'avahi' (GID 4).
Successfully dropped root privileges.
avahi-daemon 0.6.28 starting up.
WARNING: No NSS support for mDNS detected, consider installing nss-mdns! 
dbus_bus_request_name(): Connection ":1.0" is not allowed to own the service "org.freedesktop.Avahi" due to security policies in the configuration file
WARNING: Failed to contact D-Bus daemon.
avahi-daemon 0.6.28 exiting.
Run Code Online (Sandbox Code Playgroud)

怎么了?是关于dbus配置吗?

gak*_*gak 23

在我的情况下,我只需要重新启动dbus服务.

这可能是因为avahi插入了一个/etc/dbus-1/system.d/avahi-dbus.conf未自动检测到的dbus配置文件().


Jac*_*zny 15

客户端可以在系统总线上注册什么名称有限制.否则,用户进程可以接收针对某些系统服务的请求.通常通过dbus-daemon配置文件配置限制/etc/dbus-1/system.conf.在标准安装中,此文件包含其他配置文件,尤其/etc/dbus-1/system.d/是存储服务特定配置的目录中的所有配置文件.这样DBus通常配置为Avahi:

我工作站的示例:

$ cat /etc/dbus-1/system.d/avahi-dbus.conf 
<!DOCTYPE busconfig PUBLIC
          "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
          "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <!-- Only root or user avahi can own the Avahi service -->
  <policy user="avahi">
    <allow own="org.freedesktop.Avahi"/>
  </policy>
  <policy user="root">
    <allow own="org.freedesktop.Avahi"/>
  </policy>

  <!-- Allow anyone to invoke methods on Avahi server, except SetHostName -->
  <policy context="default">
    <allow send_destination="org.freedesktop.Avahi"/>
    <allow receive_sender="org.freedesktop.Avahi"/>

    <deny send_destination="org.freedesktop.Avahi"
          send_interface="org.freedesktop.Avahi.Server" send_member="SetHostName"/>
  </policy>

  <!-- Allow everything, including access to SetHostName to users of the group "adm" -->
  <policy group="adm">
    <allow send_destination="org.freedesktop.Avahi"/>
    <allow receive_sender="org.freedesktop.Avahi"/>
  </policy>
  <policy user="root">
    <allow send_destination="org.freedesktop.Avahi"/>
    <allow receive_sender="org.freedesktop.Avahi"/>
  </policy>
</busconfig>
Run Code Online (Sandbox Code Playgroud)

确保您具有这些标准配置文件或适当的自定义配置.


小智 5

我有一个类似的问题,在我的情况下,我的系统数据包系统附带的默认avahi-dbus.conf只是缺少触发此错误的最后一个" </policy>" </busconfig>.

我首先想到的问题不是来自这个文件,因为快速查看它并不足以找到这种语法错误.