Issue is in Red Hat/.rpm packaging for Jenkins, not Jenkins itself.
Brand-new, standard RHEL8.8 install. Followed instructions at https://pkg.jenkins.io/redhat-stable/ then startup via systemd per Handbook. This is what a newbie does.
Wont start.
RH standard Java is Java 8, and installing either java-11-openjdk or java-17-openjdk doesn't change system default "java", so documented systemd startup dies w/ "wrong java". The smarter code in init.d/jenkins doesn't seem to be involved in this path. Messages saying so are hidden, so an inexperienced installer would be clueless and frustrated.
Recommendations:
- Set JAVA_HOME=/usr/lib/jre-11 in the distributed jenkins.service and sysconfig/jenkins files
- Remove java 8 choices from init.d/jenkins, none of them will work.
- Add dependencies on "jre-11" and "fontconfig" to the .rpm
- Somewhat larger change: Merge the SysV init.d/jenkins and systemd methods so both pull config from a single file (probably sysconfig/jenkins) and set it there.
Thanks for the suggestions.
I think we'll be better served by removing those short instructions on https://pkg.jenkins.io/redhat-stable/ and replacing them with a link to the detailed instructions at https://www.jenkins.io/doc/book/installing/linux/#red-hat-centos . The short instructions worked reasonably well when we weren't having to deal with multiple operating systems (Fedora, Red Hat), multiple versions of those operating systems (Fedora 37, Fedora 38, Red Hat Enterprise Linux 8, Red Hat Enterprise Linux 9), and multiple Java versions (Java 11, Java 17).
We won't switch to read configuration form sysconfig/jenkins, since that is not where systemd reads configuration. We switched in March 2022 to systemd on RPM and DEB installers. In the future, we expect to remove all references to System V initialization from the RPM based installers. A pull request is in progress now to remove those references.
In the past we've intentionally not included a dependency on a JDK package provided by the operating system. The original reason was due to Java packaging issues on some platforms. Those have been resolved, but I believe we will continue that because the user needs to choose their JDK, whether Java 11 or Java 17 or in the future Java 21.