systemd doesn't start my custom service and logs "Cannot add dependency job ... Unit not found"

Solution Verified - Updated -

Issue

  • Upon boot, my custom service custom.service doesn't start automatically, although enabled, and journalctl -b shows the following line

    systemd[1]: Cannot add dependency job for unit custom.service, ignoring: Unit not found.
    
  • After booting, performing a systemctl operation on the service fails

    # systemctl status custom.service 
    Unit custom.service could not be found.
    

Environment

  • Red Hat Enterprise Linux 7 and later
  • systemd

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