New install of jenkins on RHEL 8 won't start due to failed to map segment from shared object error

Jenkins setup: clean install on RHEL 8 using these steps:
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo yum install fontconfig java-17-openjdk
sudo yum install jenkins
sudo systemctl edit jenkins
Environment=“JAVA_HOME=/usr/lib/jvm/java-17-openjdk”

sudo systemctl start jenkins
fails to start
sudo journalctl -xe
java.lang.UnsatisfiedLinkError: /var/lib/jenkins/.cache/JNA/temp/jna17258145716752850398.tmp: /var/lib/jenkins/.cache/JNA/temp/jna17258145716752850398.tmp: failed to map segment from shared object

That is not a bug but an indicator that something in your setup is not correct.
Search for the error message failed to map segment from shared object and you will get pointers what could be wrong.

Yes, this must be a bug as I am unable to start a newly installed jenkins on any RHEL 8 machine – I have tried 3 different machines with new RHEL 8 installs. Jenkins was installed using the redhat instructions here: Linux (jenkins.io)

Nothing has been setup yet - only RHEL 8 and jenkins. Additionally the /var/lib/jenkins/.cache/JNA/temp/jna17258145716752850398.tmp file complained about only exists when jenkins attempts to start, it does not exist beforehand and it does not exist afterwards, jenkins must create it somehow.

The entire log when attempting to start jenkins on any RHEL 8 machine is:

2024-05-30 17:43:34.548+0000 [id=1]     INFO    winstone.Logger#logInternal: Beginning extraction from war file
2024-05-30 17:43:34.617+0000 [id=1]     WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2024-05-30 17:43:34.671+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: jetty-10.0.20; built: 2024-01-29T20:46:45.278Z; git: 3a745c71c23682146f262b99f4ddc4c1bc41630c; jvm 17.0.10+7-LTS
2024-05-30 17:43:34.913+0000 [id=1]     INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2024-05-30 17:43:34.961+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: Session workerName=node0
2024-05-30 17:43:35.392+0000 [id=1]     INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/lib/jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2024-05-30 17:43:35.471+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@1051817b{Jenkins v2.452.1,/,file:///var/cache/jenkins/war/,AVAILABLE}

{/var/cache/jenkins/war}
2024-05-30 17:43:35.489+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@1372ed45{HTTP/1.1, (http/1.1)}{0.0.0.0:18080}
2024-05-30 17:43:35.496+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started Server@29ba4338{STARTING}[10.0.20,sto=0] @1317ms
2024-05-30 17:43:35.498+0000 [id=26]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2024-05-30 17:43:35.677+0000 [id=25]    SEVERE  hudson.util.BootFailure#publish: Failed to initialize Jenkins
java.lang.UnsatisfiedLinkError: /var/lib/jenkins/.cache/JNA/temp/jna783176340212732613.tmp: /var/lib/jenkins/.cache/JNA/temp/jna783176340212732613.tmp: failed to map segment from shared object
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2394)
        at java.base/java.lang.Runtime.load0(Runtime.java:755)
        at java.base/java.lang.System.load(System.java:1957)
        at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1041)
        at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1011)
        at com.sun.jna.Native.<clinit>(Native.java:221)
        at hudson.lifecycle.SystemdLifecycle$Systemd.<clinit>(SystemdLifecycle.java:26)
        at hudson.lifecycle.SystemdLifecycle.notify(SystemdLifecycle.java:62)
        at hudson.lifecycle.SystemdLifecycle.onExtendTimeout(SystemdLifecycle.java:52)
        at jenkins.model.Jenkins$6.onInitMilestoneAttained(Jenkins.java:1203)
        at jenkins.InitReactorRunner$1.onAttained(InitReactorRunner.java:88)
        at org.jvnet.hudson.reactor.ReactorListener$Aggregator.lambda$onAttained$3(ReactorListener.java:108)
        at org.jvnet.hudson.reactor.ReactorListener$Aggregator.run(ReactorListener.java:116)
        at org.jvnet.hudson.reactor.ReactorListener$Aggregator.onAttained(ReactorListener.java:108)
        at org.jvnet.hudson.reactor.Reactor$1.run(Reactor.java:182)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused: org.jvnet.hudson.reactor.ReactorException
        at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:290)
        at jenkins.InitReactorRunner.run(InitReactorRunner.java:49)
        at jenkins.model.Jenkins.executeReactor(Jenkins.java:1210)
        at jenkins.model.Jenkins.<init>(Jenkins.java:997)
        at hudson.model.Hudson.<init>(Hudson.java:86)
        at hudson.model.Hudson.<init>(Hudson.java:82)
        at hudson.WebAppMain$3.run(WebAppMain.java:248)
Caused: hudson.util.HudsonFailedToLoad
        at hudson.WebAppMain$3.run(WebAppMain.java:276)
2024-05-30 17:43:35.842+0000 [id=25]    INFO    hudson.lifecycle.Lifecycle#onStatusUpdate: Stopping Jenkins
Exception in thread "Jenkins initialization thread" java.lang.NoClassDefFoundError: Could not initialize class hudson.lifecycle.SystemdLifecycle$Systemd
        at hudson.lifecycle.SystemdLifecycle.notify(SystemdLifecycle.java:62)
        at hudson.lifecycle.SystemdLifecycle.onStatusUpdate(SystemdLifecycle.java:58)
        at jenkins.model.Jenkins.cleanUp(Jenkins.java:3664)
        at hudson.WebAppMain$3.run(WebAppMain.java:281)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /var/lib/jenkins/.cache/JNA/temp/jna783176340212732613.tmp: /var/lib/jenkins/.cache/JNA/temp/jna783176340212732613.tmp: failed to map segment from shared object [in thread "pool-7-thread-3"]
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
       at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2394)
        at java.base/java.lang.Runtime.load0(Runtime.java:755)
        at java.base/java.lang.System.load(System.java:1957)
        at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1041)
        at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1011)
        at com.sun.jna.Native.<clinit>(Native.java:221)
        at hudson.lifecycle.SystemdLifecycle$Systemd.<clinit>(SystemdLifecycle.java:26)
        at hudson.lifecycle.SystemdLifecycle.notify(SystemdLifecycle.java:62)
        at hudson.lifecycle.SystemdLifecycle.onExtendTimeout(SystemdLifecycle.java:52)
        at jenkins.model.Jenkins$6.onInitMilestoneAttained(Jenkins.java:1203)
        at jenkins.InitReactorRunner$1.onAttained(InitReactorRunner.java:88)
        at org.jvnet.hudson.reactor.ReactorListener$Aggregator.lambda$onAttained$3(ReactorListener.java:108)
        at org.jvnet.hudson.reactor.ReactorListener$Aggregator.run(ReactorListener.java:116)
        at org.jvnet.hudson.reactor.ReactorListener$Aggregator.onAttained(ReactorListener.java:108)
        at org.jvnet.hudson.reactor.Reactor$1.run(Reactor.java:182)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:840)
2024-05-30 17:45:04.323+0000 [id=27]    INFO    winstone.Logger#logInternal: JVM is terminating. Shutting down Jetty
2024-05-30 17:45:04.324+0000 [id=27]    INFO    org.eclipse.jetty.server.Server#doStop: Stopped Server@29ba4338{STOPPING}[10.0.20,sto=0]
2024-05-30 17:45:04.326+0000 [id=27]    INFO    o.e.j.server.AbstractConnector#doStop: Stopped ServerConnector@1372ed45{HTTP/1.1, (http/1.1)}{0.0.0.0:18080}
2024-05-30 17:45:04.329+0000 [id=27]    INFO    o.e.j.s.handler.ContextHandler#doStop: Stopped w.@1051817b{Jenkins v2.452.1,/,null,STOPPED}{/var/cache/jenkins/war}
2024-05-30 17:45:04.331+0000 [id=27]    INFO    winstone.Logger#logInternal: Jetty shutdown successfully
2024-05-30 17:45:04.331+0000 [id=26]    INFO    winstone.Logger#logInternal: Control thread shutdown successfully

I assume you get an image from your IT department so it is no surprise that all 3 attempts fail as the image is the same.
When I look for this error I found many pointers that the problem is with writing to /tmp. So you should check whether the user under which jenkins runs (this is probably the user with id jenkins) is able to write there.
If there would be a bug in Jenkins, then thousands of users would have a problem which is not the case.

I found the same “pointers” to /tmp. However, the error does not indicate a file in /tmp, it indicates a file in /var/lib/jenkins/.cache/, which is where the rest of jenkins is, everything is owned by jenkins:jenkins. and, indeed, the file was created by jenkins.

I did not setup the servers, our IT department did.

The /tmp will definitely be used by Jenkins so can the user write there?

Yes, jenkins can, and has written in /tmp

❯ ls -l /tmp
total 10120
drwxr-xr-x 2 jenkins              jenkins                6 May 31 11:04 hsperfdata_jenkins/
drwx------ 2 jenkins              jenkins                6 May 30 13:48 jetty-0_0_0_0-18080-war-_-any-15509433169369773009/
drwx------ 2 jenkins              jenkins                6 May 30 13:47 jetty-0_0_0_0-18080-war-_-any-16101356792571590964/
drwx------ 2 jenkins              jenkins                6 May 30 13:47 jetty-0_0_0_0-18080-war-_-any-4476016285091207961/
-rw-r--r-- 1 jenkins              jenkins          3413476 May 30 13:47 winstone15777748538834557481.jar
-rw-r--r-- 1 jenkins              jenkins          3413476 May 30 13:48 winstone2629114668689964745.jar
-rw-r--r-- 1 jenkins              jenkins          3413476 May 30 13:47 winstone9458410812180159064.jar

Another possibility is that /tmp is mounted with noexec. You can check this but copying an executable there and try to run it.
You would then need to try to mount /tmp so that you can execute from there or change the tempdir for the java process to a path that allows executing things.