停止 dbus 服务时 g-io-error-quark 39 错误

停止 dbus 服务时 g-io-error-quark 39 错误

当我重新启动特定计算机时出现错误消息,

 # init 6
 Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)

我发现这是服务造成的dbus。我可以通过以下方式显示错误消息

 # systemctl stop dbus.service
 Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)

当然,这一切都是在 root shell 中完成的。

有谁知道这意味着什么以及如何解决它? 我发现这d-bus似乎很少有记录(或者对我来说太复杂,或者两者兼而有之)。

该计算机正在运行 CentOS Linux 版本 7.2.1511 并且是最新的。

答案1

对我来说,这是在 RHEL 7.4 -> 7.5 升级之后发生的。 Dbus 套接字已移至/run/dbus/system_bus_socket.尽管 systemd 明确指出/run/dbus/system_bus_socket它仍然希望通过以下方式连接/var/run/dbus/system_bus_socket

[root@ipsystem]# systemctl restart systemd-logind.service
Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)

注意它正在连接到 /run/dbus/ 套接字:

[root@ip-10-0-254-241 system]# lsof -p `pidof systemd`|grep socket
systemd   1 root   14u     unix 0xffff9385a4507c00      0t0      54528 socket
systemd   1 root   19u     unix 0xffff9385c8411400      0t0      69828 /run/dbus/system_bus_socket
systemd   1 root   21u     unix 0xffff9385c8412800      0t0      78276 socket
systemd   1 root   52u     unix 0xffff9384f1b3bc00      0t0      13426 /run/lvm/lvmpolld.socket
systemd   1 root   71u     unix 0xffff9384f40de000      0t0       9631 /run/systemd/journal/socket
systemd   1 root   75u     unix 0xffff9384f1b28c00      0t0      12918 /run/lvm/lvmetad.socket
[root@ipsystem]# mv /var/run/dbus/system_bus_socket /var/run/dbus/system_bus_socket.old
[root@ipsystem]# systemctl restart dbus NetworkManager
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
[root@ipsystem]# ls -l /var/run/dbus/system_bus_socket
ls: cannot access /var/run/dbus/system_bus_socket: No such file or directory

显然仍在寻找 /var/run/dbus/system_bus_socket。

链接/var/run/dbus/system_bus_socket/run/dbus/system_bus_socket

[root@ipsystem]# ln -s /run/dbus/system_bus_socket /var/run/dbus/system_bus_socket```

现在按预期工作:

[root@ipsystem]# systemctl restart dbus systemd-logind 
[root@ipsystem]# systemctl status dbus systemd-logind
● dbus.service - D-Bus System Message Bus
   Loaded: loaded (/usr/lib/systemd/system/dbus.service; static; vendor preset: disabled)
   Active: active (running) since Mon 2018-04-16 15:07:38 UTC; 9s ago
     Docs: man:dbus-daemon(1)
 Main PID: 18217 (dbus-daemon)
   CGroup: /system.slice/dbus.service
           └─18217 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
Apr 16 15:07:38 systemd[1]: Started D-Bus System Message Bus.
Apr 16 15:07:38 systemd[1]: Starting D-Bus System Message Bus...
● systemd-logind.service - Login Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static; vendor preset: disabled)
   Active: active (running) since Mon 2018-04-16 15:07:38 UTC; 9s ago
     Docs: man:systemd-logind.service(8)
           man:logind.conf(5)
           http://www.freedesktop.org/wiki/Software/systemd/logind
           http://www.freedesktop.org/wiki/Software/systemd/multiseat
 Main PID: 18220 (systemd-logind)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-logind.service
           └─18220 /usr/lib/systemd/systemd-logind

配置文件:

[root@ip]# cat /usr/lib/systemd/system/sockets.target.wants/dbus.socket
[Unit]
Description=D-Bus System Message Bus Socket
[Socket]
ListenStream=/run/dbus/system_bus_socket
[root@ip]# cat /usr/lib/systemd/system/dbus.socket
[Unit]
Description=D-Bus System Message Bus Socket
[Socket]
ListenStream=/run/dbus/system_bus_socket

答案2

请看一下 -https://access.redhat.com/solutions/3522441

解决

创建符号链接,因为 /var 位于单独的分区上。

# mv -f /var/run /var/run.runmove~
# ln -sfn /run /var/run
# mv -f /var/lock /var/lock.lockmove~
# ln -sfn /run/lock /var/lock

重新启动系统。如果系统关闭,可以在 chroot 后使用救援模式执行相同的步骤。

相关内容