Linux Agent Restart After Reboot as Non Root User

Document ID : KB000005225
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

The CA Release Automation Agent is not starting as our non root user when the Linux server is rebooted. It is expected that the agent will start with the same non root user that owns the agent directories/files. 

Environment:
CA Release Automation 5.x and 6.0Linux
Cause:

Starting in version 5.5.1 of Release Automation the RUN_AS_USER entry was moved from the <AgentInstallDir>/deployer_daemon.sh file to the conf/deployer_configuration.sh file. When this was done it was intended for the deployer_daemon.sh to call the conf/deployer_configuration.sh. There are lines in the deployer_daemon.sh file to do this. However, these lines are unable to find the conf/deployer_configuration.sh file except for when the deployer_daemon.sh file is run from inside of the <AgentInstallDir> folder. So when a reboot takes place it is unable to find the conf/deployer_configuration.sh file and 

Resolution:

This was solved in CA Release Automation version 6.1. If you need a solution for your current setup then you can follow the steps in "Set One" or "Set Two" below. The recommended solution is to upgrade to CA Release Automation 6.1 or later. 

 

Description of instructions:

Set One:

These instructions are meant to be run in a way in which you will need to login to each individual linux machine and update the individual files, then run the commands (as root).

 

Set Two:

These instructions are used to update the files on the agent machines via the ASAP -> Install/Upgrade Agent. This way you don't need to worry about any typo's inside of the deployer_daemon.sh file. But you will still need to login to each individual linux machine and:

  1. Update the conf/deployer_configuration.sh file to uncomment and specify a valid user id in the RUN_AS_USER line.
  2. As root run the commands (./deployer_daemon.sh remove; ./deployer_daemon.sh install) to set up the agent as a linux service. 

 

Set One: 

  • Login to the linux machine.
  • cd to the <NolioAgentInstallDir> and create a backup of the deployer_daemon.sh file.
  • open the deployer_daemon.sh file.
  • Add the following underneath lines right above the "# Application" line:
    SCRIPT=$(readlink -f "$0")  
    SCRIPTDIR=$(dirname "$SCRIPT") 
  • Find and change these two lines from:
    if [ -f conf/deployer_configuration.sh ]; then
       source conf/deployer_configuration.sh
    fi
  • To:
    if [ -f $SCRIPTDIR/conf/deployer_configuration.sh ]; then
       . $SCRIPTDIR/conf/deployer_configuration.sh
    fi
  • Save and close the file. 
  • Make sure that the conf/deployer_configuration.sh file has a valid userid in the RUN_AS_USER field and that it is uncommented. 
  • As root run the commands: ./deployer_daemon.sh remove; ./deployer_daemon.sh install

 

Set Two: 

  • Login to your Nolio Automation Center server.
  • cd to the <NolioInstallDir>/upgradeAgent/-1975/-1975/upgradeData/upgradeFiles directory and create a backup of the deployer_daemon.sh.template file.
  • open the deployer_daemon.sh.template file.
  • Add the following underneath lines right above the "# Application" line:
    SCRIPT=$(readline -f "$0")  
    SCRIPTDIR=$(dirname "$SCRIPT") 
  • Find and change these two lines from:
    if [ -f conf/deployer_configuration.sh ]; then
       source conf/deployer_configuration.sh
    fi
  • To:
    if [ -f $SCRIPTDIR/conf/deployer_configuration.sh ]; then
       . $SCRIPTDIR/conf/deployer_configuration.sh
    fi
  • Save and close the file. 
  • Use ASAP to Upgrade or Install the Agent.
  • Login to each server you Upgrade/Install the agent on.
  • Make sure that the conf/deployer_configuration.sh file has a valid userid in the RUN_AS_USER field and that it is uncommented.   
  • As root run the commands: ./deployer_daemon.sh remove; ./deployer_daemon.sh install
Additional Information:

This link points to the 5.5.2 documentation that describes how to install, configure, and run agents as non root users. It is relevant regardless of this problem because the deployer_configuration.sh still needs to be updated with a valid RUN_AS_USER and the commands (./deployer_daemon.sh remove ./deployer_daemon.sh install) still need to be run as root; though if you're experiencing this issue then the commands can wait until the rest of the solution is in place.

https://docops.ca.com/ca-release-automation/5-5-2/en/installation/deploy-agents#DeployAgents-InstallUnix/LinuxAgenttoRunasNon-RootUser