« Back to Systemd: Frequently Asked Questions

What is the difference between systemctl disable and systemctl mask?

Systemd and its services can be in several states, such as enabled, disabled, failed, running. If you no longer need a particular service to run, then the first step is to stop a service.

systemctl stop nginx.service

But stopping a service is not the same as disabling a service. With that comes a very frequently asked question: what is the difference between a service that is disabled and one that is masked?

Difference disable and mask

When using disable to disabling a service, the underlying symlinks are removed. These symlinks normally activate the service during the boot process. Disabling a service sounds like it is not allowed to run, but it still may be activated if it is a dependency of another service.

Using mask will actually create a symlink pointing to /dev/null. This will making it no longer possible to start the service, until the moment that the unmask subcommand is used.

So the differences between disable and mask is that the latter is the most forceful way of disabling a unit.

Learn more about systemctl

This article uses the systemctl command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: systemctl

systemctl cheat sheet

Other questions related to systemd


Is the described answer not working or incorrect, got another tip or question? Share your thoughts!