Unable to Launch an Agent, getting "received junk text is as follows: stdin: is not a tty"

50 views
Skip to first unread message

Philippe M.

unread,
Dec 21, 2018, 11:20:26 AM12/21/18
to Jenkins Users
Hello,

We are facing an issue using Jenkins 2.138.3 and connecting to certain machines (issue occurs with machines in  redhat 7.2, not in 6.4 but not sure it's related).

When we start the agent, we get this error, issue being that ssh gives "stdin: is not a tty"

Full Jenkins log:

SSHLauncher{host='XXX.XXX.X.XXX', port=22, credentialsId='XXXXXXXXXXXXXXXXXXX', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}

[12/21/18 16:41:19] [SSH] Opening SSH connection to XXX.XXX.X.XXX:22.

[12/21/18 16:41:19] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.

[12/21/18 16:41:19] [SSH] Authentication successful.

SSH connection reports a garbage before a command execution.

Check your .bashrc, .profile, and so on to make sure it is quiet.

The received junk text is as follows:

stdin: is not a tty

 

null

[12/21/18 16:41:20] Launch failed - cleaning up connection

[12/21/18 16:41:20] [SSH] Connection closed.


How can this be fixed, searching for similar issues, I see fixes related to sudoers but we are not sudoing here.
I also found issue could be triggered by Banner , but there is no banner either.

Note that if we try non interactive mode, we have this which explains the issue faced by Jenkins I guess:

ssh -T login@host:
stty: standard input: Inappropriate ioctl for device
stdin: is not a tty
stdin: is not a tty
stdin: is not a tty


I tried to disable in /etc/profile stty if in non interactive mode, it fixed :

stty: standard input: Inappropriate ioctl for device

So I now have:

ssh -T login@host:
stdin: is not a tty
stdin: is not a tty
stdin: is not a tty

But I am stuck here.

Thanks in advance for your help.
Regards

Mark Waite

unread,
Dec 21, 2018, 12:12:50 PM12/21/18
to Jenkins Users
You'll need to remove the entries in the '.profile' and/or '.bashrc' that are doing things which are not allowed in a non-interactive shell.  Either that, or wrap them in conditionals which prevent them from being executed in a non-interactive shell.

Mark Waite

Philippe M.

unread,
Dec 21, 2018, 2:37:07 PM12/21/18
to Jenkins Users
Thanks,
That's what I started to do , but how to find all of them ?
Do you have a tip ?

Thanks

Mark Waite

unread,
Dec 21, 2018, 3:07:57 PM12/21/18
to Jenkins Users
I inserted diagnostic print messages into my bashrc at almost every line so that I could tell exactly which line was causing the problem.  It was a coarse technique that helped me quickly detect the problem commands

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1e6f8395-c7c3-4151-ade6-1efeef217aff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Benjamin Primrose

unread,
Jan 2, 2019, 8:41:18 AM1/2/19
to jenkins...@googlegroups.com

When you find the interactive statements, you can wrap them in an ‘if [ ! –z “${PS1}” ]’ so they’re only executed when you log in interactively.  Don’t copy/paste that if statement, I’m on microslop so those are wonky quotes.

Ivan Fernandez Calvo

unread,
Jan 2, 2019, 2:17:52 PM1/2/19
to Jenkins Users
Hi,

Did you check to connect with the user from the command line from the Jenkins instance? try to execute the following command from the Jenkins instance with the same user that you use to run Jenkins

su jenkins
ssh USER@AGENT_HOST ls
ssh -T USER@AGENT_HOST ls
ssh -t USER@AGENT_HOST ls

check the shell used by that user in /etc/passwd

grep USER /etc/passwd

Do you use a key with passphrase or user and password?
Could you try with no host verification strategy?
Could you check the settings in /etc/ssh/sshd_config agent file?

grep -v -e "^#" -e "^$" /etc/ssh/sshd_config

Reply all
Reply to author
Forward
0 new messages