Mask and unmask a unit

mask links the unit to /dev/null, so it cannot start even as a dependency (stronger than disable); unmask undoes it

systemctl mask <unit> && systemctl unmask <unit>

tool
systemd26 commands
tags
systemdsecuritytroubleshooting

More systemd commands

  • systemctl list-dependencies <unit> --all

    Walk the whole Wants/Requires tree to see why a service pulls in others; --reverse shows who needs it

  • systemctl show -p MainPID,MemoryCurrent,TasksCurrent <unit>

    Read live cgroup metrics from systemd without ps; MemoryCurrent includes page cache, so it is not pure RSS

  • systemctl reset-failed && systemctl list-units --state=failed

    Reset failure counters so units can start again after StartLimitBurst, then list what is still failed

  • systemd-run --on-calendar='*-*-* 03:00:00' --unit=backup /usr/local/bin/backup.sh

    Run backup.sh every day at 03:00 without writing unit files; the timer is gone after reboot

  • systemctl set-property --runtime <unit> MemoryMax=512M CPUQuota=50%

    Apply cgroup limits now without a restart; --runtime makes them temporary, so they are gone after reboot

all 26 systemd commands