2018-01-10 22:31:38 |
nh2 |
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://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. |
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. |
|