无法启用用户服务。“无法获得D-Bus连接:连接被拒绝”支持


11

以用户身份运行任何systemd命令时出现此错误:

admin@Xroklaus:~ $ systemctl --user list-units
Failed to get D-Bus connection: Connection refused

没有用户参数,该命令运行正常。

admin@Xroklaus:~ $ systemctl list-units
  UNIT                                                                 LOAD   ACTIVE SUB       DESCRIPTION
  proc-sys-fs-binfmt_misc.automount                                    loaded active waiting   Arbitrary Executable File Formats File System Automount Point
  sys-devices-platform-soc-3f201000.serial-tty-ttyAMA0-hci0-rfkill1.device loaded active plugged   /sys/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/rfkil
  sys-devices-platform-soc-3f201000.serial-tty-ttyAMA0-hci0.device     loaded active plugged   /sys/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0
  ...
  To show all installed unit files use 'systemctl list-unit-files'.
  lines 102-129/129 (END)

Dbus正在运行。

admin@Xroklaus:~ $ ps -ef | grep dbus
message+   443     1  0 Jan06 ?        00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
admin     9082  9040  0 11:42 pts/0    00:00:00 grep --color=auto dbus

该用户似乎没有在运行Systemd

admin@Xroklaus:~ $ ps -ef | grep systemd
root       142     1  0 Jan06 ?        00:00:08 /lib/systemd/systemd-journald
root       147     1  0 Jan06 ?        00:00:00 /lib/systemd/systemd-udevd
message+   443     1  0 Jan06 ?        00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root       520     1  0 Jan06 ?        00:00:00 /lib/systemd/systemd-logind
admin    10255  9040  0 16:53 pts/0    00:00:00 grep --color=auto systemd

我不知道如何运行它。

这似乎也不正常:

admin@Xroklaus:~ $ systemd --test
Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.

1
您是否为自己的用户运行了dbus实例?最重要的是,您是否有一个为用户运行的systemd实例?

遗憾的是,对于RHEL / CentOS 7,此功能已被禁用。bugs.centos.org
nodakai

Answers:


8

看起来像一个包裹不见了:

admin@Xroklaus:~ $ sudo apt-get install libpam-systemd

重启后,它又可以工作了。


我需要重新启动(Raspbian)。感谢您的提示。
马特
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.