Score:0

apt install apcupsd fails on 20.04

cn flag

I've installed, purged and re-installed apcupsd 3 times always with this result. I've installed this program on another computer without a problem. For the record, apt and aptitude give the same result. It looks like a dpkg problem but I've run out of ideas. The first error that throws up seems to be unknown to google:

Job for apcupsd.service failed because the service did not take the steps required by its unit configuration.

below is the full output....

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
<snip>
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/?] 

snip

**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:~#
pl flag
Looks like it could be this bug: https://bugs.launchpad.net/ubuntu/+source/apcupsd/+bug/1967490
nobody avatar
gh flag
`apcupsd.service: Failed to set a watch for PID file /run/apcupsd.pid: No space left on device` Please add `df -h;df -i` to your question.
Score:0
cn flag

It turns out that killing the process started during the apt install is all that is needed - pid 17216 in the above example but

$ sudo ps aux | grep apcupsd

will tell you what to kill. Subsequently

$ sudo systemctl start apcupsd.service

gets everything going properly.

The problem is entirely in the install process. Once it's installed it works normally. I mainly had to ignore the mass of error messages.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.