Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-34884

Not able to execute sudo command on "Send files or execute commands over SSH"

      Started by user Kumar
      Building on master in workspace /xxx/xxxxxx/xxx/xxxxxxxx
      Copied 1 artifact from "xxxxxxxx" build number xxx
      SSH: Connecting from host [xxxxxxxxxxxx]
      SSH: Connecting with configuration [xxxxxxxxx] ...
      SSH: EXEC: STDOUT/STDERR from command [sudo service tomcat7 stop] ...
      sudo: no tty present and no askpass program specified
      SSH: EXEC: completed after 200 ms
      SSH: Disconnecting configuration [xxxxxxxxx] ...
      ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [1]]
      Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
      Sending e-mails to: xxxxxxxxxxxxxxxxxx
      Started calculate disk usage of build
      Finished Calculation of disk usage of build in 0 seconds
      Started calculate disk usage of workspace
      Finished Calculation of disk usage of workspace in 0 seconds
      Finished: UNSTABLE

          [JENKINS-34884] Not able to execute sudo command on "Send files or execute commands over SSH"

          Kumar J created issue -
          Kumar J made changes -
          Description Original: Started by user Manoj Tumati
          Building on master in workspace /opt/jenkins/jobs/xxxxxxxx
          Copied 1 artifact from "xxxxxxxx" build number 366
          SSH: Connecting from host [xxxxxxxxxxxx]
          SSH: Connecting with configuration [xxxxxxxxx] ...
          SSH: EXEC: STDOUT/STDERR from command [sudo service tomcat7 stop] ...
          sudo: no tty present and no askpass program specified
          SSH: EXEC: completed after 200 ms
          SSH: Disconnecting configuration [xxxxxxxxx] ...
          ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [1]]
          Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
          Sending e-mails to: xxxxxxxxxxxxxxxxxx
          Started calculate disk usage of build
          Finished Calculation of disk usage of build in 0 seconds
          Started calculate disk usage of workspace
          Finished Calculation of disk usage of workspace in 0 seconds
          Finished: UNSTABLE
          New: Started by user Manoj Tumati
          Building on master in workspace /xxx/xxxxxx/xxx/xxxxxxxx
          Copied 1 artifact from "xxxxxxxx" build number xxx
          SSH: Connecting from host [xxxxxxxxxxxx]
          SSH: Connecting with configuration [xxxxxxxxx] ...
          SSH: EXEC: STDOUT/STDERR from command [sudo service tomcat7 stop] ...
          sudo: no tty present and no askpass program specified
          SSH: EXEC: completed after 200 ms
          SSH: Disconnecting configuration [xxxxxxxxx] ...
          ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [1]]
          Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
          Sending e-mails to: xxxxxxxxxxxxxxxxxx
          Started calculate disk usage of build
          Finished Calculation of disk usage of build in 0 seconds
          Started calculate disk usage of workspace
          Finished Calculation of disk usage of workspace in 0 seconds
          Finished: UNSTABLE
          Oleg Nenashev made changes -
          Component/s New: publish-over-ssh-plugin [ 15792 ]
          Component/s Original: _unsorted [ 19622 ]
          Oleg Nenashev made changes -
          Assignee Original: Oleg Nenashev [ oleg_nenashev ] New: bap [ bap ]

          Oleg Nenashev added a comment -

          Fixed the component

          Oleg Nenashev added a comment - Fixed the component

          Kumar J added a comment -

          I am able to run this command "sudo service tomcat7 stop" from "Putty" and its working there.But it id giving error while running from jenkins.

          Even I can see this in "chkconfig --list" from "Putty"
          tomcat7 0:off 1:off 2:on 3:on 4:on 5:on 6:off

          Please give me solution for this

          Kumar J added a comment - I am able to run this command "sudo service tomcat7 stop" from "Putty" and its working there.But it id giving error while running from jenkins. Even I can see this in "chkconfig --list" from "Putty" tomcat7 0:off 1:off 2:on 3:on 4:on 5:on 6:off Please give me solution for this
          Kumar J made changes -
          Description Original: Started by user Manoj Tumati
          Building on master in workspace /xxx/xxxxxx/xxx/xxxxxxxx
          Copied 1 artifact from "xxxxxxxx" build number xxx
          SSH: Connecting from host [xxxxxxxxxxxx]
          SSH: Connecting with configuration [xxxxxxxxx] ...
          SSH: EXEC: STDOUT/STDERR from command [sudo service tomcat7 stop] ...
          sudo: no tty present and no askpass program specified
          SSH: EXEC: completed after 200 ms
          SSH: Disconnecting configuration [xxxxxxxxx] ...
          ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [1]]
          Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
          Sending e-mails to: xxxxxxxxxxxxxxxxxx
          Started calculate disk usage of build
          Finished Calculation of disk usage of build in 0 seconds
          Started calculate disk usage of workspace
          Finished Calculation of disk usage of workspace in 0 seconds
          Finished: UNSTABLE
          New: Started by user Kumar
          Building on master in workspace /xxx/xxxxxx/xxx/xxxxxxxx
          Copied 1 artifact from "xxxxxxxx" build number xxx
          SSH: Connecting from host [xxxxxxxxxxxx]
          SSH: Connecting with configuration [xxxxxxxxx] ...
          SSH: EXEC: STDOUT/STDERR from command [sudo service tomcat7 stop] ...
          sudo: no tty present and no askpass program specified
          SSH: EXEC: completed after 200 ms
          SSH: Disconnecting configuration [xxxxxxxxx] ...
          ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [1]]
          Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
          Sending e-mails to: xxxxxxxxxxxxxxxxxx
          Started calculate disk usage of build
          Finished Calculation of disk usage of build in 0 seconds
          Started calculate disk usage of workspace
          Finished Calculation of disk usage of workspace in 0 seconds
          Finished: UNSTABLE

          Oleg Nenashev added a comment -

          It's not a Jenkins issue. Your jenkins user on the slave/master just does not have appropriate permissions.
          Further reading: http://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error . There are also other many other pages with the solution in Google.

          Oleg Nenashev added a comment - It's not a Jenkins issue. Your jenkins user on the slave/master just does not have appropriate permissions. Further reading: http://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error . There are also other many other pages with the solution in Google.
          Oleg Nenashev made changes -
          Assignee Original: bap [ bap ] New: Oleg Nenashev [ oleg_nenashev ]

          bap added a comment -

          The answer is in this line of output:
          sudo: no tty present and no askpass program specified

          Check the "Exec in pty" Advanced option for the transfer set

          https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin#PublishOverSSHPlugin-Execinpty

          bap added a comment - The answer is in this line of output: sudo: no tty present and no askpass program specified Check the "Exec in pty" Advanced option for the transfer set https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin#PublishOverSSHPlugin-Execinpty

            oleg_nenashev Oleg Nenashev
            manojktumati Kumar J
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: