Support Questions
Find answers, ask questions, and share your expertise

Why "sudo: no tty present and no askpass program specified" occured even I'm running ambari with root user ?

Solved Go to solution

Why "sudo: no tty present and no askpass program specified" occured even I'm running ambari with root user ?

New Contributor

I am running ambari-server with root user.

When I was enabling kerberos."sudo: no tty present and no askpass program specified" just occured on step 7 "Kerberize Cluster-Configure Ambari Identity".

Do I have to visudo as non-root user ? I really puzzled.

Please help me figure that out.

This is my ambari-audit.log

......

2018-07-20T01:15:02.488+0800, Operation(Keytab file creation), Status(Success), RequestId(281), TaskId(4736), Principal(ambari-qa@flx.com), Hostname(flx93), Keytab file(/etc/security/keytabs/smokeuser.headless.keytab)
2018-07-20T01:15:02.489+0800, Operation(Keytab file creation), Status(Success), RequestId(281), TaskId(4736), Principal(ambari-server@flx.com), Hostname(ambari_server), Keytab file(/etc/security/keytabs/ambari.server.keytab)
2018-07-20T01:15:02.490+0800, Operation(Keytab file creation), Status(Success), RequestId(281), TaskId(4736), Principal(HTTP/flx86@flx.com), Hostname(ambari_server), Keytab file(/var/lib/ambari-server/data/tmp/.ambari_1532020473683-0.d/ambari_server/8d4cb8842a900d56fe6d3030b414b50634cfdf54)
2018-07-20T01:15:02.518+0800, User(admin), Operation(EXECUTE AMBARI_SERVER_ACTION), Details(Create Keytabs), Status(COMPLETED), RequestId(281), TaskId(4736), Hostname(null)
2018-07-20T01:15:02.985+0800, User(admin), Operation(EXECUTE AMBARI_SERVER_ACTION), Details(Configure Ambari Identity), Status(QUEUED), RequestId(281), TaskId(4737), Hostname(null)
2018-07-20T01:15:02.998+0800, User(admin), Operation(EXECUTE AMBARI_SERVER_ACTION), Details(Configure Ambari Identity), Status(IN_PROGRESS), RequestId(281), TaskId(4737), Hostname(null)
2018-07-20T01:15:03.062+0800, User(admin), Operation(Preparing Operations), Status(FAILED), RequestId(281)
2018-07-20T01:15:03.062+0800, User(admin), Operation(EXECUTE AMBARI_SERVER_ACTION), Details(Configure Ambari Identity), Status(FAILED), RequestId(281), TaskId(4737), Hostname(null)
2018-07-20T01:15:04.012+0800, User(admin), Operation(CUSTOM_COMMAND KERBEROS_CLIENT), Details(SET_KEYTAB KERBEROS/KERBEROS_CLIENT), Status(ABORTED), RequestId(281), TaskId(4738), Hostname(flx86)
2018-07-20T01:15:04.012+0800, User(admin), Operation(CUSTOM_COMMAND KERBEROS_CLIENT), Details(SET_KEYTAB KERBEROS/KERBEROS_CLIENT), Status(ABORTED), RequestId(281), TaskId(4739), Hostname(flx87)
2018-07-20T01:15:04.012+0800, User(admin), Operation(CUSTOM_COMMAND KERBEROS_CLIENT), Details(SET_KEYTAB KERBEROS/KERBEROS_CLIENT), Status(ABORTED), RequestId(281), TaskId(4740), Hostname(flx89)
2018-07-20T01:15:04.012+0800, User(admin), Operation(CUSTOM_COMMAND KERBEROS_CLIENT), Details(SET_KEYTAB KERBEROS/KERBEROS_CLIENT), Status(ABORTED), RequestId(281), TaskId(4741), Hostname(flx90)
2018-07-20T01:15:04.012+0800, User(admin), Operation(CUSTOM_COMMAND KERBEROS_CLIENT), Details(SET_KEYTAB KERBEROS/KERBEROS_CLIENT), Status(ABORTED), RequestId(281), TaskId(4742), Hostname(flx91)
2018-07-20T01:15:04.012+0800, User(admin), Operation(CUSTOM_COMMAND KERBEROS_CLIENT), Details(SET_KEYTAB KERBEROS/KERBEROS_CLIENT), Status(ABORTED), RequestId(281), TaskId(4743), Hostname(flx92)
2018-07-20T01:15:04.012+0800, User(admin), Operation(CUSTOM_COMMAND KERBEROS_CLIENT), Details(SET_KEYTAB KERBEROS/KERBEROS_CLIENT), Status(ABORTED), RequestId(281), TaskId(4744), Hostname(flx93)
2018-07-20T01:15:04.012+0800, User(admin), Operation(Preparing Operations), Status(ABORTED), RequestId(281)
2018-07-20T01:15:04.012+0800, User(admin), Operation(EXECUTE AMBARI_SERVER_ACTION), Details(Update Service Configurations), Status(ABORTED), RequestId(281), TaskId(4745), Hostname(null)


This is my ambari-server.log

......
20 Jul 2018 01:15:02,432  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for hdfs@flx.com on host flx93
20 Jul 2018 01:15:02,433  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for ambari-qa@flx.com on host flx93
20 Jul 2018 01:15:02,433  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for nm/flx93@flx.com on host flx93
20 Jul 2018 01:15:02,461  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for hive/flx93@flx.com on host flx93
20 Jul 2018 01:15:02,488  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for ambari-qa@flx.com on host flx93
20 Jul 2018 01:15:02,488  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for ambari-qa@flx.com on host flx93
20 Jul 2018 01:15:02,488  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for ambari-qa@flx.com on host flx93

20 Jul 2018 01:15:02,489  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for ambari-server@flx.com on host ambari_server
20 Jul 2018 01:15:02,490  INFO [Server Action Executor Worker 4736] CreateKeytabFilesServerAction:193 - Creating keytab file for HTTP/flx86@flx.com on host ambari_server
20 Jul 2018 01:15:02,516  INFO [Server Action Executor Worker 4736] KerberosServerAction:463 - Processing identities completed.
20 Jul 2018 01:15:03,009  INFO [Server Action Executor Worker 4737] KerberosServerAction:359 - Processing identities...
20 Jul 2018 01:15:03,059  WARN [Server Action Executor Worker 4737] ServerActionExecutor:471 - Task #4737 failed to complete execution due to thrown exception: org.apache.ambari.server.AmbariException:sudo: no tty present and no askpass program specified


org.apache.ambari.server.AmbariException: sudo: no tty present and no askpass program specified


	at org.apache.ambari.server.serveraction.kerberos.KerberosServerAction.processIdentities(KerberosServerAction.java:431)
	at org.apache.ambari.server.serveraction.kerberos.ConfigureAmbariIdentitiesServerAction.execute(ConfigureAmbariIdentitiesServerAction.java:83)
	at org.apache.ambari.server.serveraction.ServerActionExecutor$Worker.execute(ServerActionExecutor.java:550)
	at org.apache.ambari.server.serveraction.ServerActionExecutor$Worker.run(ServerActionExecutor.java:466)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.ambari.server.AmbariException: sudo: no tty present and no askpass program specified


	at org.apache.ambari.server.serveraction.kerberos.ConfigureAmbariIdentitiesServerAction.installAmbariServerIdentity(ConfigureAmbariIdentitiesServerAction.java:206)
	at org.apache.ambari.server.serveraction.kerberos.ConfigureAmbariIdentitiesServerAction.processIdentity(ConfigureAmbariIdentitiesServerAction.java:136)
	at org.apache.ambari.server.serveraction.kerberos.KerberosServerAction.processRecord(KerberosServerAction.java:538)
	at org.apache.ambari.server.serveraction.kerberos.KerberosServerAction.processIdentities(KerberosServerAction.java:420)
	... 4 more
Caused by: org.apache.ambari.server.AmbariException: sudo: no tty present and no askpass program specified


	at org.apache.ambari.server.serveraction.kerberos.ConfigureAmbariIdentitiesServerAction.copyFile(ConfigureAmbariIdentitiesServerAction.java:277)
	at org.apache.ambari.server.serveraction.kerberos.ConfigureAmbariIdentitiesServerAction.installAmbariServerIdentity(ConfigureAmbariIdentitiesServerAction.java:178)
	... 7 more
20 Jul 2018 01:15:04,008 ERROR [ambari-action-scheduler] ActionScheduler:447 - Operation completely failed, aborting request id: 281
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname flx86 role KERBEROS_CLIENT requestId 281 taskId 4738 stageId 4
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname flx87 role KERBEROS_CLIENT requestId 281 taskId 4739 stageId 4
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname flx89 role KERBEROS_CLIENT requestId 281 taskId 4740 stageId 4
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname flx90 role KERBEROS_CLIENT requestId 281 taskId 4741 stageId 4
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname flx91 role KERBEROS_CLIENT requestId 281 taskId 4742 stageId 4
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname flx92 role KERBEROS_CLIENT requestId 281 taskId 4743 stageId 4
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname flx93 role KERBEROS_CLIENT requestId 281 taskId 4744 stageId 4
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname null role AMBARI_SERVER_ACTION requestId 281 taskId 4745 stageId 5
20 Jul 2018 01:15:04,012  INFO [ambari-action-scheduler] ActionDBAccessorImpl:218 - Aborting command. Hostname null role AMBARI_SERVER_ACTION requestId 281 taskId 4746 stageId 6
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Why "sudo: no tty present and no askpass program specified" occured even I'm running ambari with root user ?

Are you really sure Ambari is running as root. Try doing a ps to be sure:

# ps -ef | grep AmbariServer
root      3927 13603  0 18:15 pts/0    00:00:00 grep --color=auto AmbariServer
root     28360     1  2 16:05 pts/0    00:03:22 /usr/jdk64/jdk1.8.0_77/bin/java -server -XX:NewRatio=3 -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -Dsun.zip.disableMemoryMapping=true -Xms512m -Xmx2048m -XX:MaxPermSize=128m -Djava.security.auth.login.config=/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false -Xms512m -Xmx2048m -XX:MaxPermSize=128m -Djava.security.auth.login.config=/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false -cp /etc/ambari-server/conf:/usr/lib/ambari-server/*:/usr/share/java/postgresql-jdbc.jar org.apache.ambari.server.controller.AmbariServer

If Ambari is running as root, does root have a uid and gid of 0?

# id root
uid=0(root) gid=0(root) groups=0(root)

View solution in original post

2 REPLIES 2
Highlighted

Re: Why "sudo: no tty present and no askpass program specified" occured even I'm running ambari with root user ?

Are you really sure Ambari is running as root. Try doing a ps to be sure:

# ps -ef | grep AmbariServer
root      3927 13603  0 18:15 pts/0    00:00:00 grep --color=auto AmbariServer
root     28360     1  2 16:05 pts/0    00:03:22 /usr/jdk64/jdk1.8.0_77/bin/java -server -XX:NewRatio=3 -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -Dsun.zip.disableMemoryMapping=true -Xms512m -Xmx2048m -XX:MaxPermSize=128m -Djava.security.auth.login.config=/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false -Xms512m -Xmx2048m -XX:MaxPermSize=128m -Djava.security.auth.login.config=/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false -cp /etc/ambari-server/conf:/usr/lib/ambari-server/*:/usr/share/java/postgresql-jdbc.jar org.apache.ambari.server.controller.AmbariServer

If Ambari is running as root, does root have a uid and gid of 0?

# id root
uid=0(root) gid=0(root) groups=0(root)

View solution in original post

Highlighted

Re: Why "sudo: no tty present and no askpass program specified" occured even I'm running ambari with root user ?

New Contributor

That's Cool ! Indeed The ambari-server was not running under root user but under the user I don't even know. I run the ambari-server setup again.And It works now ! Thank you !