Strange jna.LastErrorException repeated over and over in jenkins logs

Starting Jenkins 2.332.1 on AmazonLinux2 (java 11) results it the following exception repeatedly throw in the log. Jenkins does start and work correctly.

Apr 04 11:01:10 jenkins jenkins[21709]: 2022-04-04 11:01:10.868+0000 [id=31]        INFO        jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
Apr 04 11:01:11 jenkins jenkins[21709]: 2022-04-04 11:01:11.693+0000 [id=32]        WARNING        h.lifecycle.SystemdLifecycle#notify
Apr 04 11:01:11 jenkins jenkins[21709]: com.sun.jna.LastErrorException: [1] Operation not permitted
Apr 04 11:01:11 jenkins jenkins[21709]: at com.sun.jna.Native.invokeInt(Native Method)
Apr 04 11:01:11 jenkins jenkins[21709]: at com.sun.jna.Function.invoke(Function.java:426)
Apr 04 11:01:11 jenkins jenkins[21709]: at com.sun.jna.Function.invoke(Function.java:361)
Apr 04 11:01:11 jenkins jenkins[21709]: at com.sun.jna.Library$Handler.invoke(Library.java:265)
Apr 04 11:01:11 jenkins jenkins[21709]: at hudson.lifecycle.$Proxy21.sd_notify(Unknown Source)
Apr 04 11:01:11 jenkins jenkins[21709]: at hudson.lifecycle.SystemdLifecycle.notify(SystemdLifecycle.java:64)
Apr 04 11:01:11 jenkins jenkins[21709]: at hudson.lifecycle.SystemdLifecycle.onExtendTimeout(SystemdLifecycle.java:53)
Apr 04 11:01:11 jenkins jenkins[21709]: at jenkins.model.Jenkins$6.onInitMilestoneAttained(Jenkins.java:1184)
Apr 04 11:01:11 jenkins jenkins[21709]: at jenkins.InitReactorRunner$1.onAttained(InitReactorRunner.java:88)
Apr 04 11:01:11 jenkins jenkins[21709]: at org.jvnet.hudson.reactor.ReactorListener$Aggregator.lambda$onAttained$3(ReactorListener.java:108)
Apr 04 11:01:11 jenkins jenkins[21709]: at org.jvnet.hudson.reactor.ReactorListener$Aggregator.run(ReactorListener.java:115)
Apr 04 11:01:11 jenkins jenkins[21709]: at org.jvnet.hudson.reactor.ReactorListener$Aggregator.onAttained(ReactorListener.java:108)
Apr 04 11:01:11 jenkins jenkins[21709]: at org.jvnet.hudson.reactor.Reactor$1.run(Reactor.java:183)
Apr 04 11:01:11 jenkins jenkins[21709]: at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:121)
Apr 04 11:01:11 jenkins jenkins[21709]: at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
Apr 04 11:01:11 jenkins jenkins[21709]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
Apr 04 11:01:11 jenkins jenkins[21709]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
Apr 04 11:01:11 jenkins jenkins[21709]: at java.base/java.lang.Thread.run(Thread.java:829)
Apr 04 11:01:11 jenkins jenkins[21709]: 2022-04-04 11:01:11.694+0000 [id=32]        INFO        jenkins.InitReactorRunner$1#onAttained: System config loaded
Apr 04 11:01:11 jenkins jenkins[21709]: 2022-04-04 11:01:11.696+0000 [id=32]        WARNING        h.lifecycle.SystemdLifecycle#notify
Apr 04 11:01:11 jenkins jenkins[21709]: com.sun.jna.LastErrorException: [1] Operation not permitted
Apr 04 11:01:11 jenkins jenkins[21709]: at com.sun.jna.Native.invokeInt(Native Method)
Apr 04 11:01:11 jenkins jenkins[21709]: at com.sun.jna.Function.invoke(Function.java:426)
Apr 04 11:01:11 jenkins jenkins[21709]: at com.sun.jna.Function.invoke(Function.java:361)
Apr 04 11:01:11 jenkins jenkins[21709]: at com.sun.jna.Library$Handler.invoke(Library.java:265)
Apr 04 11:01:11 jenkins jenkins[21709]: at hudson.lifecycle.$Proxy21.sd_notify(Unknown Source)
Apr 04 11:01:11 jenkins jenkins[21709]: at hudson.lifecycle.SystemdLifecycle.notify(SystemdLifecycle.java:64)
Apr 04 11:01:11 jenkins jenkins[21709]: at hudson.lifecycle.SystemdLifecycle.onExtendTimeout(SystemdLifecycle.java:53)
Apr 04 11:01:11 jenkins jenkins[21709]: at jenkins.model.Jenkins$6.onInitMilestoneAttained(Jenkins.java:1184)
Apr 04 11:01:11 jenkins jenkins[21709]: at jenkins.InitReactorRunner$1.onAttained(InitReactorRunner.java:88)
Apr 04 11:01:11 jenkins jenkins[21709]: at org.jvnet.hudson.reactor.ReactorListener$Aggregator.lambda$onAttained$3(ReactorListener.java:108)
lines 13071-13106/13213 99%

also we lost logging to /var/log/jenkins/jenkins.log is there a way we can get that back?

I found a docs page that said to edit the service file to add an environment variable, is there a non interactive way?

That will be fixed in 2.332.2 to be released this Wednesday. It is described in JENKINS-67995 - SystemdLifecycle logging “Operation not permitted” calling sd_notify(3) during startup

You can read the changelog entry for it in the 2.332.2 changelog.

1 Like

Yes, though that means you’re fighting against the way that systemd manages logs for the rest of your system. Using systemd to manage the log files will allow you to manage space used by the log files with systemd.

The override.conf file can be edited by any text editor. If it is edited by a process that is not aware of systemd, then a call needs to be made to systemclt daemon-reload.