首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法获得D总线连接:没有这样的文件或目录。$XDG_RUNTIME_DIR未设置。安装libpam-systemd

无法获得D总线连接:没有这样的文件或目录。$XDG_RUNTIME_DIR未设置。安装libpam-systemd
EN

Unix & Linux用户
提问于 2018-03-18 09:09:02
回答 2查看 40K关注 0票数 4

我在LIME2上安装了Yunohost,就像在Pi3上一样,现在我的错误与两个月(参见"无法启用用户服务。未能获得D总线连接:连接被拒绝“支持”")相同,只是这次我已经安装了libpam-systemd。

代码语言:javascript
复制
admin@Gildurklaus:~ $ systemctl --user list-units
Failed to get D-Bus connection: Connection refused

同样,在没有用户参数的情况下,该命令运行良好。

代码语言:javascript
复制
admin@Gildurklaus:~ $ 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也不是为我的用户运行的,而是在系统范围内运行。

代码语言:javascript
复制
admin@Gildurklaus:~ $ ps -ef | grep dbus
message+   574     1  0 05:53 ?        00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
admin     1988  1971  0 10:03 pts/0    00:00:00 grep dbus

而且,systemd似乎没有为该用户运行。

代码语言:javascript
复制
admin@Gildurklaus:~$ ps -ef | grep dbus
message+   574     1  0 05:53 ?        00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
admin     1988  1971  0 10:03 pts/0    00:00:00 grep dbus
admin@Gildurklaus:~$ ps -ef | grep systemd
root       183     1  0 05:53 ?        00:00:01 /lib/systemd/systemd-journald
root       187     1  0 05:53 ?        00:00:00 /lib/systemd/systemd-udevd
root       572     1  0 05:53 ?        00:00:00 /lib/systemd/systemd-logind
message+   574     1  0 05:53 ?        00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
admin     1990  1971  0 10:04 pts/0    00:00:00 grep systemd

$XDG_RUNTIME_DIR又失踪了。

代码语言:javascript
复制
admin@Gildurklaus:~ $ systemd --test
Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.

这一次安装了libpam-systemd。

代码语言:javascript
复制
admin@Gildurklaus:~$ apt list --installed *systemd*
Listing... Done
libpam-systemd/oldstable,now 215-17+deb8u7 armhf [installed]
libsystemd0/oldstable,now 215-17+deb8u7 armhf [installed]
systemd/oldstable,now 215-17+deb8u7 armhf [installed]
systemd-shim/oldstable,now 9-1 armhf [installed,automatic]
systemd-sysv/oldstable,now 215-17+deb8u7 armhf [installed]
admin@Gildurklaus:~$ apt list --installed *dbus*   
Listing... Done
dbus/oldstable,now 1.8.22-0+deb8u1 armhf [installed,automatic]
libdbus-1-3/oldstable,now 1.8.22-0+deb8u1 armhf [installed,automatic]
libdbus-glib-1-2/oldstable,now 0.102-1 armhf [installed,automatic]
libnih-dbus1/oldstable,now 1.0.3-4.3 armhf [installed,automatic]

我注意到了我的Pi3服务器和LIME2服务器之间的细微差别。Pi3启动XDG_SESSION_ID会话,而LIME2服务器不启动。

Pi3

代码语言:javascript
复制
admin@Yroklaus:~ $ sudo systemctl status systemd-logind.service
● systemd-logind.service - Login Service
   Loaded: loaded (/lib/systemd/system/systemd-logind.service; static)
   Active: active (running) since Sat 2018-03-24 15:43:32 UTC; 1h 27min 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: 508 (systemd-logind)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-logind.service
           └─508 /lib/systemd/systemd-logind

Mar 24 15:43:32 Yroklaus systemd[1]: Starting Login Service...
Mar 24 15:43:32 Yroklaus systemd-logind[508]: New seat seat0.
Mar 24 15:43:32 Yroklaus systemd[1]: Started Login Service.
Mar 24 15:43:32 Yroklaus systemd-logind[508]: Couldn't add lingering user folatt: No such file or directory
Mar 24 15:43:32 Yroklaus systemd-logind[508]: User enumeration failed: No such file or directory
Mar 24 16:47:01 Yroklaus systemd-logind[508]: New session c1 of user admin.

LIME2

代码语言:javascript
复制
admin@Gildurklaus:~$ sudo systemctl status systemd-logind.service
● systemd-logind.service - Login Service
   Loaded: loaded (/lib/systemd/system/systemd-logind.service; static)
   Active: active (running) since Sat 2018-03-24 16:43:45 CET; 1h 27min 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: 571 (systemd-logind)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-logind.service
           └─571 /lib/systemd/systemd-logind

Mar 24 16:43:45 Gildurklaus systemd-logind[571]: New seat seat0.
Mar 24 16:43:45 Gildurklaus systemd[1]: Started Login Service.
EN

回答 2

Unix & Linux用户

发布于 2018-03-18 12:03:58

而Dbus又一次跑了。

不,显然不是。这也不是最后一次了。

您的进程清单只显示了系统范围内的桌面总线代理。注意命令参数中的--system和进程没有像您一样运行的事实。

当您使用systemctl选项运行--user时,它会通过您的每个用户桌面总线代理与您的systemd的每个用户实例进行对话。

事实上,这两种情况都不存在。

您可能会发现,启动systemd的每个用户实例也会启动每个用户的桌面代理。前者管理后者,dbus.socket单元(来自/usr/lib/systemd/user/dbus.socket)可能已经为每个用户服务管理器启用了。(必须启用的是套接字单元,而不是服务单元。)

所以这实际上是和以前一样的答案,尽管在最后的问答中没有明确的回答:确保您的systemd的每个用户实例都在运行,并确保它启动了您的每个用户桌面总线代理。您可以手动运行pam_systemd运行的步骤,以检查它们本身是否首先工作。然后检查是否将pam_systemd配置为实际调用,作为登录过程的一部分。

请记住,su不是一种登录机制。它在现有的交互式登录会话中工作。如果您没有以帐户的身份登录,systemd钩子将不会激活该帐户的systemd的每个用户实例。

再读

票数 5
EN

Unix & Linux用户

发布于 2018-03-18 10:37:53

需要在PAM堆栈中调用libpam-systemd

运行pam-auth-update并检查它是否已启用

票数 2
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/431896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档