Back

Explore Courses Blog Tutorials Interview Questions
+3 votes
1 view
in AWS by (12.9k points)
edited by

I'm using a EC2 server instance. Used the following to install Jenkins:

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -

sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'

sudo apt-get update

sudo apt-get install jenkins

but I need to install software on the Jenkins server so in my EC2 instance I did

sudo –s –H –u jenkins

to get into the jenkins server. Then I tried to do

sudo cabal install quickcheck

but it prompted me for jenkins password. I've been searching around the internet for 4hrs now and nothing is helping me get administrative privilege in the jenkins server.

So I'm building my project using the following command in shell:

sudo cabal clean

sudo cabal configure

sudo cabal build

sudo cabal install

This is the error I'm getting:

 Started by timer

Building in workspace /var/lib/jenkins/jobs/Finance/workspace

Checkout:workspace / /var/lib/jenkins/jobs/Finance/workspace - [email protected]

Using strategy: Default

Last Built Revision: Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master)

Fetching changes from 1 remote Git repository

Fetching upstream changes from origin

Commencing build of Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master)

Checking out Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master)

[workspace] $ /bin/sh -xe /tmp/hudson3500373817395137440.sh

+ sudo cabal clean

sudo: no tty present and no askpass program specified

Sorry, try again.

sudo: no tty present and no askpass program specified

Sorry, try again.

sudo: no tty present and no askpass program specified

Sorry, try again.

sudo: 3 incorrect password attempts

Build step 'Execute shell' marked build as failure

Sending e-mails to: [email protected]

ERROR: Could not connect to SMTP host: localhost, port: 25

javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;

  nested exception is:

    java.net.ConnectException: Connection refused

    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)

    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)

    at javax.mail.Service.connect(Service.java:295)

    at javax.mail.Service.connect(Service.java:176)

    at javax.mail.Service.connect(Service.java:125)

    at javax.mail.Transport.send0(Transport.java:194)

    at javax.mail.Transport.send(Transport.java:124)

    at hudson.tasks.MailSender.execute(MailSender.java:116)

    at hudson.tasks.Mailer.perform(Mailer.java:117)

    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)

    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814)

    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786)

    at hudson.model.Build$BuildExecution.post2(Build.java:183)

    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:733)

    at hudson.model.Run.execute(Run.java:1592)

    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)

    at hudson.model.ResourceController.execute(ResourceController.java:88)

    at hudson.model.Executor.run(Executor.java:237)

Caused by: java.net.ConnectException: Connection refused

    at java.net.PlainSocketImpl.socketConnect(Native Method)

    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)

    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)

    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)

    at java.net.Socket.connect(Socket.java:579)

    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286)

    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)

    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)

    ... 17 more

Finished: FAILURE

2 Answers

+4 votes
by (18.2k points)

Follow the below-mentioned steps to fix your error:

1. Stop Jenkins

2. Go to edit the config file. Path:/var/lib/jenkins/config.xml

3. Change the "use security" setting from true to false

4. Go to Jenkins dashboard and navigate to the configure security option, set it to "allow anyone to do anything" and allow user signup

5. Create a user on:

www.yoursite.com/securityRealm/addUser

6. Go back to Jenkins dashboard and to configure security and change it from "allow anyone to do anything" to what you want your users to be able to do.

by (12.9k points)
Nice explanation. Thanks!
+4 votes
by (108k points)

Just perform the following command:

sudo passwd jenkins

This should display the password of your Jenkins

by (12.9k points)
This works for me Thanks!

Browse Categories

...