Error initialising Jenkins. Operation not permitted

Hi,

last weekend I updated plugins in my Jenkins but it doesn’t quite initialise and start up.

I get the following error:

Running from: /usr/share/jenkins/jenkins.war
2023-01-23 10:46:55.296+0000 [id=1]	INFO	winstone.Logger#logInternal: Beginning extraction from war file
2023-01-23 10:46:55.345+0000 [id=1]	WARNING	o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2023-01-23 10:46:55.407+0000 [id=1]	INFO	org.eclipse.jetty.server.Server#doStart: jetty-10.0.12; built: 2022-09-14T01:54:40.076Z; git: 408d0139887e27a57b54ed52e2d92a36731a7e88; jvm 11.0.17+8
2023-01-23 10:46:55.812+0000 [id=1]	INFO	o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2023-01-23 10:46:55.903+0000 [id=1]	INFO	o.e.j.s.s.DefaultSessionIdManager#doStart: Session workerName=node0
2023-01-23 10:46:56.467+0000 [id=1]	INFO	hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2023-01-23 10:46:56.651+0000 [id=1]	INFO	o.e.j.s.handler.ContextHandler#doStart: Started w.@6719a5b8{Jenkins v2.375.2,/,file:///var/jenkins_cache/war/,AVAILABLE}{/var/jenkins_cache/war}
2023-01-23 10:46:56.677+0000 [id=1]	INFO	o.e.j.server.AbstractConnector#doStart: Started ServerConnector@385e9564{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2023-01-23 10:46:56.692+0000 [id=1]	INFO	org.eclipse.jetty.server.Server#doStart: Started Server@11c9af63{STARTING}[10.0.12,sto=0] @2017ms
2023-01-23 10:46:56.695+0000 [id=23]	INFO	winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2023-01-23 10:46:56.910+0000 [id=29]	INFO	jenkins.InitReactorRunner$1#onAttained: Started initialization
2023-01-23 10:46:57.363+0000 [id=29]	SEVERE	jenkins.InitReactorRunner$1#onTaskFailed: Failed Inspecting plugin /var/jenkins_home/plugins/lockable-resources.jpi
Also:   java.nio.file.FileSystemException: /var/jenkins_home/plugins/lockable-resources/js/lockable-resources.js: Operation not permitted
		at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:254)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:276)
		at java.base/java.nio.file.Files.setPosixFilePermissions(Files.java:2080)
		at jenkins.util.io.PathRemover.makeWritable(PathRemover.java:285)
		at jenkins.util.io.PathRemover.makeRemovable(PathRemover.java:258)
		at jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:238)
		at jenkins.util.io.PathRemover.tryRemoveFile(PathRemover.java:202)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:213)
		at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:224)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:212)
		at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:224)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:212)
		at jenkins.util.io.PathRemover.forceRemoveRecursive(PathRemover.java:93)
Also:   java.nio.file.FileSystemException: /var/jenkins_home/plugins/lockable-resources/js: Operation not permitted
		at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:254)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:276)
		at java.base/java.nio.file.Files.setPosixFilePermissions(Files.java:2080)
		at jenkins.util.io.PathRemover.makeWritable(PathRemover.java:285)
		at jenkins.util.io.PathRemover.makeRemovable(PathRemover.java:258)
		at jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:238)
		at jenkins.util.io.PathRemover.tryRemoveFile(PathRemover.java:202)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:213)
		at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:224)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:212)
		at jenkins.util.io.PathRemover.forceRemoveRecursive(PathRemover.java:93)
Also:   java.nio.file.FileSystemException: /var/jenkins_home/plugins/lockable-resources/css/style.css: Operation not permitted
		at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:254)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:276)
		at java.base/java.nio.file.Files.setPosixFilePermissions(Files.java:2080)
		at jenkins.util.io.PathRemover.makeWritable(PathRemover.java:285)
		at jenkins.util.io.PathRemover.makeRemovable(PathRemover.java:258)
		at jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:238)
		at jenkins.util.io.PathRemover.tryRemoveFile(PathRemover.java:202)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:213)
		at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:224)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:212)
		at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:224)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:212)
		at jenkins.util.io.PathRemover.forceRemoveRecursive(PathRemover.java:93)
Also:   java.nio.file.FileSystemException: /var/jenkins_home/plugins/lockable-resources/css: Operation not permitted
		at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:254)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:276)
		at java.base/java.nio.file.Files.setPosixFilePermissions(Files.java:2080)
		at jenkins.util.io.PathRemover.makeWritable(PathRemover.java:285)
		at jenkins.util.io.PathRemover.makeRemovable(PathRemover.java:258)
		at jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:238)
		at jenkins.util.io.PathRemover.tryRemoveFile(PathRemover.java:202)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:213)
		at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:224)
		at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:212)
		at jenkins.util.io.PathRemover.forceRemoveRecursive(PathRemover.java:93)
Also:   java.nio.file.FileSystemException: /var/jenkins_home/plugins/lockable-resources/WEB-INF/licenses.xml: Operation not permitted
		at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:254)
		at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:276)
		at java.base/java.nio.file.Files.setPosixFilePermissions(Files.java:2080)
..................
..................
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:933)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1077)
	at java.base/java.lang.Thread.run(Thread.java:829)
2023-01-23 10:47:50.916+0000 [id=18]	WARNING	h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID c8e6a344-5761-4a7d-9d61-2bd776a731ab
java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
	at jenkins.model.Jenkins.get(Jenkins.java:813)
	at hudson.plugins.locale.PluginImpl.get(PluginImpl.java:40)
	at hudson.plugins.locale.LocaleFilter.doFilter(LocaleFilter.java:31)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
	at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
	at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:60)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
	at javax.servlet.FilterChain$doFilter.call(Unknown Source)
	at com.ceilfors.jenkins.plugins.jiratrigger.ExceptionLogg

Please, any idea?

Thanks in advance,

Jorge.

1 Like

Check the file owner and access rights on this directory and subdir.

1 Like

I found the issue. I had to change permissions to jenkins user (1000) from root user (0):

agent:
  enabled: true
  defaultsProviderTemplate: ""
  # URL for connecting to the Jenkins contoller
  jenkinsUrl:
  # connect to the specified host and port, instead of connecting directly to the Jenkins controller
  jenkinsTunnel:
  kubernetesConnectTimeout: 5
  kubernetesReadTimeout: 15
  maxRequestsPerHostStr: "32"
  namespace:
  image: "jenkins/inbound-agent"
  tag: "4.11.2-4"
  workingDir: "/home/jenkins/agent"
  nodeUsageMode: "NORMAL"
  customJenkinsLabels: []
  # name of the secret to be used for image pulling
  imagePullSecretName:
  componentName: "jenkins-agent"
  websocket: false
  privileged: false
  runAsUser: 1000  <------------------------
  runAsGroup: 1000  <------------------------
  resources:
    requests:
      cpu: "512m"
      memory: "512Mi"
    limits:
      cpu: "512m"
      memory: "512Mi"

Now it’s working.

Be careful to change these kinds of privileges hahaha.

Thanks!!

Thanks a lot for your feedback. :pray: