apcupsd generated systemd unit file doesn't work

Bug #1742558 reported by nh2
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apcupsd (Ubuntu)
New
Undecided
Unassigned

Bug Description

For me on Ubuntu 16.04, `apcupsd` doesn't start when using `sudo systemctl start apcupsd` or `sudo service apcupsd start`.

It didn't appear in `ps aux | grep apc` and I got:

    % systemctl status apcupsd
    ● apcupsd.service - LSB: Starts apcupsd daemon
       Loaded: loaded (/etc/init.d/apcupsd; bad; vendor preset: enabled)
       Active: active (exited) since Wed 2018-01-10 22:21:00 CET; 34min ago
         Docs: man:systemd-sysv-generator(8)
        Tasks: 0
       Memory: 0B
          CPU: 0

Note the `active (exited)` and no processes shown.

I suspect that in this case the `systemd-sysv-generator` messed up and cannot correctly start this SysV-Init unit. So basically, the systemd service seems broken in this version of Ubuntu.

I fixed it by just installing a proper systemd unit using:

    curl https://gist.githubusercontent.com/nh2/e6089d30ddc6be6191037b5098f1adb9/raw/f08e4174286cbba6ab19f619d896da265cb81552/apcupsd.service | sudo tee /etc/systemd/system/apcupsd.service
    sudo systemctl daemon-reload

After that, I can `sudo service apcupsd start` all fine.

That service file has contents

    [Unit]
    Description=APC UPS Power Control Daemon for Linux

    [Service]
    ExecStartPre=-/usr/bin/rm -f /etc/apcupsd/powerfail
    ExecStart=/usr/sbin/apcupsd -b -f /etc/apcupsd/apcupsd.conf

    [Install]
    WantedBy=multi-user.target

I don't know if upstream debian has the same problem, but the same fix would work there.

Revision history for this message
nh2 (nh2) wrote :
nh2 (nh2)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.