• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • packaging
    • None

      I just created a new Jenkins instance and I could not start the services.  Based on the logs it shows that 8080 was already used.  See below

      Dec 05 22:10:19 localhost systemd[1]: Started Jenkins Continuous Integration Server.
      ...skipping...
      Dec 05 21:54:11 localhost jenkins[82427]:         at org.eclipse.jetty.server.Server.lambda$doStart$0(Server.java:402)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
      Dec 05 21:54:11 localhost jenkins[82427]:         at org.eclipse.jetty.server.Server.doStart(Server.java:398)
      Dec 05 21:54:11 localhost jenkins[82427]:         at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
      Dec 05 21:54:11 localhost jenkins[82427]:         at winstone.Launcher.<init>(Launcher.java:205)
      Dec 05 21:54:11 localhost jenkins[82427]:         ... 6 more
      Dec 05 21:54:11 localhost jenkins[82427]: Caused by: java.net.BindException: Address already in use
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/sun.nio.ch.Net.bind0(Native Method)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/sun.nio.ch.Net.bind(Net.java:555)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
      Dec 05 21:54:11 localhost jenkins[82427]:         at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:339)
      Dec 05 21:54:11 localhost jenkins[82427]:         ... 21 more
      Dec 05 21:54:11 localhost jenkins[82427]: 2023-12-05 21:54:11.995+0000 [id=1]        SEVERE        winstone.Logger#logInternal: Container startup failed
      Dec 05 21:54:11 localhost jenkins[82427]: java.net.BindException: Address already in use
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/sun.nio.ch.Net.bind0(Native Method)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/sun.nio.ch.Net.bind(Net.java:555)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
      Dec 05 21:54:11 localhost jenkins[82427]:         at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:339)
      Dec 05 21:54:11 localhost jenkins[82427]: Caused: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
      Dec 05 21:54:11 localhost jenkins[82427]:         at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
      Dec 05 21:54:11 localhost jenkins[82427]:         at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:304)
      Dec 05 21:54:11 localhost jenkins[82427]:         at org.eclipse.jetty.server.Server.lambda$doStart$0(Server.java:402)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      Dec 05 21:54:11 localhost jenkins[82427]:         at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)

      Based on this logs, I follow the command

      systemctl edit jenkins and try to update the port using port 8090 using below values in the file.

      [Service]
      Environment="JENKINS_PORT=8090"

      Saved the file, restarted the services, stopped and started the services but error kept coming back to the same 8080 port already in use.  After restart i go back and put the update in and still will not take it.

      most of the Google answers were to use the above command until I found this.  This is the solution that worked.

      If jenkins installed as linux service, open the file /usr/lib/systemd/system/jenkins.service,search for the content "Environment="JENKINS_PORT=8080". Change the port number to your desired. Execute the commands

       systemctl daemon-reload
       systemctl restart jenkins.service `

      Access the Jenkins in browser with the new port number

      Source: https://askubuntu.com/questions/1398910/changed-jenkins-port-doesnt-applied

      I know it should not work based on your document but it worked.

      The fix i did and that worked, is this good for future use or did not go around the core issue?

          [JENKINS-72432] systemctl edit jenkins

          Basil Crow added a comment -

          open the file /usr/lib/systemd/system/jenkins.service

          Does that file contain this warning:

          #
          # This file is managed by systemd(1). Do NOT edit this file manually!
          # To override these settings, run:
          #
          #     systemctl edit jenkins
          #
          # For more information about drop-in files, see:
          #
          #     https://www.freedesktop.org/software/systemd/man/systemd.unit.html
          #
          

          If so, then the warning applies. What you attempted to do originally sounds like it should have worked, and does work on my local Ubuntu 22.04 system, so in order to provide assistance we would need more detailed steps to reproduce the problem from scratch.

          Basil Crow added a comment - open the file /usr/lib/systemd/system/jenkins.service Does that file contain this warning: # # This file is managed by systemd(1). Do NOT edit this file manually! # To override these settings, run: # # systemctl edit jenkins # # For more information about drop-in files, see: # # https://www.freedesktop.org/software/systemd/man/systemd.unit.html # If so, then the warning applies. What you attempted to do originally sounds like it should have worked, and does work on my local Ubuntu 22.04 system, so in order to provide assistance we would need more detailed steps to reproduce the problem from scratch.

          Kru added a comment -

          Hey Basil thanks for responding. I had forgotten about this open issue. This was 100% on my side and I was able to fix it.

          I did not read this comment fully. I was able to make this work by following proper guidelines in the comments. I needed to add the line changes needed in the block below two comments not modify the actual content below the comment lines.

              1. Editing /etc/systemd/system/jenkins.service.d/override.conf
              2. Anything between here and the comment below will become the new contents of the file

          [Service]
          Environment="JENKINS_PORT=8880"

              1. Lines below this comment will be discarded
              1. /usr/lib/systemd/system/jenkins.service
          1. #
          2. # This file is managed by systemd(1). Do NOT edit this file manually!
          3. # To override these settings, run:
          4. #
          5. # systemctl edit jenkins

          Kru added a comment - Hey Basil thanks for responding. I had forgotten about this open issue. This was 100% on my side and I was able to fix it. I did not read this comment fully. I was able to make this work by following proper guidelines in the comments. I needed to add the line changes needed in the block below two comments not modify the actual content below the comment lines. Editing /etc/systemd/system/jenkins.service.d/override.conf Anything between here and the comment below will become the new contents of the file [Service] Environment="JENKINS_PORT=8880" Lines below this comment will be discarded /usr/lib/systemd/system/jenkins.service # # This file is managed by systemd(1). Do NOT edit this file manually! # To override these settings, run: # # systemctl edit jenkins

          Kru added a comment -

          This was resolved by following what to do in the file below.

              1. Editing /etc/systemd/system/jenkins.service.d/override.conf
              2. Anything between here and the comment below will become the new contents of the file

          [Service]
          Environment="JENKINS_PORT=8880"

              1. Lines below this comment will be discarded
              1. /usr/lib/systemd/system/jenkins.service
          1. #
          2. # This file is managed by systemd(1). Do NOT edit this file manually!
          3. # To override these settings, run:
          4. #
          5. # systemctl edit jenkins

          Kru added a comment - This was resolved by following what to do in the file below. Editing /etc/systemd/system/jenkins.service.d/override.conf Anything between here and the comment below will become the new contents of the file [Service] Environment="JENKINS_PORT=8880" Lines below this comment will be discarded /usr/lib/systemd/system/jenkins.service # # This file is managed by systemd(1). Do NOT edit this file manually! # To override these settings, run: # # systemctl edit jenkins

            Unassigned Unassigned
            kru83 Kru
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: