上周末,我的 snap 停止工作,包括 Ubuntu 软件。结果发现它突然snap
不再安装了。音频也完全停止工作,当时我猜想这与 snap 有关,因为我从 Ubuntu 软件商店安装了“PulseAudio Volume Control (gtk)”。
我重新安装了snap
,apt install snap
所有快照又正常工作了。即使多次重启后,音频仍然无法工作。手动启动 Pulse 可以pulseaudio --start
修复音频,直到下次重启。我开始调查为什么启动后没有启动 Pulse 守护进程,但请注意,我对 一无所知systemd
。当然,在出现此问题之前我没有弄乱过systemd
。所以我猜是某些更新导致了它?
显然upowerd
,用户服务在启动后无法启动:
$ systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
upower.service loaded failed failed Daemon for power management
[email protected] loaded failed failed User Manager for UID 1000
[email protected] loaded failed failed User Manager for UID 125
$ id -un 1000
产生我的用户名并$ id -un 125
产生gdm
(Gnome 显示管理器?)。
尝试连接产生upowerd
以下结果:
$ upower
(upower:4492): UPower-WARNING **: 17:02:55.585: Cannot connect to upowerd: Error calling StartServiceByName for org.freedesktop.UPower: Timeout was reached
尝试调用systemctl
带有标志的任何命令--user
将始终返回Process org.freedesktop.systemd1 exited with status 1
。
我检查了所有 3 项服务的状态:
$ systemctl status user@1000
[email protected] - User Manager for UID 1000
Loaded: loaded (/lib/systemd/system/[email protected]; static; vendor preset: enabled)
Drop-In: /usr/lib/systemd/system/[email protected]
└─timeout.conf
Active: failed (Result: exit-code) since Sat 2020-11-07 17:52:27 CET; 53min left
Docs: man:[email protected](5)
Process: 1307 ExecStart=/lib/systemd/systemd --user (code=exited, status=224/PAM)
Main PID: 1307 (code=exited, status=224/PAM)
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1]: [email protected]: Main process exited, code=exited, status=22>
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1307]: PAM adding faulty module: pam_umask.so
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1]: [email protected]: Failed with result 'exit-code'.
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1307]: PAM unable to dlopen(pam_systemd.so): /lib/security/pam_sys>
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1307]: PAM adding faulty module: pam_systemd.so
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1307]: PAM unable to dlopen(pam_cap.so): /lib/security/pam_cap.so:>
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1307]: PAM adding faulty module: pam_cap.so
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1307]: PAM unable to dlopen(pam_gnome_keyring.so): /lib/security/p>
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1307]: PAM adding faulty module: pam_gnome_keyring.so
Nov 07 17:52:27 <MyUser-MyComputer> systemd[1]: Failed to start User Manager for UID 1000.
$ systemctl status user@125
[email protected] - User Manager for UID 125
Loaded: loaded (/lib/systemd/system/[email protected]; static; vendor preset: enabled)
Drop-In: /usr/lib/systemd/system/[email protected]
└─timeout.conf
Active: failed (Result: exit-code) since Sat 2020-11-07 17:52:16 CET; 52min left
Docs: man:[email protected](5)
Process: 943 ExecStart=/lib/systemd/systemd --user (code=exited, status=224/PAM)
Main PID: 943 (code=exited, status=224/PAM)
Nov 07 17:52:16 <MyUser-MyComputer> systemd[943]: PAM adding faulty module: pam_umask.so
Nov 07 17:52:16 <MyUser-MyComputer> systemd[1]: [email protected]: Main process exited, code=exited, status=224>
Nov 07 17:52:16 <MyUser-MyComputer> systemd[943]: PAM unable to dlopen(pam_systemd.so): /lib/security/pam_syst>
Nov 07 17:52:16 <MyUser-MyComputer> systemd[1]: [email protected]: Failed with result 'exit-code'.
Nov 07 17:52:16 <MyUser-MyComputer> systemd[943]: PAM adding faulty module: pam_systemd.so
Nov 07 17:52:16 <MyUser-MyComputer> systemd[943]: PAM unable to dlopen(pam_cap.so): /lib/security/pam_cap.so: >
Nov 07 17:52:16 <MyUser-MyComputer> systemd[943]: PAM adding faulty module: pam_cap.so
Nov 07 17:52:16 <MyUser-MyComputer> systemd[943]: PAM unable to dlopen(pam_gnome_keyring.so): /lib/security/pa>
Nov 07 17:52:16 <MyUser-MyComputer> systemd[943]: PAM adding faulty module: pam_gnome_keyring.so
Nov 07 17:52:16 <MyUser-MyComputer> systemd[1]: Failed to start User Manager for UID 125.
那么,PAM
某种身份验证是否应该在启动后进行,但却以某种方式失败了?我如何手动让 PAM 进行身份验证?
$ systemctl status upower
upower.service - Daemon for power management
Loaded: loaded (/lib/systemd/system/upower.service; disabled; vendor preset: enabled)
Active: failed (Result: signal) since Sat 2020-11-07 16:53:14 CET; 3min 26s ago
Docs: man:upowerd(8)
Process: 3163 ExecStart=/usr/lib/upower/upowerd (code=killed, signal=SYS)
Main PID: 3163 (code=killed, signal=SYS)
Nov 07 16:53:14 <MyUser-MyComputer> systemd[1]: upower.service: Scheduled restart job, restart counter is at 5.
Nov 07 16:53:14 <MyUser-MyComputer> systemd[1]: Stopped Daemon for power management.
Nov 07 16:53:14 <MyUser-MyComputer> systemd[1]: upower.service: Start request repeated too quickly.
Nov 07 16:53:14 <MyUser-MyComputer> systemd[1]: upower.service: Failed with result 'signal'.
Nov 07 16:53:14 <MyUser-MyComputer> systemd[1]: Failed to start Daemon for power management.
检查systemd
日志显示,它尝试启动upowerd
5 次,并在反复失败后放弃(删除以仅显示重复 5 次的 1 个条目):
$ journalctl -xe
Nov 07 17:02:30 <MyUser-MyComputer> systemd[1]: Starting Daemon for power management...
-- Subject: A start job for unit upower.service has begun execution
--
-- A start job for unit upower.service has begun execution.
--
-- The job identifier is 2811.
Nov 07 17:02:30 <MyUser-MyComputer> audit[4495]: SECCOMP auid=4294967295 uid=0 gid=0 ses=4294967295 pid=4495 comm="upowerd" exe="/usr/lib/upower/upowerd" sig=31 arch=c000003e syscall=12 compat=0 ip=0x>
Nov 07 17:02:30 <MyUser-MyComputer> kernel: kauditd_printk_skb: 16 callbacks suppressed
Nov 07 17:02:30 <MyUser-MyComputer> kernel: audit: type=1326 audit(1604764950.576:8019): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=4495 comm="upowerd" exe="/usr/lib/upower/upowerd" sig=31 arch=c0>
Nov 07 17:02:30 <MyUser-MyComputer> systemd[1]: upower.service: Main process exited, code=killed, status=31/SYS
-- Subject: Unit process exited
--
-- An ExecStart= process belonging to unit upower.service has exited.
--
-- The process' exit code is 'killed' and its exit status is 31.
我已经束手无策了。我尝试重置失败的服务systemctl reset-failed
并重新启动,但没有任何改变?
知道我可以尝试什么或者应该检查哪个日志吗?
答案1
我遇到了同样的问题,缺少 snapd 包,并且出现了同样的服务失败错误。原来是它在 /lib/security 中寻找 pam 模块,而 amd64 上不存在该模块。删除 snapd 的相同更新怪癖在我的 64 位机器上安装了 systemd:i386。修复方法是sudo apt install systemd:amd64 systemd-timesyncd:amd64
另请参阅启动板:https://bugs.launchpad.net/ubuntu/+source/aptdaemon/+bug/1903273