Introduction

Article ID:4403307708187
2 minute readKnowledge base

Any installation or upgrade to CloudBees CI on traditional platforms 2.289.2.2 through .rpm fails in case the configuration file typically under /etc/sysconfig/cloudbees-core-oc or /etc/sysconfig/cloudbees-core-cm is customizing the JENKINS_USER.

Typically, a stacktrace like the one below is shown in the systemctl logs.

Jul 06 12:01:02 machine cloudbees-core-oc[120276]: Shutting down CloudBees Core traditional - Operations Center [ OK ]
Jul 06 12:01:02 machine systemd[1]: Stopped LSB: CloudBees Core traditional - Operations Center.
Jul 06 12:03:17 machine systemd[1]: Started cloudbees-core-oc.
Jul 06 12:03:17 machine systemd[1]: cloudbees-core-oc.service: main process exited, code=exited, status=6/NOTCONFIGURED
Jul 06 12:03:17 machine systemd[1]: Unit cloudbees-core-oc.service entered failed state.
Jul 06 12:03:17 machine systemd[1]: cloudbees-core-oc.service failed.
Jul 06 12:04:52 machine systemd[1]: Started cloudbees-core-oc.
Jul 06 12:04:52 machine systemd[1]: cloudbees-core-oc.service: main process exited, code=exited, status=6/NOTCONFIGURED
Jul 06 12:04:52 machine systemd[1]: Unit cloudbees-core-oc.service entered failed state.
Jul 06 12:04:52 machine systemd[1]: cloudbees-core-oc.service failed.

Resolution

In case the Jenkins configuration file has changed the default $JENKINS_USER (usually under /etc/sysconfig/cloudbees-core-oc or /etc/sysconfig/cloudbees-core-cm), when the rpm scripts run the variables are captured and the new file is written with the previous changes. However when writing this file is sets the file to rw to owner only (600)

This should be applied to fix the situation.

  • NOTE: From here, we are considering that the issue is happening with the Operations Center, but the same applies to Client controllers - just change cloudbees-core-oc per cloudbees-core-cm

[Step 1] Change /usr/bin/cloudbees-core-oc ownership from 600 to 644

chmod 644 /usr/bin/cloudbees-core-oc

[Step 2] Change the ownership of /usr/bin/cloudbees-core-oc

Modify the EXEC_START script /usr/bin/cloudbees-core-oc to change to the user:group you are running.

chown myuser:mygroup /usr/bin/cloudbees-core-cm

[Step 3] Override the Systemd Service with the correct user

Finally, we need to override the Systemd Service through systemctl edit

systemctl edit cloudbees-core-oc
[Service]
User=fbelzunc

Save and close the file

systemctl daemon-reload