Public bug reported:

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://raw.githubusercontent.com/johannbg/systemd-units/4c7ac61a6bf390a4899954f78820d49587b360d7/projects/apcupsd/service/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.

** Affects: apcupsd (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1742558

Title:
  apcupsd generated systemd unit file doesn't work

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apcupsd/+bug/1742558/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to