Unable to unmask, start or enable a service because the unit is masked

Solution Verified - Updated -

Issue

  • After masking a service, it is not possible to unmask, start or enable it again.
  • Getting messages as below in the system log:

    systemd[1]: Cannot add dependency job for unit sshd.service, ignoring: Unit is masked.
    
  • Getting messages as below while attempting, start or enable a service:

    # systemctl start httpd.service 
    Failed to start httpd.service: Unit httpd.service is masked.
    # systemctl enable httpd.service 
    Failed to enable unit: Unit file /usr/lib/systemd/system/httpd.service is masked.
    # systemctl enable vncserver@:1.service
    Failed to enable unit: Unit file /usr/lib/systemd/system/vncserver@.service is masked.
    

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content