# Newly installed Jenkins 2.387 with java-11, jenkins service failed to start

**URL:** <https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357>\
**Category:** Ask a question\
**Created:** [May 12, 2023, 10:19pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357 "2023-05-12T22:19:41Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 16, 2023, 10:39pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/22 "2023-05-16T22:39:21Z")

</div>

I have GitLab installed on same server which is using port “8080”, can I change port to 9090 to this /usr/lib/systemd/system/jenkins.service file ?

# Port to listen on for HTTP requests. Set to -1 to disable.

# To be able to listen on privileged ports (port numbers less than 1024),

# add the CAP\_NET\_BIND\_SERVICE capability to the AmbientCapabilities

# directive below.

Environment=“JENKINS\_PORT=9090”

Is there any other jenkins configuration files need to update port ? Thank you for the help

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 16, 2023, 10:44pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/23 "2023-05-16T22:44:17Z")

</div>

:/usr/lib/systemd/system\>sudo service jenkins start  
Starting jenkins (via systemctl): Warning: jenkins.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.  
Job for jenkins.service failed because the control process exited with error code. See “systemctl status jenkins.service” and “journalctl -xe” for details.  
[FAILED]  
:/usr/lib/systemd/system\>sudo journalctl -u jenkins.service -e -n 100  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:304)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at org.eclipse.jetty.server.Server.lambda$doStart$0(Server.java:402)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at org.eclipse.jetty.server.Server.doStart(Server.java:398)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at winstone.Launcher.(Launcher.java:168)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: Caused: java.io.IOException: Failed to start Jetty  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at winstone.Launcher.(Launcher.java:172)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at winstone.Launcher.main(Launcher.java:390)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at java.base/java.lang.reflect.Method.invoke(Method.java:566)  
May 16 15:41:56 mcdasatest07 jenkins[21769]: at executable.Main.main(Main.java:347)  
May 16 15:41:56 mcdasatest07 systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE  
May 16 15:41:56 mcdasatest07 systemd[1]: Failed to start My Company Jenkins Controller.  
May 16 15:41:56 mcdasatest07 systemd[1]: Unit jenkins.service entered failed state.  
May 16 15:41:56 mcdasatest07 systemd[1]: jenkins.service failed.  
May 16 15:41:57 mcdasatest07 systemd[1]: jenkins.service holdoff time over, scheduling restart.  
May 16 15:41:57 mcdasatest07 systemd[1]: Stopped My Company Jenkins Controller.  
May 16 15:41:57 mcdasatest07 systemd[1]: Starting My Company Jenkins Controller…  
May 16 15:41:58 mcdasatest07 jenkins[22044]: Running from: /usr/share/java/jenkins.war  
May 16 15:41:59 mcdasatest07 jenkins[22044]: 2023-05-16 22:41:59.000+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction f  
May 16 15:41:59 mcdasatest07 jenkins[22044]: 2023-05-16 22:41:59.428+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-10.0  
May 16 15:41:59 mcdasatest07 jenkins[22044]: 2023-05-16 22:41:59.524+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStop: Stopped Ser  
May 16 15:41:59 mcdasatest07 jenkins[22044]: 2023-05-16 22:41:59.524+0000 [id=1] INFO winstone.Logger#logInternal: Jetty shutdown success  
May 16 15:41:59 mcdasatest07 jenkins[22044]: java.io.IOException: Failed to start Jetty  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at winstone.Launcher.(Launcher.java:172)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at winstone.Launcher.main(Launcher.java:390)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at java.base/java.lang.reflect.Method.invoke(Method.java:566)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at executable.Main.main(Main.java:347)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:304)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at org.eclipse.jetty.server.Server.lambda$doStart$0(Server.java:402)  
May 16 15:41:59 mcdasatest07 jenkins[22044]: at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)  
May 16 15:41:59 mcdasatest07 systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE  
May 16 15:41:59 mcdasatest07 systemd[1]: Failed to start My Company Jenkins Controller.  
May 16 15:41:59 mcdasatest07 systemd[1]: Unit jenkins.service entered failed state.  
May 16 15:41:59 mcdasatest07 systemd[1]: jenkins.service failed.  
May 16 15:41:59 mcdasatest07 systemd[1]: jenkins.service holdoff time over, scheduling restart.  
May 16 15:41:59 mcdasatest07 systemd[1]: Stopped My Company Jenkins Controller.  
May 16 15:41:59 mcdasatest07 systemd[1]: start request repeated too quickly for jenkins.service  
May 16 15:41:59 mcdasatest07 systemd[1]: Failed to start My Company Jenkins Controller.  
May 16 15:41:59 mcdasatest07 systemd[1]: Unit jenkins.service entered failed state.  
May 16 15:41:59 mcdasatest07 systemd[1]: jenkins.service failed.  
lines 44-101/101 (END)

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 17, 2023, 8:33pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/24 "2023-05-17T20:33:31Z")

</div>

Thank you MarkEWaite.

1. made change in /usr/lib/systemd/system/jenkins.service: Environment=“JENKINS\_PORT=9090”, same failed
2. Google search asked to make change in **/etc/default/jenkins** , could find the path, the jenkins file doesn’t exist
3. Suggested to run command as java -jar jenkins.war --httpPort=‘xyz’, wil it work?

---

<div class="post-metadata">

**Author:** ![MarkEWaite](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/markewaite/32/20_2.png) [@MarkEWaite](https://community.jenkins.io/u/MarkEWaite)\
**Post date:** [May 17, 2023, 8:34pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/25 "2023-05-17T20:34:03Z")

</div>

> [@hollychen](#):
>
> Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080

The port Jenkins uses can be changed with `systemctl edit jenkins` as described in [“Overriding service configurations”](https://www.jenkins.io/doc/book/system-administration/systemd-services/#overriding-service-configurations). It should be changed in the override file that the `systemctl edit jenkins` command creates.

That file might look like this:

```auto
[Unit]
Description=Jenkins on port 9090
[Service]
# Port to listen on for HTTP requests. Set to -1 to disable.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
Environment="JENKINS_PORT=9090"

```

Note that the `[SERVICE]` line in the definition is mandatory. Without it, systemd will ignore the settings.

A video is also available that describes how to manage services with `systemd`.

[![](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/f/f5dbac50169273c343fa6f080438554fb5dee035.jpeg "Simplifying Parallel Pipeline Creation in Jenkins") ](https://www.youtube.com/watch?v=HsvO2nDlDSI)

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 17, 2023, 9:05pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/26 "2023-05-17T21:05:56Z")

</div>

Thanks for your information. How could I save the file and exit the file after code added?

---

<div class="post-metadata">

**Author:** ![MarkEWaite](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/markewaite/32/20_2.png) [@MarkEWaite](https://community.jenkins.io/u/MarkEWaite)\
**Post date:** [May 17, 2023, 9:14pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/27 "2023-05-17T21:14:09Z")

</div>

When `systemctl edit jenkins` opens, it uses the system configured editor. When the file is saved from that system configured editor, the configuration is saved and `systemd` reloads the configuration.

If using `vi`, then the exit command is `:wq`

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 17, 2023, 9:24pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/28 "2023-05-17T21:24:51Z")

</div>

When systemctl edit jenkins:

[Unit]  
Description=My Company Jenkins Controller

[Service]

Add JVM configuration options  
Environment=“JAVA\_OPTS=-Djava.awt.headless=true -XX:+UseStringDeduplication”

Arbitrary additional arguments to pass to Jenkins.  
Full option list: java -jar jenkins.war --help  
Environment=“JENKINS\_OPTS=–prefix=/jenkins --javaHome=/usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.el7\_9.x86\_64”

Configuration as code directory  
Environment=“CASC\_JENKINS\_CONFIG=/var/lib/jenkins/configuration-as-code/”  
[Unit]  
Description=Jenkins on port 9080  
[Service]

Port to listen on for HTTP requests. Set to -1 to disable.  
To be able to listen on privileged ports (port numbers less than 1024),  
add the CAP\_NET\_BIND\_SERVICE capability to the AmbientCapabilities  
directive below.  
Environment=“JENKINS\_PORT=9080”

after save, run  
:/usr/lib/systemd/system\>systemctl start Jenkins  
Failed to start Jenkins.service: Unit not found.

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 17, 2023, 9:55pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/29 "2023-05-17T21:55:34Z")

</div>

**When systemctl edit jenkins:**

**[Unit]**  
**Description=Jenkins on port 9080**  
**[Service]**  
**# Add JVM configuration options**  
**Environment=“JAVA\_OPTS=-Djava.awt.headless=true -XX:+UseStringDeduplication”**

**# Arbitrary additional arguments to pass to Jenkins.**  
**# Full option list: java -jar jenkins.war --help**  
**Environment=“JENKINS\_OPTS=–prefix=/jenkins --javaHome=/usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.el7\_9.x86\_64”**

**# Configuration as code directory**  
**Environment=“CASC\_JENKINS\_CONFIG=/var/lib/jenkins/configuration-as-code/”**

**# Port to listen on for HTTP requests. Set to -1 to disable.**  
**# To be able to listen on privileged ports (port numbers less than 1024),**  
**# add the CAP\_NET\_BIND\_SERVICE capability to the AmbientCapabilities**  
**# directive below.**  
**Environment=“JENKINS\_PORT=9080”**

after save, run  
:/usr/lib/systemd/system\>systemctl start Jenkins  
Failed to start Jenkins.service: Unit not found.  
:/usr/lib/systemd/system\>systemctl edit jenkins

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 17, 2023, 4:44pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/30 "2023-05-17T16:44:24Z")

</div>

1. made change in /usr/lib/systemd/system/jenkins.service: Environment=“JENKINS\_PORT=9090”, failed
2. Google search asked to make change in **/etc/default/jenkins** , could find the path
3. Suggested to run command as java -jar jenkins.war --httpPort=‘xyz’, wil it work? Please advise.

Thank you  
Holly

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [May 17, 2023, 4:47pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/31 "2023-05-17T16:47:01Z")

</div>

You’ll want to read this guide: [Managing systemd services](https://www.jenkins.io/doc/book/system-administration/systemd-services/)

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 17, 2023, 7:25pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/32 "2023-05-17T19:25:37Z")

</div>

Thank you for the responding lide\_o\_mix. I did, made change in /usr/lib/systemd/system/jenkins.service with:

````auto
[Unit]
Description=My Company Jenkins Controller

[Service]
# Add JVM configuration options
Environment="JAVA_OPTS=-Djava.awt.headless=true -XX:+UseStringDeduplication"

# Arbitrary additional arguments to pass to Jenkins.
# Full option list: java -jar jenkins.war --help
Environment="JENKINS_OPTS=--prefix=/jenkins --javaHome=/opt/jdk-11"

# Configuration as code directory
Environment="CASC_JENKINS_CONFIG=/var/lib/jenkins/configuration-as-code/"
```. keeps failing.
got log message as: Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080, we have GitLab using port 8080, I am change another port, but got issue in my first description.
````

---

<div class="post-metadata">

**Author:** ![MarkEWaite](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/markewaite/32/20_2.png) [@MarkEWaite](https://community.jenkins.io/u/MarkEWaite)\
**Post date:** [May 17, 2023, 8:41pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/33 "2023-05-17T20:41:07Z")

</div>

> [@hollychen](#):
>
> /usr/lib/systemd/system/jenkins.service

That’s not the correct location to make a change. On my Ubuntu 22 system, the `systemd` override file that is created by `systemctl edit jenkins` is in `/etc/systemd/system/jenkins.service.d/override.conf`. If you use the command `systemctl edit jenkins`, you’ll have a better experience and will be making the change in the correct file.

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 17, 2023, 10:15pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/34 "2023-05-17T22:15:02Z")

</div>

When systemctl edit jenkins:

```auto
[Unit]
Description=Jenkins on port 9080
[Service]
# Add JVM configuration options
Environment="JAVA_OPTS=-Djava.awt.headless=true -XX:+UseStringDeduplication"

# Arbitrary additional arguments to pass to Jenkins.
# Full option list: java -jar jenkins.war --help
Environment="JENKINS_OPTS=--prefix=/jenkins --javaHome=/usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.el7_9.x86_64"

# Configuration as code directory
Environment="CASC_JENKINS_CONFIG=/var/lib/jenkins/configuration-as-code/"

# Port to listen on for HTTP requests. Set to -1 to disable.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
Environment="JENKINS_PORT=9080"

```

after save, run  
:/usr/lib/systemd/system\>systemctl start Jenkins  
Failed to start Jenkins.service: Unit not found.

---

<div class="post-metadata">

**Author:** ![MarkEWaite](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/markewaite/32/20_2.png) [@MarkEWaite](https://community.jenkins.io/u/MarkEWaite)\
**Post date:** [May 18, 2023, 12:50pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/35 "2023-05-18T12:50:54Z")

</div>

> [@hollychen](#):
>
> systemctl start Jenkins

The command is case sensitive. You need

`systemctl start jenkins`

---

<div class="post-metadata">

**Author:** ![hollychen](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hollychen](https://community.jenkins.io/u/hollychen)\
**Post date:** [May 18, 2023, 2:39pm UTC](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357/36 "2023-05-18T14:39:02Z")

</div>

Good eye! Thank you for pointing it out. It works. Thanks everyone helped me out. Appreciated your help.

Holly

[Previous page](https://community.jenkins.io/t/newly-installed-jenkins-2-387-with-java-11-jenkins-service-failed-to-start/7357.md?page=1)
