When trying a clean install for jenkins (jenkins-2.370-1.1.noarch.rpm), but we ran into an issue
As far as we can tell all permissions should be ok
What are we missing, we been trying for days now ?
-- Unit jenkins.service has begun starting up.
<redacted> systemd[2644]: jenkins.service: Changing to the requested working directory failed: Permission denied
<redacted> systemd[2644]: jenkins.service: Failed at step CHDIR spawning /usr/bin/jenkins: Permission denied
-- Subject: Process /usr/bin/jenkins could not be executed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The process /usr/bin/jenkins could not be executed and failed.
--
-- The error number returned by this process is 13.
Here is the systemctl -l status jenkins log
<redacted> [/tmp/install]: sudo systemctl -l status jenkins
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/jenkins.service.d
└─override.conf
Active: failed (Result: exit-code) since Mon 2022-09-26 15:25:14 CEST; 10min ago
Process: 2644 ExecStart=/usr/bin/jenkins (code=exited, status=200/CHDIR)
Main PID: 2644 (code=exited, status=200/CHDIR)
<redacted> systemd[1]: jenkins.service: Main process exited, code=exited, status=200/CHDIR
<redacted> systemd[1]: jenkins.service: Failed with result 'exit-code'.
<redacted> systemd[1]: Failed to start Jenkins Continuous Integration Server.
<redacted> systemd[1]: jenkins.service: Service RestartSec=100ms expired, scheduling restart.
<redacted> systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 5.
<redacted> systemd[1]: Stopped Jenkins Continuous Integration Server.
<redacted> systemd[1]: jenkins.service: Start request repeated too quickly.
<redacted> systemd[1]: jenkins.service: Failed with result 'exit-code'.
<redacted> systemd[1]: Failed to start Jenkins Continuous Integration Server.
Check the permissions of the /var/lib/jenkins directory. You state that the permissions should be ok, but that seems the most likely source of the problem. Permissions of one of the parent directories might also be an issue.
If you have enabled one of the Red Hat security profiles, you may need to reconsider that choice.
systemd version systemctl --version says
systemd 239 (239-58.el8_6.7)
Additional info
Operating System: Red Hat Enterprise Linux 8.6 (Ootpa)
CPE OS Name: cpe:/o:redhat:enterprise_linux:8::baseos
Kernel: Linux 4.18.0-372.26.1.el8_6.x86_64
Architecture: x86-64
Interesting, since that is the exact operating system where I have been running a Jenkins 2.361.1 controller. I don’t have other suggestions to offer. We test variants of that operating system with test automation (Rocky 9, Alma 9, Oracle Linux 9) and I use Red Hat Enterprise Linux 8.6 interactively.
The version of systemd that you are running matches exactly with the systemd on my RHEL 8.6 system. No harm trying to update it, but I suspect something else in the system configuration, not the systemd version.
Somewhere in the installation script we used, there was a move from /var/lib/jenkins to /srv/jenkins
This was done by creating a symlink to /srv/jenkins
Why this was ever in the scripts we are still looking into that
But it seems that SELinux does not permit the use of symlink in this instance (if i understand correctly)
So be removing this ‘move’, we now have a working Jenkins instance