Registration Failed for Instance

An instance can fail to register with Autonomous Linux for several reasons.

Common osmh-agent.log Error Messages

To troubleshoot registration issues, start by examining the osmh-agent.log file for the following error messages. See Examining Log Files on an Instance to identify the location of the log file.

Code and Message Possible cause and resolution

Http Status Code: 400. Error Code: MissingParameter.

Message: Registration profile is required for on-boarding instances, but none was provided.

Cause: There wasn't a compatible default profile at registration.

Resolution: Identify and use a compatible profile. See Invalid profile was used.

Http Status Code: 404. Error Code: NotAuthorizedOrNotFound.

Message: Authorization failed or requested resource not found.

Cause: The current policies don't allow the service to access the instance. Most commonly, the dynamic group doesn't include matching rules for the compartment that contains the instance. Or, there's a missing or incorrect policy statement.

Resolution: Verify policies are correct. See Incorrect policy statement or missing dynamic group rule.

Http Status Code: 409. Error Code: Conflict.

Message: Invalid Managed Instance osFamily ORACLE_LINUX_8 does not match Profile osFamily: ORACLE_LINUX_7

Cause: The profile has the wrong operating system. For example, the instance is Oracle Linux 8 but the profile is Oracle Linux 7.

Resolution: Identify and use a compatible profile. See Invalid profile was used.

Common Oracle Cloud Agent Error Messages

For OCI instances, use the OS Management Hub Agent plugin status to troubleshoot registration issues. In the Console, on the Oracle Cloud Agent tab on the Compute instance details page, you might see one of the following error messages.

Error Message Possible cause and resolution

Plugin OS Management Hub Agent not present for instance ocid1.instance.oc1.iad.<ocid>

Cause: The OS Management Hub agent isn't installed on the instance. This usually occurs when the service can't access the instance because of a policy issue.

Resolution: Vpolicy statements are correct and that the instance is included in the dynamic group. See Incorrect policy statement or missing dynamic group rule.

failed to start osmh-agent with [lookup image failed. The instance could not register with OS Management Hub.

Cause: The OS Management Hub agent can't start on the instance. This usually occurs when the service can't access the instance because of a policy issue.

Resolution: Verify your policy statements are correct and that the instance is included in the dynamic group. If not using the default identity domain, verify you've specified the identity domain in the policy statements. See Incorrect policy statement or missing dynamic group rule.

rpc error: code = Unavailable desc = connection error: desc = "transport: error while dialing: dial unix /var/lib/oracle-cloud-agent/tmp/plugin162329539: connect: connection refused"

Cause: Multiple OCA plugins are running. The OS Management Hub and OS Management plugin can't run at the same time.

Resolution: Disable the OS Management plugin. See Multiple plugins running.

Invalid profile was used

Check the osmh-agent.log file and identify the correct profile

  1. Determine the location of the osmh-agent.log file.
  2. Examine the log file, scanning for the key word "Error Code", to determine if a profile error exists. See Common osmh-agent.log Error Messages.

    For example:

    sudo grep -i "error code" /var/lib/oracle-cloud-agent/plugins/oci-osmh/osmh-agent/stateDir/log/osmh-agent.log
  3. Identify (or create) a profile that matches the OS version, architecture, and location of the instance you're registering.

To update the profile

  1. Open the navigation menu and click Observability & Management. Under Autonomous Linux, click Instances.
  2. Under List scope, select the compartment that contains the instance.
  3. Click the name of the instance.
  4. Click Set profile.
  5. Select the compartment and correct profile to use for registration.
  6. Click Set.

Incorrect policy statement or missing dynamic group rule

If you encounter the following errors when registering an instance, it might indicate that the policy statements or dynamic group rules aren't set correctly.

The osmh-agent.log contains:

ERROR: failed to update managed instance: Error returned by  Service. Http Status Code: 404.
                    Error Code: NotAuthorizedOrNotFound. Opc request id: <requestID>. Message: Authorization failed or requested resource not found.
                    ...
                    Request Endpoint: PUT https://osmh.<region>.oci.oraclecloud.com/20220901/agent/managedInstances/ocid1.managementagent.oc1.iad.<ocid>

Or, the Oracle Cloud Agent tab on the Compute instance details page shows one of the following messages:

Plugin OS Management Hub Agent not present for instance ocid1.instance.oc1.iad.<ocid>
failed to start osmh-agent with [lookup image failed. The instance could not register with OS Management Hub.

To resolve the issue, verify you've correctly configured the policy statements and dynamic group rules. Most commonly the dynamic group doesn't include the instance.

Verify the following:

  • Ensure that you've included a dynamic group rule for each compartment and subcompartment containing instances that you want manged by the service. Dynamic groups don't support compartment inheritance.
  • If not using the default identity domain, ensure each policy statement has the identity domain before the group or dynamic group name (for example, <identity_domain_name>/<dynamic_group_name>).

Instance was previously unregistered

Re-registering an instance that was unregistered will fail until you remove the unregistration file on the instance. This file prevents the instance from registering with the service. When you try to register an instance that contains this file, the agent plugin displays the following error: started oci-osmh under unregistered mode.

Remove the following file before registering the instance:

  • /var/lib/oracle-cloud-agent/plugins/oci-osmh/osmh-agent-unregister

Multiple plugins running

The OS Management plugin and OS Management Hub plugin for the Oracle Cloud Agent can't be running at the same time. In the Console, on the Oracle Cloud Agent tab in Compute instance details, you might see the following error:

rpc error: code = Unavailable desc = connection error: 
desc = "transport: error while dialing: dial unix /var/lib/oracle-cloud-agent/tmp/plugin162329539: connect: connection refused"

Disable the OS Management plugin:

  1. Open the navigation menu, click Compute, and then click Instances.
  2. Click the name of the instance.
  3. Click the Oracle Cloud Agent tab.
  4. Disable the OS Management Service Agent plugin.