Search code examples
ubuntujenkinsjenkins-pluginsjenkins-pipelinejenkins-cli

Jenkins throwing error: jenkins.model.InvalidBuildsDir: ${ITEM_ROOTDIR}/builds does not exist and probably cannot be created


i updated Jenkins from apt command line on Ubuntu,i did sudo apt upgrade jenkins immediately after update i am getting this:

jenkins.model.InvalidBuildsDir: ${ITEM_ROOTDIR}/builds does not exist and 
probably cannot be created
at jenkins.model.Jenkins.checkRawBuildsDir(Jenkins.java:3085)
at jenkins.model.Jenkins.loadConfig(Jenkins.java:3009)
Caused: java.io.IOException
at jenkins.model.Jenkins.loadConfig(Jenkins.java:3012)
at jenkins.model.Jenkins.access$1200(Jenkins.java:304)
at jenkins.model.Jenkins$14.run(Jenkins.java:3104)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run 
(TaskGraphBuilder.java:169)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1068)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker
(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused: org.jvnet.hudson.reactor.ReactorException
at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:282)
at jenkins.InitReactorRunner.run(InitReactorRunner.java:48)
at jenkins.model.Jenkins.executeReactor(Jenkins.java:1102)
at jenkins.model.Jenkins.<init>(Jenkins.java:904)
at hudson.model.Hudson.<init>(Hudson.java:85)
at hudson.model.Hudson.<init>(Hudson.java:81)
at hudson.WebAppMain$3.run(WebAppMain.java:233)
Caused: hudson.util.HudsonFailedToLoad
at hudson.WebAppMain$3.run(WebAppMain.java:250)

Solution

  • I have experienced this when the $JENKINS_HOME/jobs directory had incorrect permissions or ownership. In my specific case I had rsync'ed jobs to a test server and forgot to update file ownership to match the user Jenkins runs under on the test system. Changing ownership to the correct user resolved the issue.

    There are probably a number of reasons why this error can occur, but I would start by reviewing the files and directories under $JENKINS_HOME to verify that the user running the Jenkins process can read and write to them.