How to disable a systemd unit with systemctl
How to disable a systemd unit or service?
Run systemctl with the 'mask' subcommand and define the unit to mask.
systemctl mask UNITSometimes a systemd unit, like a service, should not be starting during boot time or not at all. Let’s have a look how to disable a systemd unit.
Completely disable a unit
The most strict method is to disable a unit using the mask command.
systemctl mask UNIT
With the service masked, it won’t be able to start it anymore. Only when using the unmask command, it can be reactivated again.
Disable during boot
Just want to disable the unit so it won’t be started during the boot process? Then we use the disable command.
systemctl disable UNIT
After changing the service, have a look at it. In the line starting with Loaded, it should list ‘disabled’ after the unit name.