How to Run a Masked Service on a Raspberry Pi

In configuring my Network UPS Tools, to shutdown my web server, I ran into a weird message:

Loaded: masked (Reason: Unit ups-monitor.service is masked.)
Active: inactive (dead)

Huh? Turns out, good developers make some potentially destructive services a little harder to run! What’s going on here? A little more investigating:

root@server1:~# systemctl enable ups-monitor.service
 Synchronizing state of ups-monitor.service with SysV service script with /lib/systemd/systemd-sysv-install.
 Executing: /lib/systemd/systemd-sysv-install enable ups-monitor
 Failed to enable unit: Unit file /lib/systemd/system/ups-monitor.service is masked.
 root@server1:~# systemctl start  ups-monitor.service
 Failed to start ups-monitor.service: Unit ups-monitor.service is masked.
 root@server1:~# file /lib/systemd/system/ups-monitor.service
 /lib/systemd/system/ups-monitor.service: symbolic link to /dev/null

That bottom line… Meh. Let’s remove that link and reload.

root@server1:~# rm /lib/systemd/system/ups-monitor.service
root@server1:~# systemctl daemon-reload

Now what happens? Let’s check the status and then restart:

root@server1:~# systemctl status ups-monitor.service
 ● ups-monitor.service - LSB: Network UPS Tools monitor initscript
    Loaded: loaded (/etc/init.d/ups-monitor; generated)
    Active: inactive (dead)
      Docs: man:systemd-sysv-generator(8)
 root@server1:~# systemctl start  ups-monitor.service
 root@server1:~# systemctl status ups-monitor.service
 ● ups-monitor.service - LSB: Network UPS Tools monitor initscript
    Loaded: loaded (/etc/init.d/ups-monitor; generated)
    Active: active (exited) since Fri 2021-05-28 10:58:24 EDT; 2s ago
      Docs: man:systemd-sysv-generator(8)
   Process: 881 ExecStart=/etc/init.d/ups-monitor start (code=exited, status=0/SUCCESS)
 May 28 10:58:24 server1 systemd[1]: Starting LSB: Network UPS Tools monitor initscript…
 May 28 10:58:24 server1 ups-monitor[881]: Starting NUT - power device monitor and shutdown controller: nut-client fai
 May 28 10:58:24 server1 systemd[1]: Started LSB: Network UPS Tools monitor initscript.

All better!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.