When installing CyberPower's PowerPanel Linux package on Debian systems, users encounter a classic init dependency loop between pwrstatd
and stop-bootlogd
services. The error manifests as:
insserv: There is a loop at service pwrstatd if started
insserv: Starting pwrstatd depends on stop-bootlogd and therefore on system facility $all'
insserv: Max recursions depth 99 reached
The conflict occurs because:
- The
pwrstatd
init script lacks proper LSB headers - It declares incorrect dependencies on
stop-bootlogd
- Creates circular references with core system services like
mountnfs
andudev
1. Modify the init script:
sudo nano /etc/init.d/pwrstatd
Add proper LSB headers at the top:
### BEGIN INIT INFO
# Provides: pwrstatd
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: CyberPower UPS monitoring
# Description: PowerPanel Linux daemon for CyberPower UPS systems
### END INIT INFO
2. Update service dependencies:
sudo update-rc.d -f pwrstatd remove
sudo update-rc.d pwrstatd defaults
For systems where modifying the package isn't desirable, create a systemd service override:
sudo mkdir -p /etc/systemd/system/pwrstatd.service.d
sudo nano /etc/systemd/system/pwrstatd.service.d/override.conf
Add the following content:
[Unit]
After=network.target
Wants=network.target
Then reload systemd:
sudo systemctl daemon-reload
Check service dependencies with:
systemd-analyze verify pwrstatd.service
Or for sysvinit systems:
insserv -dv pwrstatd
The error messages reveal a complex dependency loop involving several critical system services. The core problematic relationship is between pwrstatd (CyberPower's UPS monitoring service) and stop-bootlogd, which incorrectly depends on the $all facility.
insserv: Starting pwrstatd depends on stop-bootlogd and therefore on system facility $all'
insserv: There is a loop between service stop-bootlogd and mountnfs if started
insserv: Max recursions depth 99 reached
The root cause appears in the init scripts. Let's examine the problematic sections in both services:
# Sample problematic pwrstatd init.d script (partial)
### BEGIN INIT INFO
# Provides: pwrstatd
# Required-Start: $remote_fs $syslog stop-bootlogd
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
For Debian-based systems, we need to modify both service definitions:
1. First, edit the pwrstatd init script:
sudo nano /etc/init.d/pwrstatd
2. Update the LSB headers to remove the stop-bootlogd dependency:
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
After making changes, run these commands to verify:
sudo insserv -v pwrstatd
sudo systemctl daemon-reload
sudo service pwrstatd start
For systems using systemd, create a custom unit file override:
sudo systemctl edit pwrstatd.service
[Unit]
After=syslog.target network.target
Wants=network.target
Use these commands to analyze service dependencies:
systemd-analyze critical-chain pwrstatd.service
systemd-analyze dot pwrstatd.service | dot -Tsvg > pwrstatd.svg