systemctl throws the error "Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'):"

Solution Verified - Updated -

Issue

  • The command systemctl via su fails with the following error.

    # su - webadmin -c "systemctl start httpd"
    Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address (polkit-error-quark, 0)
    Failed to start httpd.service: Interactive authentication required.
    See system logs and 'systemctl status httpd.service' for details.
    
  • Even if not run systemctl directly, a script to run systemctl inside(cf apachectl) can cause the error.

    # su - webadmin -c "apachectl start"
    Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address (polkit-error-quark, 0)
    Failed to start httpd.service: Interactive authentication required.
    See system logs and 'systemctl status httpd.service' for details.
    

Environment

  • Red Hat Enterprise Linux 7 and 8
  • systemd
  • su

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