25

Following this answer, I have tried restarting a Jenkins instance using:

(jenkins_url)/safeRestart

and

(jenkins_url)/restart

Both failed with the following message:

Jenkins cannot restart itself as currently configured.

Searching for Jenkins cannot restart itself as currently configured shows that the message appears when the app.lifecycle.canRestart is on, but I am not sure how to set it.

Any idea how to make Jenkins restartable?

enter image description here

Community
  • 1
  • 1
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
  • could be to user permissions somewhere? – ACV Sep 25 '15 at 20:22
  • No, I created the instance and I have all possible credentials. – Adam Matan Sep 25 '15 at 20:33
  • Logs say much of use? You can restart Jenkins through other means. – Arran Sep 25 '15 at 21:19
  • What is OS , Jenkins version? hudson.lifecycle.Lifecycle and its implementations controls this. There may more information in the jenkins log. Please post it here – Jayan Sep 26 '15 at 03:06
  • @Arran No, nothing useful there - no indication to the reboot request. I can obviously restart Jenkins externally, but I wonder what's the reason I can't do it internally. – Adam Matan Oct 05 '15 at 11:16
  • @Jayan Ubuntu 14.04, Jenkins version 1.612. – Adam Matan Oct 05 '15 at 11:17
  • Did you change any jenkins setting? User, jenkins home? I got similar error after removing permissions on jenkins war and its parent. That is probably expected: https://www.codatlas.com/github.com/jenkinsci/jenkins/master/core/src/main/java/hudson/lifecycle/UnixLifecycle.java?line=76 – Jayan Oct 05 '15 at 15:44
  • @Jayan No, I haven't changed them in ages. – Adam Matan Oct 05 '15 at 16:51

6 Answers6

11

Go to Manage Jenkins links. Find the option "Install as Windows service". Click on install. Now (jenkins_url)/restart option will work. I faced this same issue now

Shwetank Singh
  • 111
  • 1
  • 3
  • I'm using the generic Java version and it throws an AccessDenied error when I try the above. If anyone else has this problem the solution is the open cmd/terminal as admin or sudo and then run Jenkins e.g. `java -jar jenkins.war` – Tim Sep 17 '18 at 15:10
3

I installed Restart Safely plugin available in Jenkins Plugin Manager

Jenkins -> Manage Jenkins -> Manage Plugins -> Search for Safe Restart -> Install it.

Then Go to Manage Jenkins -> "Install as Windows service" -> install

Then Restart Safely appear on the Dashboard. Thanks to Shwetank Singh.

2

If your Jenkins instance's servlet container does not support a web application restarting its own context, then this plugin cannot provide restart functionality, and the “Restart Safely” link will not appear.

I'm using Apache Tomcat v7.0.64 and after installing SafeRestart Plugin I got the same message as you had.

I think it would be much simpler for you if you just run Jenkins with the embedded container and the service wrapper

2

I received such message when jenkins was started in command line (like java -jar jenkins.war)

After I started jenkins as a service (jenkins.exe install) and (jenkins.exe start) it began to work.

limon4ick
  • 39
  • 4
2

Restart your command prompt in Administrator mode. So that you are having your all permission to run window as a service.

1

To manually restart jenkins :

  1. Go to task manager and end all the java instances .
  2. Close command prompt .
  3. Open command prompt again, point the current directory where jenkins.war file is available.
  4. And fire the command java -jar jenkins.war .

I happen to face this problem where restart was required to update jenkins version , I tried by url but faced the error - jenkins cannot restart itself as currently configured. Tried above mentioned steps and it worked.