All Products
Search
Document Center

Elastic Compute Service:Check execution results and troubleshoot common issues

Last Updated:Dec 26, 2023

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. These exceptions include a lack of 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 execution results 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 upper-left corner of the top navigation bar, select a region. 地域

  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 Status column.

      2. In the Actions column, click View.

      3. In the Execution Details panel, view the execution results on the Task Completed tab of the Instances tab.查看执行结果

    • 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 Task Failed is displayed in the Status column.

      2. In the Actions column, click View.

      3. In the Execution Details panel, view the execution results on the Task Failed tab of the Instances tab.

        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 Status column.

      2. In the Actions column, click View.

      3. In the Execution Details panel, view execution results on the Instances tab.

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

        定时任务执行结果

View execution results by using Alibaba Cloud CLI

If you use Cloud Assistant by means of Alibaba Cloud CLI or OpenAPI Explorer, you can call the DescribeInvocations or DescribeInvocationResults operation to query the execution results of Cloud Assistant commands. If an execution fails, you can check the ErrorCode and ErrorInfo values in the API responses for error details.

In the following examples, the DescribeInvocations and DescribeInvocationResults operations are used to describe how to use Alibaba Cloud CLI to query execution results.

  • Call the DescribeInvocations operation to query the execution state of a command.

    aliyun ecs DescribeInvocations --RegionId TheRegionId --InvokeId your-invoke-id
  • Call the DescribeInvocationResults operation to query the execution results of a command on a specific instance.

    aliyun ecs DescribeInvocationResults --RegionId TheRegionId --InstanceId i-bp1g6zv0ce8og******p --InvokeId your-invoke-id

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 the Task Manager.

  2. If the process is not found, 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 AliyunService by using Service Manager.

Note

If Cloud Assistant Agent still cannot be started after the preceding operations are performed, re-install Cloud Assistant Agent. For more information, see Install Cloud Assistant Agent.

ClientNetworkBlocked

The instance network environment is abnormal.

  1. Run the following command to check network connectivity. If the instance has network connectivity, 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 of Cloud Assistant Agent is stored in an Object Storage Service (OSS) bucket. Only the installation package, instead of the bucket, is publicly accessible. As such, 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 more information about the domain names and IP addresses of the Cloud Assistant server in each region, see Configure network permissions for the 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, run the Cloud Assistant command again. If the execution fails again, 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 AliyunService by using Service Manager.

ClientNeedUpgrade

Cloud Assistant Agent is not upgraded.

Enable auto-upgrade for Cloud Assistant Agent or manually upgrade Cloud Assistant Agent. For more information, see Upgrade or disable upgrades for Cloud Assistant Agent.

ClientNotOnline

Cloud Assistant Agent is not connected to the server.

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

DeliveryTimeout

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

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

ExecutionTimeout

The command execution has timed out.

Extend the command execution timeout period.

  • If you create and run a command in the ECS console, the Timeout Period parameter is set to 60 seconds by default. Specify an appropriate value.

  • If you run a command by calling the RunCommand operation, the Timeout parameter is set to 60 seconds by default. Specify an appropriate value.

  • 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. Specify an appropriate value 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 Cloud Assistant page in the ECS console or by calling the DescribeCloudAssistantStatus operation.

InstanceReleased

The instance was released while the command 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 re-run the command.

Errors that occur when running a command

Error code

Error message

Recommended solution

ClientIsUpgrading

Cloud Assistant Agent was being upgraded.

Re-run the command after Cloud Assistant Agent is upgraded. You can view the running status of Cloud Assistant Agent on the 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 before you run a command, which can be specified by using the Cloud Assistant page or the RunCommand operation with the WorkingDir parameter set.

CommandNotApplicable

The command type is not applicable 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 re-run 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 before you run a command, which can be specified by using the Cloud Assistant page or the RunCommand operation with the Username parameter set.

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 the "Run a command on a clock-based schedule" section in Run a command on a schedule.

CronExpressionExpired

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

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

Support 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 any value from 0 to 59.

TimezoneInformationCorrupt

The timezone files were damaged so that Cloud Assistant Agent failed to process timezone information.

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

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

Note

If the required timezone file does not exist, create the timezone file and then re-run the command.

InvalidRateExpression

The rate expression is invalid.

Modify the rate expression. For more information, see the "Run a command at a regular interval" section in Run a command on a schedule.

RateFrequencyTooLarge

The scheduled execution frequency specified in the rate expression is low.

Set the scheduled execution frequency to be no more than 7 days. The scheduled execution frequency cannot be greater than 7 days.

InvalidAtExpression

The at expression is invalid.

Modify the at expression. For more information, see the "Run a command only once at a specific time" section in Run a command on a schedule.

AtExpressionExpired

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

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. It can contain only letters, digits, commas (,), underscores (_), and hyphens (-). It 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.

Check whether the container is running. You can use kubectl or 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 requirements. For more information, see the "Limits" section in Use Cloud Assistant to run commands in containers.

ContainerStateAbnormal

The container does not work as expected.

Check the status of the container and make sure that the container is running. You can use kubectl or 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: Use kubectl

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, which causes an issue in identifying the correct container to run the command.

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

  • You can specify the ID of a container to run a command in the container. You can use kubectl or 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 as a non-default user (not System) on a Windows instance

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

Error code

Error message

Recommended solution

UserOrPasswordInvalid

The username or password is incorrect.

The username or password is correct. For information about usernames and passwords, see Manage encryption parameters and Run Cloud Assistant commands as a regular user.

QueryParameterStoreFailed

Parameters cannot be retrieved from CloudOps Orchestration Service Parameter Store.

Check whether the corresponding password information exists in OOS Parameter Store. For more information, see Manage encryption 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 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. Perform one of the following operations:

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

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

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

FileNameInvalid

The file name is invalid.

Modify the file name to comply with the file naming conventions of Windows or Linux operating systems. Perform one of the following operations:

  • On the Cloud Assistant page of 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 and specify a valid value for the Name parameter.

FilePathInvalid

The destination path is invalid.

Modify the destination path to comply with the path conventions of Windows or Linux operating systems. Perform one of the following operations:

  • On the Cloud Assistant page of 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 to specify a valid value 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 <groupname> with the name of the user group that you want to create.