我已经安装、清除和重新安装apcupsd 3次,一直到这个结果。我已经在另一台电脑上安装了这个程序,没有问题。要记录在案,聪明和天赋给出的结果是一样的。这看起来是个小问题,但我的想法已经用完了。第一个抛出的错误对于google来说似乎是未知的:
Job for apcupsd.service failed because the service did not take the steps required by its unit configuration.以下是全部输出..。
root@dm:~# aptitude purge apcupsd
The following packages will be REMOVED:
apcupsd{p} apcupsd-doc{u} libusb-0.1-4{u}
0 packages upgraded, 0 newly installed, 3 to remove and 0 not to upgrade.
Need to get 0 B of archives. After unpacking 1,801 kB will be freed.
Do you want to continue? [Y/n/?] y
root@dm:~# ps aux | grep apcupsd
root 17003 0.0 0.0 8912 632 pts/1 S+ 14:50 0:00 grep --color=auto apcupsd
root@dm:~# aptitude install apcupsd
The following NEW packages will be installed:
apcupsd apcupsd-doc{a} libusb-0.1-4{a}
0 packages upgraded, 3 newly installed, 0 to remove and 0 not to upgrade.
Need to get 0 B/549 kB of archives. After unpacking 1,801 kB will be used.
Do you want to continue? [Y/n/?] 狙击
**Setting up apcupsd (3.14.14-3build1) ...
Job for apcupsd.service failed because the service did not take the steps required by its unit configuration.**
See "systemctl status apcupsd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apcupsd, action "start" failed.
● apcupsd.service - UPS power management daemon
Loaded: loaded (/lib/systemd/system/apcupsd.service; disabled; vendor preset: enabled)
Active: failed (Result: protocol) since Thu 2023-02-16 14:52:25 AEDT; 2ms ago
Docs: man:apcupsd(8)
Process: 17211 ExecStartPre=/lib/apcupsd/prestart (code=exited, status=0/SUCCESS)
Process: 17215 ExecStart=/sbin/apcupsd (code=exited, status=0/SUCCESS)
Tasks: 3 (limit: 38161)
Memory: 724.0K
CGroup: /system.slice/apcupsd.service
└─17216 /sbin/apcupsd
Feb 16 14:52:25 dm systemd[1]: Starting UPS power management daemon...
Feb 16 14:52:25 dm systemd[1]: apcupsd.service: Can't open PID file /run/apcupsd.pid (yet?) after start: Operation not permitted
Feb 16 14:52:25 dm systemd[1]: apcupsd.service: Failed to set a watch for PID file /run/apcupsd.pid: No space left on device
Feb 16 14:52:25 dm systemd[1]: apcupsd.service: Failed with result 'protocol'.
Feb 16 14:52:25 dm systemd[1]: Failed to start UPS power management daemon.
Feb 16 14:52:25 dm apcupsd[17216]: apcupsd 3.14.14 (31 May 2016) debian startup succeeded
Feb 16 14:52:25 dm apcupsd[17216]: NIS server startup succeeded
dpkg: error processing package apcupsd (--configure):
installed apcupsd package post-installation script subprocess returned error exit status 1
Processing triggers for systemd (245.4-4ubuntu3.19) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
Errors were encountered while processing:
apcupsd
E: Sub-process /usr/bin/dpkg returned an error code (1)
Setting up apcupsd (3.14.14-3build1) ...
Job for apcupsd.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status apcupsd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apcupsd, action "start" failed.
● apcupsd.service - UPS power management daemon
Loaded: loaded (/lib/systemd/system/apcupsd.service; disabled; vendor preset: enabled)
Active: failed (Result: protocol) since Thu 2023-02-16 14:52:27 AEDT; 2ms ago
Docs: man:apcupsd(8)
Process: 17509 ExecStartPre=/lib/apcupsd/prestart (code=exited, status=0/SUCCESS)
Process: 17513 ExecStart=/sbin/apcupsd (code=exited, status=0/SUCCESS)
Tasks: 3 (limit: 38161)
Memory: 536.0K
CGroup: /system.slice/apcupsd.service
└─17216 /sbin/apcupsd
Feb 16 14:52:27 dm systemd[1]: apcupsd.service: Found left-over process 17216 (apcupsd) in control group while starting unit. Ignoring.
Feb 16 14:52:27 dm systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Feb 16 14:52:27 dm systemd[1]: apcupsd.service: Can't open PID file /run/apcupsd.pid (yet?) after start: Operation not permitted
Feb 16 14:52:27 dm systemd[1]: apcupsd.service: Failed to set a watch for PID file /run/apcupsd.pid: No space left on device
Feb 16 14:52:27 dm systemd[1]: apcupsd.service: Failed with result 'protocol'.
Feb 16 14:52:27 dm systemd[1]: Failed to start UPS power management daemon.
Feb 16 14:52:27 dm apcupsd[17514]: Valid lock file for pid=17216, but not ours pid=17514
Feb 16 14:52:27 dm apcupsd[17514]: apcupsd FATAL ERROR in apcupsd.c at line 219
Unable to create UPS lock file.
If apcupsd or apctest is already running,
please stop it and run this program again.
Feb 16 14:52:27 dm apcupsd[17514]: Valid lock file for pid=17216, but not ours pid=17514
Feb 16 14:52:27 dm apcupsd[17514]: apcupsd error shutdown completed
dpkg: error processing package apcupsd (--configure):
installed apcupsd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
apcupsd
root@dm:~#发布于 2023-02-21 06:10:49
原来,终止在apt安装期间启动的进程就是所需要的--在上面的示例中,pid 17216,但是
$ sudo ps aux | grep apcupsd会告诉你该杀什么。随后
$ sudo systemctl start apcupsd.service让一切正常运转。
问题完全在安装过程中。一旦安装完毕,它就能正常工作。我主要是忽略了大量的错误信息。
https://askubuntu.com/questions/1455182
复制相似问题