Registration Failed for Instance

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

Common 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.

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 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, it might indicate that the policy statements or dynamic group rule 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:

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

To resolve the issue, verify you've correctly configured the policy statements. See Required IAM Policy.

Most commonly the dynamic group rule doesn't include the compartment that the instance resides in. Dynamic groups don't support compartment inheritance, so you might need to explicitly include subcompartments. See Required Dynamic Group.

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.