Problem description

AMD time is not synchronized with CAS.

Time synchronization between CAS and AMD fails with the "result: 1" as the only error in the rtmgate.log files.

AMD time drifts away from CAS time without adjustments.

You may also encounter another issue - during the ssh sessions to the AMD, from time to time (in most cases frequency of 5 minutes), you see a prompt to provide a valid password for the user.

A simple test is to check the results of the following command:

grep -ie "sudo" /var/log/adlex/rtmgate.log

The output may contain:

... hwclock... result:1

... adjtimex... result:1

or even

... hwclock... result:0

... adjtimex... result:1

The first set (both results = 1) suggests that lines containing "compuware" in /etc/sudoers file are commented out with # sign.

The second set (only adjtimex result =1) may be seen when somebody already removed the comment for lines containing "compuware" in /etc/sudoers file, but rtmgate service has not been restarted yet.

Solution

Add this line:

Defaults:compuware !requiretty

directly above these lines

compuware ALL=NOPASSWD: /sbin/hwclock
compuware ALL=NOPASSWD: /sbin/adjtimex


in the sudo configuration file. This config file is edited by executing visudo in the root user context.

visudo defaults to using vi as the editor. If you are more comfortable with another editor, you can change visudo's behavior by setting the EDITOR environment variable to the alternate editor of your choice. For example:

export EDITOR=nano

will tell visudo to use the nano editor instead.

==========

1. Log in as the root user.
2. From the root command prompt, execute the following commands:
export EDITOR=nano
visudo

3. Find two lines containing strings as below. Most probably, the lines will be commented out with the # sign. You have to remove that sign, so the lines are treated as valid properties, not comments.

compuware ALL=NOPASSWD: /sbin/hwclock
compuware ALL=NOPASSWD: /sbin/adjtimex


and add this line directly above:

Defaults:compuware !requiretty

so the final result looks like this at the end of the file:

Defaults:compuware !requiretty
compuware ALL=NOPASSWD: /sbin/hwclock
compuware ALL=NOPASSWD: /sbin/adjtimex

4. Press CTRL+X on the keyboard to trigger the close routine in nano, you will be prompted to save changes, press Y, and accept the default file name.
5. visudo will validate the changes and update the sudo configuration.
6. After the changes are made, they will not fully take effect until after running:

service rtmgate restart

Restart is needed due to fact that during rtmgate startup, one of the tasks it performs is to estimate the tick for adjtimex command. If compuware account does not have enough rights, the tick is set to default, which in most cases is not effective. Restart of the service allows rtmgate to recalculate the tick properly.

What to do next

Alternative solution is to setup NTP-based time synchronization on AMD and CAS server. Please refer to the DC RUM documentation for details: Synchronizing Time Using the NTP Server and Time Synchronization with an External Time Server.