The systemd unit you’re trying to start or enable is masked, meaning systemd has been explicitly told not to start it, even manually.

Here are the common reasons and how to fix them:

  • The unit was intentionally masked by an administrator. This is the most common scenario. An administrator might mask a service to prevent it from running altogether, perhaps due to security concerns, resource conflicts, or because it’s part of a larger system that should not be independently started.

    • Diagnosis: Check if the unit file symlink points to /dev/null.
      ls -l /etc/systemd/system/your-unit.service
      
      If the output shows lrwxrwxrwx ... /dev/null, it’s masked.
    • Fix: Unmask the unit.
      sudo systemctl unmask your-unit.service
      
      This removes the symlink to /dev/null and allows systemd to see the actual unit file again. You can then start or enable it.
  • The unit is a dependency of another masked unit. If service A depends on service B, and service B is masked, systemd will prevent service A from starting to avoid a cascading failure or undefined state.

    • Diagnosis: Examine the unit file for Requires= or Wants= directives.
      systemctl cat your-unit.service
      
      Look for lines like Requires=masked-dependency.service. Then, check the status of that dependency:
      systemctl status masked-dependency.service
      
      It will likely show as "masked".
    • Fix: Decide if the dependency is truly needed. If it is, unmask the dependency first (as described above). If it’s not, you can edit your-unit.service to remove the dependency line, or mask your-unit.service itself if it shouldn’t run without its dependency.
  • The unit file is missing or corrupted, and systemd defaulted to masking it. In some cases, if systemd cannot find or parse a unit file correctly, it might mask it to prevent errors during boot or service management. This is less common than explicit masking.

    • Diagnosis: Check the unit file’s existence and permissions.
      ls -l /usr/lib/systemd/system/your-unit.service
      ls -l /etc/systemd/system/your-unit.service
      
      Also, try loading the unit file to see if systemd reports syntax errors.
      systemctl daemon-reload
      
      Check journalctl -xe for specific errors related to loading the unit.
    • Fix: If the unit file is legitimately missing, you’ll need to reinstall the package that provides it or create the unit file manually. If it’s corrupted, fix the syntax errors in the unit file. After making changes, run sudo systemctl daemon-reload to make systemd aware of the changes.
  • A previous attempt to install or update a package failed, leaving the unit masked. Sometimes, package manager operations can be interrupted, leading to an inconsistent state where a service unit is masked but its associated package is partially installed.

    • Diagnosis: Check the package status for the service.
      dpkg -s your-package-name  # For Debian/Ubuntu
      rpm -q your-package-name    # For RHEL/CentOS/Fedora
      
      If the package status is "half-installed" or similar, this might be the cause.
    • Fix: Reinstall or reconfigure the package.
      sudo apt --reinstall install your-package-name  # For Debian/Ubuntu
      sudo dnf reinstall your-package-name          # For Fedora/RHEL
      sudo yum reinstall your-package-name          # For older RHEL/CentOS
      
      This should ensure the unit files are correctly placed and not masked by the package manager’s state.
  • You’re trying to start a service that is designed to be socket-activated and not directly started. Some systemd services are not meant to be started manually but rather are activated by a systemd socket unit when a connection is made to a specific port.

    • Diagnosis: Check for a corresponding .socket unit.
      ls -l /usr/lib/systemd/system/your-unit.socket
      ls -l /etc/systemd/system/your-unit.socket
      
      If a .socket unit exists and is active (systemctl status your-unit.socket), the service is likely socket-activated.
    • Fix: Enable and start the socket unit instead of the service unit.
      sudo systemctl enable your-unit.socket
      sudo systemctl start your-unit.socket
      
      When a connection arrives at the socket, systemd will automatically start your-unit.service.
  • The unit was masked as part of a system configuration or upgrade process. During major system upgrades or complex configuration changes, units might be temporarily or permanently masked to ensure a clean transition. This is often a deliberate action by system management tools or scripts.

    • Diagnosis: Review system logs for recent configuration changes or upgrade-related messages.
      journalctl -u systemd -f
      grep -i "mask" /var/log/apt/history.log # Debian/Ubuntu
      grep -i "mask" /var/log/dnf.log       # Fedora/RHEL
      
    • Fix: If this was an intentional part of a managed process, consult the documentation for that process. If it was an unintended side-effect, you may need to unmask the unit as described in the first point.

After unmasking and ensuring the unit file is present and correct, you’ll likely need to reload the systemd daemon and then start the unit:

sudo systemctl daemon-reload
sudo systemctl start your-unit.service

The next error you’ll encounter is likely Unit your-unit.service could not be found if you try to start a service that doesn’t exist or has been removed.

Want structured learning?

Take the full Systemd course →