All Products
Search
Document Center

Elastic Compute Service:Check execution results and troubleshoot common issues

Last Updated:Dec 04, 2024

You can run a Cloud Assistant command as expected only when all requirements are met, regardless of whether you use the Elastic Compute Service (ECS) console or log on to an instance to run the command. To ensure that your intended operations are complete, we recommend that you check the command execution results and states. If executions fail, you can troubleshoot the issues based on common error messages.

Background information

When exceptions occur, different execution results and states are displayed for the command. The exceptions include missing dependencies, network exceptions, command semantic errors, command debugging errors, and abnormal instance status. You can use the ECS console or call an API operation to view the error messages in the execution results and troubleshoot the issues.

View execution results

View in the ECS console

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Maintenance & Monitoring > Cloud Assistant.

  3. In the top navigation bar, select the region and resource group to which the resource belongs. 地域

  4. Click the Command Execution Result tab to view execution results.

    • If a command execution succeeds, you can view the command output in the execution results.

      1. Find a command task for which Successful is displayed in the Execution Status column.

      2. In the Actions column, click View.

      3. On the Task Completed tab of the Instances tab, view the execution results.查看执行结果

    • If a command execution fails, find the error message in the execution results and troubleshoot the issue based on the error message.

      1. Find a command task for which Execution failed is displayed in the Execution Status column.

      2. In the Actions column, click View.

      3. On the Task Failed tab of the Instances tab, view the execution results.

        For information about command errors and solutions, see the Command errors and solutions section of this topic.

        执行失败错误信息

    • View the execution results of a scheduled task.

      1. Find a command task for which Waiting for execution is displayed in the Execution Status column.

      2. In the Actions column, click View.

      3. On the Instances tab, view the execution results.

        The following figure shows the execution results of a scheduled command task that is executed every 15 minutes.

        定时任务执行结果

View through Alibaba Cloud CLI

For information about how to use Alibaba Cloud CLI, see Use Alibaba Cloud CLI to manage Alibaba Cloud resources.

  1. Call the RunCommand or InvokeCommand operation to obtain the execution ID of a command from the InvokeId response parameter.

  2. Specify the InvokeId and RegionId parameters to query the execution result of the command. In this example, the Japan (Tokyo) region is used. To obtain the RegionId of other regions, see Regions and zones.

  • Call the DescribeInvocations operation to query the execution status of the command.

    aliyun ecs DescribeInvocations --RegionId ap-northeast-1 --InvokeId t-sh054h*****
  • Call the DescribeInvocationResults operation to query the execution results of the command.

    aliyun ecs DescribeInvocationResults --RegionId ap-northeast-1 --InvokeId t-sh054h*****

View through API

  1. Call the RunCommand or InvokeCommand operation to obtain the execution ID of a command from the InvokeId response parameter.

  2. Call the DescribeInvocations or DescribeInvocationResults using the values of InvokeId and RegionId to query the execution result of the command.

Command errors and solutions

Common errors

Error code

Error message

Recommended solution

InstanceNotRunning

The instance was not in the Running state while the task was being created.

Check whether the instance is running as expected.

InstanceRestarted

The instance was restarted while the task was being executed.

Do not restart the instance while the task is being executed.

ClientNotRunning

Cloud Assistant Agent was not running.

Cloud Assistant Agent is stopped or not installed. Perform the following operations to start or install Cloud Assistant Agent:

  1. Check whether the Cloud Assistant Agent process runs as expected.

    • For Linux instances, run the following command:

      ps -ef |grep aliyun-service
    • For Windows instances, check whether the aliyun_assist_service process exists in Task Manager.

  2. If the process does not exist, start Cloud Assistant Agent.

    • For Linux instances, run one of the following commands:

      # If the Linux instances support systemctl, run the following command:
      systemctl start aliyun.service
      
      # If the Linux instances do not support systemctl, run the following command:
      /etc/init.d/aliyun-service start
    • For Windows instances, start Aliyun Assist Service by using Service Manager.

Note

If Cloud Assistant Agent still cannot be started after you perform the preceding operations, re-install Cloud Assistant Agent. For information about how to install Cloud Assistant Agent, see Install Cloud Assistant Agent.

ClientNetworkBlocked

The instance network environment is abnormal.

  1. Run the following command to check network connectivity. If the instance is connected to the network, the instance ID is returned.

    curl https://{region-id}.axt.aliyun.com/luban/api/instance/instance-id
  2. If the instance ID is not returned, check the security groups, firewall, Domain Name System (DNS) configurations, and route tables of the instance to troubleshoot the network issue. You must allow outbound traffic on TCP port 443, TCP port 80, and UDP port 53 to ensure that Cloud Assistant can access the following URLs:

    • https://{region-id}.axt.aliyun.com:443/

    • http://100.100.100.200:80/

    • http://aliyun-client-assist-{region-id}.oss-{region-id}-internal.aliyuncs.com

      The installation package for Cloud Assistant Agent is stored in an Object Storage Service (OSS) bucket. Only the installation package, not the bucket, is publicly accessible. Therefore, if AccessDenied is returned when you test the connectivity of an endpoint, the endpoint is accessible.

Note
  • {region-id} specifies the region ID of the instance. For example, if the instance resides in the China (Hangzhou) region, set this parameter to cn-hangzhou.

  • For information about the endpoints and IP addresses of the Cloud Assistant server in each region, see the Fine-grained configurations section of the "Configure network permissions for Cloud Assistant Agent" topic.

SecurityGroupRuleDenied

Security group rules deny access to Cloud Assistant.

  • Check the ErrorInfo field to obtain the IDs of the security groups that contain rules denying access to Cloud Assistant and the IP addresses of the Cloud Assistant server that are referenced in the deny rules. Then, modify the rules to allow access to Cloud Assistant.

  • For more information, see Configure network permissions for Cloud Assistant Agent.

ClientNotResponse

Cloud Assistant Agent does not respond.

Troubleshoot the issue based on logs of Cloud Assistant Agent.

  1. Open the log file of Cloud Assistant Agent. The following section describes the default paths of the log file:

    • Linux instances: /usr/local/share/aliyun-assist/<Version number of Cloud Assistant>/log/aliyun_assist_main.log

    • Windows instances: C:\ProgramData\aliyun\assist\<Version number of Cloud Assistant>\log\aliyun_assist_main.log

  2. Check whether the task ID exists in the log file.

    • If the task ID exists, check whether exception information exists in the context. For example, you can check whether the command is run to completion and reported.

    • If the task ID does not exist, rerun the Cloud Assistant command. If the execution still fails, we recommend that you restart Cloud Assistant Agent.

      • For Linux instances, run one of the following commands:

        # If the Linux instances support systemctl, run the following command:
        systemctl restart aliyun.service
        
        # If the Linux instances do not support systemctl, run the following command:
        /etc/init.d/aliyun-service restart
      • For Windows instances, start Aliyun Assist Service by using Service Manager.

ClientNeedUpgrade

Cloud Assistant Agent needs to be upgraded to support a specific feature.

  • Check the ErrorInfo field to obtain the feature that is not supported by the current version of Cloud Assistant Agent and the earliest version of Cloud Assistant Agent that supports the feature. Upgrade Cloud Assistant Agent to a version that supports the feature.

ClientNotOnline

Cloud Assistant Agent is not connected to the server.

Restart Cloud Assistant Agent. For more information, see Start, stop, or uninstall Cloud Assistant Agent. If Cloud Assistant Agent still cannot connect to the server after Cloud Assistant Agent is restarted, submit a ticket.

DeliveryTimeout

The Cloud Assistant server failed to send the command to Cloud Assistant Agent.

The Cloud Assistant command was not sent to the instance. We recommend that you rerun the command. If the issue persists, submit a ticket.

ExecutionTimeout

The command execution timed out.

Extend the command execution timeout period.

  • If you create and run a command in the ECS console, the Timeout parameter is set to 60 seconds by default. You can specify a value based on your business requirements.

  • If you run a command by calling the RunCommand operation, the Timeout parameter is set to 60 seconds by default. You can specify a value based on your business requirements.

  • If you create a command by calling the CreateCommand operation and run the command by calling the InvokeCommand operation, the Timeout parameter is set to 60 seconds by default when you create the command. You can specify a value based on your business requirements when you create the command, or call the ModifyCommand operation to change the value after the command is created.

ExecutionException

An exception occurred while the command was running.

Check the error message in the ErrorInfo field. If you cannot identify the issue based on the error message, submit a ticket.

ExitCodeNonzero

The command execution is complete but the exit code is not 0.

Check the command script and the command output.

ClientRestarted

The task was interrupted due to the restart of Cloud Assistant Agent.

Re-execute the task after Cloud Assistant Agent is restarted. You can view the running status of Cloud Assistant Agent on the ECS Cloud Assistant page in the ECS console or by calling the DescribeCloudAssistantStatus operation.

InstanceReleased

The instance was released while the task was being executed.

The task cannot be executed because the instance has been released.

DirectoryNotExists

The specified working directory does not exist on the instance.

Create the working directory on the instance and then rerun the command.

Errors that occur when running a command

Error code

Error message

Recommended solution

ClientIsUpgrading

Cloud Assistant Agent was being upgraded.

Rerun the command after the upgrade of Cloud Assistant Agent is completed. You can view the running status of Cloud Assistant Agent on the ECS Cloud Assistant page in the ECS console or by calling the DescribeCloudAssistantStatus operation.

InstanceDeregistered

The selected managed instance was deregistered.

The command cannot be run because the managed instance has been deregistered.

InvalidSystemBuiltInParameter

Built-in environment parameters are invalid.

The built-in environment parameters are not supported. For information about built-in environment parameters, see the CommandContent description in RunCommand.

DefaultWorkingDirectoryNotAvailable

The default working directory on the instance is unavailable.

Check the default working directory on the instance:

  • For Linux instances, the default working directory is /root, which is the home directory of the administrator (the root user).

  • For Windows instances, the default working directory is the directory where the Cloud Assistant Agent process resides, such as C:\Windows\System32.

You can specify a working directory on the ECS Cloud Assistant page in the ECS console or specify the WorkingDir parameter when you call the RunCommand operation.

CommandNotApplicable

The command type is inapplicable to the specified instances.

Different instance operating systems support different command types:

  • RunBatScript: batch commands, applicable to Windows instances.

  • RunPowerShellScript: PowerShell commands, applicable to Windows instances.

  • RunShellScript: shell commands, applicable to Linux instances.

InvalidCommandText

The command content is invalid.

Check the command content. The command content can be plaintext or Base64-encoded.

CommandContentDecodeError

The command content failed to be decoded.

If the command content is Base64-encoded, check whether the Base64 encoding is correct.

AccountNotExists

The specified user does not exist in the instance.

Create the user and then rerun the command.

  • For Linux instances, the root username is used by default.

  • For Windows instances, the System username is used by default.

You can specify a user on the ECS Cloud Assistant page in the ECS console or specify the Username parameter when you call the RunCommand operation.

Errors that occur when running a command on a schedule

Error code

Error message

Recommended solution

BadCronExpression

The specified cron expression is invalid.

Modify the cron expression. For more information, see Cron expressions.

CronExpressionExpired

The scheduled task failed to be executed because the cron expression expired.

Specify a valid cron expression.

InvalidGMTOffsetForTimezone

The format of the GMT offset time zone that is specified in the cron expression is invalid.

Check the format of the GMT offset time zone.

Supported GMT range: GMT-12:59 to GMT+14:59. The minute field can be set to a value from 0 to 59. The hour field does not support leading zeros.

InvalidGMTOffsetHourForTimezone

The GMT offset hour value specified in the cron expression is invalid.

Check the GMT offset hour value.

Supported GMT range: GMT-12:59 to GMT+14:59. The hour field does not support leading zeros.

InvalidGMTOffsetMinuteForTimezone

The GMT offset minute value specified in the cron expression is invalid.

Check the GMT offset minute value.

The minute field can be set to a value from 0 to 59.

TimezoneInformationCorrupt

Cloud Assistant Agent cannot parse the time zone information. The time zone file may be corrupt.

  • For Linux instances, check whether the required time zone file exists in the /usr/share/zoneinfo directory. For example, /usr/share/zoneinfo/Asia/Shanghai is the time zone file for the time zone of Shanghai, China.

  • For Windows instances, check whether the required time zone file exists in the registry, such as HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.

Note

If the required time zone file does not exist, create the time zone file and then rerun the command.

InvalidRateExpression

The rate expression is invalid.

Modify the rate expression. For more information, see Cron expressions.

RateFrequencyTooLarge

The scheduled execution frequency specified in the rate expression is higher than expected.

Set the scheduled execution frequency to up to seven days.

InvalidAtExpression

The at expression is invalid.

Modify the at expression. For more information, see Cron expressions.

AtExpressionExpired

The scheduled task failed to be executed because the at expression expired.

Specify a valid at expression.

Errors that occur when running a command in a container

Error code

Error message

Recommended solution

InvalidContainerName

The container name is invalid.

The container name can be up to 255 characters in length. The container name can contain only letters, digits, periods (.), underscores (_), and hyphens (-). The container name must start with a letter or digit.

UnsupportedContainerRuntime

The container runtime contained in the container ID is not supported.

Cloud Assistant can be used to run commands only in containers that are managed by Kubernetes based on the Container Runtime Interface (CRI) and run within the Docker, containerd, or CRI-O container runtime.

InvalidContainerId

The container ID is invalid.

Only 64-bit hexadecimal strings are supported. Container IDs that are prefixed with docker://, containerd://, or cri-o:// can specify container runtimes.

ContainerConnectFailed

The container cannot be connected to.

Check whether the container is running. You can run the kubectl command or use Cloud Assistant Agent to check the status of a container. If the container is running, the value of the Status parameter is Running. For more information, see Use Cloud Assistant to run commands in containers.

  • If the container is running, check the container runtime. Cloud Assistant can be used to run commands only in containers that are managed by Kubernetes based on the CRI and run within the Docker, containerd, or CRI-O container runtime.

  • If the container runtime meets the requirements of Cloud Assistant, check whether the command that you want to run in the container meets the relevant requirements. For more information, see the Limits section of the "Use Cloud Assistant to run commands in containers" topic.

ContainerStateAbnormal

The container status is not as expected.

Check the status of the container and make sure that the container is running. You can run the kubectl command or use Cloud Assistant Agent to check the status of a container. If the container is running, the value of the Status parameter is Running. For more information, see Use Cloud Assistant to run commands in containers.

ContainerNotFound

The container does not exist.

Check whether the ID or name of the container is valid by using one of the following methods:

Method 1: Run the kubectl command

kubectl --namespace <Specified namespace> describe pod <Specified pod>

Method 2: Use Cloud Assistant Agent

aliyun-service list-containers --source cri --all

For more information, see Use Cloud Assistant to run commands in containers.

ContainerNameDuplicated

Multiple containers on the node have the same name, and the system cannot identify the correct container in which to run the command.

  • When you specify the name of a container in which to run a command, the container name must be unique on the node.

  • You can also specify the ID of the container in which to run the command. You can run the kubectl command or use Cloud Assistant Agent to check container IDs. For more information, see Use Cloud Assistant to run commands in containers.

ContainerNameAndIdNotMatch

The container ID and the container name do not match.

The specified container ID does not correspond to the specified container name. Check whether the container ID and name are correct.

Errors that occur when running a command on a Windows instance as a non-default user (non-System user)

The following errors may occur when you run a command on a Windows instance as a non-default user (non-System user).

Error code

Error message

Recommended solution

UserOrPasswordInvalid

The username or password is incorrect.

Check the username or password. For information about usernames and passwords, see Encryption parameters and Run Cloud Assistant commands as a regular user.

QueryParameterStoreFailed

Parameters cannot be retrieved from CloudOps Orchestration Service (OOS) Parameter Store.

Check whether the corresponding password information exists in CloudOps Orchestration Service Parameter Store. For more information, see Encrypted parameters.

InstanceRoleInvalid

The required instance roles are not attached to the instance.

Call the DescribeInstanceRamRole operation to check whether the required Resource Access Management (RAM) roles are attached to the instance.

Errors that occur when stopping a command

Error code

Error message

Recommended solution

TerminationException

The task failed to be stopped.

Check the error message in the ErrorInfo field to troubleshoot the issue or try to stop the task again.

Errors that occur when sending a file

Error code

Error message

Recommended solution

FileAlreadyExists

A file with the same name already exists in the destination path.

To resolve the error, use one of the following solutions:

  • Delete the file with the same name in the destination path.

  • Overwrite the file with the same name in the destination path by using one of the following methods:

    • On the ECS Cloud Assistant page in the ECS console, click Send File in the upper-right corner. In the Send File panel, turn on Overwrite.

    • Call the SendFile operation with the Overwrite parameter set to true.

Change the destination path or the name of the file that you want to send.

FileNameInvalid

The file name is invalid.

Change the file name to comply with the file naming conventions of Windows or Linux operating systems by using one of the following methods:

  • On the ECS Cloud Assistant page in the ECS console, click Send File in the upper-right corner. In the Send File panel, specify a valid name in the File Name field.

  • Call the SendFile operation with a valid value specified for the Name parameter.

FilePathInvalid

The destination path is invalid.

Change the destination path to comply with the path conventions of Windows or Linux operating systems by using one of the following methods:

  • On the ECS Cloud Assistant page in the ECS console, click Send File in the upper-right corner. In the Send File panel, specify a valid path in the Destination Path field.

  • Call the SendFile operation with a valid value specified for the TargetDir parameter.

FileAuthorityInvalid

The file permissions are invalid.

Modify the file permissions. File permissions take effect only on Linux instances. You can configure the file permissions in the same way as you configure the chmod command.

UserGroupNotExists

The specified user group does not exist in the instance.

By default, the user group is root. Create the specified user group in the instance.

Sample command: groupadd <groupname>. In the preceding command, replace the <groupname> variable with the name of the user group that you want to create.