I try to install an old version of Jenkins (2.346.3 downloaded here ) because i need a java 8 compatible Jenkins.
Everything goes well while this screen :
I clic on Install suggested plugins and few seconds later I have this message :
With a standard installation there is the solution to increase the value of pluginManagerErrorTimeoutMillis in the file pluginSetupWizard.js as explained here
But with my installation the file pluginSetupWizard.js is minified and not in the /var/lib/jenkins directory.
So I tried to modify the files
/var/cache/jenkins/war/jsbundles/plugin-manager-ui.js.map
/var/cache/jenkins/war/jsbundles/pluginSetupWizard.js.map
Because they contain the variable pluginManagerErrorTimeoutMillis
then I do
systemctl daemon-reload
systemctl stop jenkins
systemctl start jenkins
but it does not work
I am currently stuck so do you know how can I increase this timeout in order to finish the jenkins installation ?
EDIT
So I found the solution :
I change the value in
/var/cache/jenkins/war/jsbundles/plugin-manager-ui.js
o=1e4 to o=1e6
and it works.
But I think this value should be increased by default in Jenkins.
Related
My Jenkins is running on CentOS 7 and I was looking to upgrade my Jenkins version 2.277.4 to 2.375.1. I tried using sudo yum update jenkins to update jenkins. I received this message: “Public key for jenkins-2.375.1-1.1.noarch.rpm is not installed”. I read an article telling me to pull the key from online, so I performed these commands:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --no-check-certificate
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo yum update jenkins
Afterwards, I haven’t been able to correctly start Jenkins. Obviously, I should have just uploaded the new war file instead of using yum update.
Any time I try Sudo systemctl start jenkins I get this warning.
Warning: jenkins.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.
Any suggestions on fixing this issue? Any way to revert back to the old version?
Thank you ahead of time!
**Edit: I tried reloading the daemon and restarting the service. However, my Jenkins start/restart is timing out even though I’ve set the timer to 10 mins.
Additionally, I installed java-11-openjdk during the upgrade, would that cause issues?
For a few days I am trying to set Jenkins on Tomcat7 without any result... I read many tutorials and I could not find any help...
I set a virtual system on VirtualBox -> Ubuntu 12.04.04
Using apt-get I installed tomcat7, and then Jenkins.
While using them separately by usingcommad sudo service tomcat7 start or sudo service jenkins start both services starts and are visable on my localhost.
However, when I copied jenkins.war to /var/lib/tomcat7/webapps I cannot run it via tomcat.
I have set JENKINS_HOME as /var/lib/jenkins.
In the folder /usr/share/tomcat7 i run these commands: sudo mkdir .jenkins | sudo chown tomcat7:nogroup .jenkins
And from localhost:8080/manager jenkins is viable:
When I try localhost:8080/jenkins as tutorials says I get en error message:
I really have no idea what am I doing wrong...
What else may I try to make it work?
I had the same issue. Please check Java compatibility version with the "Jenkins.war" file. I used Java 8 for Jenkins version 2.107.1.
I would suggest to shutdown restart the tomcat server. As it should be able to read the .war file. Hence, you will go through additional setup.
Check the version of your jenkins.war file
Check the compatibe java version for hat jenkins version in web
Download that version of java and define system environment variables path for JAVA_HOME
Open "Monitor tomcat" in that JAVA define the path of jvm.dll
example C:\Program Files\Java\jdk-11.0.16\bin\server\jvm.dll
This picture shows how to run in windows:
Please check your JRE path, as I face a similar issue where JRE_HOME was incorrectly set
JRE_HOME=/usr/jdk/jdk1.6.0_21,
It started working when I correct it to latest JRE version
JRE_HOME=/usr/jdk/jdk1.7.0_09/jre.
Does anyone know how to increase the the timeout window before Jenkins logs out a user? I'm looking to raise it to 1 day or so.
I work in and out jenkins all day and we keep getting logged out between running of jobs. Added to this frustration, the 'stay logged in' checkbox doesn't seem to work either.
Jenkins uses Jetty, and Jetty's default timeout is 30 minutes. This is independent of authentication settings -- I use Active Directory but it's still this setting that affects timeouts.
You can override the timeout by passing an argument --sessionTimeout=<minutes> to the Jenkins init script, or -DsessionTimeout=<minutes> to the .war file. For example:
# Set the session timeout to 1 week
$ java -jar jenkins.war --sessionTimeout=10080
Alternatively, you can edit Jenkins' <jenkinsHome>/.jenkins/war/WEB-INF/web.xml and add explicitly set it:
<session-config>
<!-- one hour -->
<session-timeout>60</session-timeout>
</session-config>
According to Oracle's docs you can set this to 0 to disable timeouts altogether.
To find out the current value for timeouts, you can use the Groovy console provided in Jenkins:
import org.kohsuke.stapler.Stapler;
Stapler.getCurrentRequest().getSession().getMaxInactiveInterval() / 60
On my instance, this shows Result: 30.
As of Jenkins version 2.107.2 you'll want to include sessionEviction
For example to keep people logged in for 24 hours and 12 hours of inactivity:
--sessionTimeout=1440 --sessionEviction=43200
If you don't specify sessionEviction people who close the tab will get logged out after 30 minutes.
For Ubuntu:
nano /etc/default/jenkins
Append to JENKINS_ARGS at the end of the file:
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --sessionTimeout=1440 --sessionEviction=43200"
As of 1.528 you can use the --sessionTimeout <minutes> parameter when starting up jenkins via an init script. If starting the war, pass in -DsessionTimeout=<minutes>
Update for 1.6
If passing in as an arg use --sessionTimeout=<minutes>
it also seems possible to set it using groovy console:
import org.kohsuke.stapler.Stapler;
Stapler.getCurrentRequest().getSession().setMaxInactiveInterval(TIME_IN_SECONDS)
But I guess it will only be available for current session
On my Linux distro, this setting can be added to /etc/sysconfig/jenkins
# Pass arbitrary arguments to Jenkins.
# Full option list: java -jar jenkins.war --help
#
JENKINS_ARGS="--sessionTimeout=480"
Subsequently, restart with
sudo /etc/init.d/jenkins restart
This version of Jenkins 1.567 also has the enable auto refresh option so it somehow keeps refreshing the session and I never get logged out. It works for me...
If Jenkins is running as a Windows service (jenkins.exe), parameters can be edited in jenkins.xml in the installation directory.
Working with Jenkins 2.2x on Windows Server as a windows service the setting
--sessionTimeout=1440 --sessionEviction=43200
can be added here
<arguments>... -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" ... --sessionTimeout=1440 --sessionEviction=43200</arguments>
located in file jenkins.xml in the Jenkins folder, which for me was:
C:\Program Files\Jenkins on Windows Server 2012.
C:\Program Files (x86)\Jenkins on Windows Server 2008 R2
Restart the service for the change to take effect.
After dealing with this for a couple hours and making sense of everything said here this is what I did to solve the issue:
Log as sudo user
cd /var/cache/jenkins/war/WEB-INF/
vi web.xml
Type "i" to go to insert mode
Go down until you find <Session-Config> and type as screenshot
Hit Esc
Type :wd to save your changes
sudo systemctl restart jenkins
Screenshot:
For anyone on CentOS, web.xml will likely be in /var/lib/jenkins/%C/jenkins/war/WEB-INF/. In web.xml, you can add the session timeout and eviction settings to the session config like so:
<session-config>
<session-timeout>480</session-timeout>
<session-eviction>12600</session-eviction>
</session-config>
Leaving this here for anyone who struggled to find that file like I did.
I used this procedure to install Jenkins:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+RedHat+distributions
After it was up and running I discovered the /var/lib/jenkins partition on my server is very small. I want to move it, but I do not want to change the user that it runs under. I am new to Linux and I'm stumped. How do I move it for example to my Home/Public folder? The "Jenkins" user doesn't seem to have a Home folder. Its running as a daemon on startup, so I have no idea where to configure those settings.
Can I create a Home folder for the Jenkins user? How?
I read this article:
https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins
but do not understand HOW to "set the new Jenkins home". I have used the export command, and restarted the service, but the old path still shows up in the Manage Jenkins screens.
I've read the 2-3 similar questions on stackoverflow also, but there's always a big missing piece for me. Where to find that file where I change the path permanently?
Here's an easy way to solve your problem. First, move the Jenkins directory from /var/lib/jenkins to /home/jenkins. Then create a symlink at /var/lib/jenkins pointing to /home/jenkins. And of course, stop the Jenkins service before doing that.
sudo service jenkins stop
sudo mv /var/lib/jenkins /home
sudo ln -s /home/jenkins /var/lib/jenkins
sudo service jenkins start
I managed to change the home location for Jenkins by modifying content of /etc/sysconfig/jenkins file as follows:
JENKINS_HOME="/home/jenkins"
Okay, I reread your question a little bit more closely, lets see if we can figure this out. I am going to list some info that you may or may not know.
The jenkins installation and jenkins home are not the same thing. One is where the war file and other parts that jenkins needs to run live. jenkins_home is where your data is stored. By default, jenkins_home lives in ~/.jenkins. When you start jenkins, it looks for an environment variable to tell it where to find those files.
Jenkins runs as a seperate user, which, by default, is jenkins. This way it doesn't get in the way of you. The jenkins user will not have access to YOUR home directory, so that would be a poor solution. Ideally, it would have its own home directory, /home/jenkins. Your home directory could then be /home/jenkins/.jenkins. You say that folder doesn't exist- if you don't have access to it to create it yourself, that is perfectly fine, you can specify ANY folder. However, the jenkins user must have ownership of that folder to read and write to it.
It looks like Jenkins on redhat will be running with tomcat by default. The documentation for how to set environment variables for tomcat is https://wiki.jenkins-ci.org/display/JENKINS/Tomcat
This all gets set up with a script.https://wiki.jenkins-ci.org/display/JENKINS/JenkinsLinuxStartupScript seems to be the one that is used for this purpose. Even if you don't know anything about shell scripting, this isn't too hard... lines with a # are comments. The first line
JENKINS_USER=jenkins
sets the name of the user account jenkins will be using. Look down a littlle further, and you'll see the line
export JENKINS_BASEDIR=/home/jenkins
export CATALINA_OPTS="-DJENKINS_HOME=$JENKINS_BASEDIR/jenkins-home -Xmx512m -Djava.awt.headless=true"
This lets you set a directory to where jenkins should live, and then sets the jenkins_home directory to that /jenkins-home.
For your application, you may want to do something like this
export CATALINA_OPTS="-DJENKINS_HOME=/var/jenkinsmount/home -Xmx512m -Djava.awt.headless=true"
That would then store all of your build data (which is the part that grows!) at /var/jenkinsmount/home ... while leaving the rest of your files in their current location.
I haven't used it on redhat, but hopefully I explained enough for you to actually understand what is going on so that you can get it going!
Other INFO:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Unix+daemon
I have faced the same issue and question.
Connecting some dots I could fix my Jenkins after I moved Jenkins to a new location due to the same issue -space in disk under /var/lib/jenkins.
Here is the procedures that I had to follow to get it working taking in consideration that I am pointing Jenkins to a non-default port. (I have applied this process into 2 servers)
First, move the Jenkins directory from /var/lib/jenkins to /opt/jenkins
sudo service jenkins stop
sudo mv /var/lib/jenkins /opt/
Now you can change your workspace and build directory to any other location on your machine.
Jenkins provides 3 predefined variables that can be used to specify the new location:
JENKINS_HOME — Jenkins home directory
ITEM_ROOTDIR — Root directory of a job for which the workspace is allocated
ITEM_FULLNAME — ‘/’-separated job name, like “foo/bar”
sudo su jenkins (access as Jenkins user)
JENKINS_HOME=/opt/jenkins
ITEM_ROOTDIR=/opt/jenkins
ITEM_FULLNAME=/opt/jenkins
exit (exit Jenkins user)
Now, edit the jenkins config
/opt/jenkins$ sudo nano /etc/default/jenkins
Modify the following line
#jenkins home location
#JENKINS_HOME=/var/lib/$NAME (here is the default)
JENKINS_HOME=/opt/jenkins (that is our new location)
change the home directory of a user
sudo usermod -d /opt/jenkins/ jenkins
sudo service jenkins start
If anyone is having issues with space and you have to relocate your jenkins, just wanted to reiterate that::
sudo service jenkins stop
sudo mv /var/lib/jenkins /home
sudo ln -s /home/jenkins /var/lib/jenkins
sudo service jenkins start
works great, so thanks to the person who posted that answer a few years ago!
Richard Chen's location is where I found the jenkins file on my CentOS 6.6 system.
sudo service jenkins stop
mv /var/lib/jenkins /home/mylocation/
(made sure the new location had correct ownership and group-- Jenkins)
modified the content of the file /etc/sysconfig/jenkins as follows:
JENKINS_HOME="/home/mylocation"
sudo service jenkins start
If all these don't work, then the only solution that works is to edit the following file
/lib/systemd/system/jenkins.service
then need to execute reloading of configs by running
systemctl daemon-reload
after this restarting the service would reflect the change.
Some commands work for me as below:
Step 1: Stop jenkin service and moving folder
systemctl stop jenkins
mv /var/lib/jenkins /whatever/folder
sudo chown jenkins -R /whatever/folder
Step 2: Modify jenkins home location in /etc/default/jenkins
JENKINS_HOME=/whatever/folder/$NAME
Step 3: Restart jenkins service
systemctl start jenkins
[A] Find your current jenkins home folder, if you are not aware where it is ?
Jenkins -> Manage Jenkins -> Configure System -> Check label 'Home directory'
[B] To move current Jenkins home folder to a new directory. Follow below steps :-
Stop Jenkins service - by killing the process
Follow one of below approach to set new home folder for JENKINS.
a) By default Jenkins home directory is set to ~/.jenkins
b) "JENKINS_HOME" environment variable setup in operating system.
c) "JENKINS_HOME" entry in JNDI environment.
d) "JENKINS_HOME" system property to the servlet container.
Tomcat context descriptor of the servlet, you can set below field in apache-tomcat-8.5.28/conf/context.xml :
<Context ...>
<Environment name="JENKINS_HOME" value="/path/to/jenkins_home/" type="java.lang.String"/>
</Context>
e) If jenkins.war file is deployed in a tomcat server , then even appending below content in bin/catalina.sh will setup JENKINS_HOME.
CATALINA_OPTS="-DJENKINS_HOME=/path_to/jenkins_home/"
Manually copy Jenkins home folder content from old to new home
folder. (use cp command) . Instead of moving, copy step is advised to keep one backup. Later you can delete old workspace.
Now start Jenkins, then It will pick the new home directory
from the path mentioned in JENKINS_HOME variable.
Note: - Just by setting above variable "JENKINS_HOME" to a different path will not copy
the files from current Jenkins home path to new one automatically. This copy step - you have to do it yourself, Manually.
I am running Jenkins on a Linux server and shows the wrong time :(
Situation:
I am running another java app (in tomcat that also runs Jenkins) that shows the correct time in the log files (I use Logback through slf4j).
The bios is set to the UTC time (system clock) like advises here: http://www.linuxsa.org.au/tips/time.html
In Linux it's indicated in /etc/sysconfig/clock that the system clock is set to UTC and in which timezone we are located. I am in UTC+1
Running date command on Linux shows the correct local time. Example:
Sun Jan 8 12:11:35 CET 2012
But Jenkins shows the time plus 1 hour :(...
The jenkins config shows:
user.timezone = Europe/Amsterdam (which is UTC+1).
I think that Jenkins (java) thinks the local clock is set to UTC such that 1 hour is added.
How do I solve this?
If you are running Jenkins with Docker, you can append -e JAVA_OPTS=-Duser.timezone=TZ to docker arguments.
docker run -e JAVA_OPTS=-Duser.timezone=$TZ jenkins
All available TZ can be found here.
See here: https://wiki.jenkins-ci.org/display/JENKINS/Change+time+zone
In short, you can set the system property, either modifying the JVM options,
java -Dorg.apache.commons.jelly.tags.fmt.timeZone=TZ ...
Or changing Jenkins configuration in /etc/default/jenkins (Debian) or /etc/sysconfig/jenkins (Red Hat):
JAVA_ARGS="-Dorg.apache.commons.jelly.tags.fmt.timeZone=America/New_York"
It also mentioned -Duser.timezone="..." is an option, but can cause problems / interfere with other contexts (some vague hand-waving & caveats: time travel is always unpredictable).
In general (in my experience), don't change the system time, since us, our servers & our data live in a global world & should be handling, sending, comparing all times in UTC until the latest possible moment: usually that's the GUI (presentation layer) just before being displayed (...if even then). (Our build system results actually produces data that is fed into another system in another time zone.)
On Jenkins 2.63 on Ubuntu 14.04.5 LTS setting
JAVA_ARGS="-Djava.awt.headless=true -Duser.timezone=America/Los_Angeles"
in /etc/default/jenkins and then doing
sudo service jenkins stop
sudo service jenkins start
worked for me to change the timezone from UTC to PDT.
Put this in a Dockerfile and it will work;
RUN echo "import hudson.model.*;" >
/var/jenkins_home/init.groovy.d/timezone.groovy && \
echo "import jenkins.model.*;" >>
/var/jenkins_home/init.groovy.d/timezone.groovy && \
echo "System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone',
'America/Denver')" >> /var/jenkins_home/init.groovy.d/timezone.groovy
$JENKINS_HOME/init.groovy.d/*.groovy will get executed at start up.
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone',
'America/Denver')
That sets the timezone.
For official Jenkins Docker image (lts:2.138.1), you should set Jenkins java options to your local TZ. You can use this env. variable in a docker run command or docker-compose as well.
See here: https://wiki.jenkins.io/display/JENKINS/Change+time+zone
JENKINS_JAVA_OPTIONS="-Duser.timezone=Europe/Paris"
In case you have additional slaves you can sync the clock by using ntp. On Linux you can run following commands for each slave:
sudo systemctl stop ntp
sudo ntpdate -qu 0.debian.pool.ntp.org
sudo systemctl restart ntp
sudo systemctl status ntp
The easiest way without restarting Jenkins:
Open "Manage Jenkins" -> "Script Console"
Run the script:
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'America/New_York')