Diagnose root cause of ECS instance unexpected reboot or crash. Uses standard workflow: check platform maintenance events first, then check internal system logs. Supports both Linux and Windows systems.
Before starting diagnosis, must obtain the following parameters from user:
ParameterDescriptionExampleINSTANCE_IDECS instance IDi-bp1a2b3c4d5e6f7g8h9j``REGION_IDRegion IDcn-hangzhou
If user does not provide any of the above parameters, must ask user first. Do not start diagnosis.
DescribeCloudAssistantStatus. If not running, provide alternative diagnostic approaches.references/output-format.md, output strictly according to template structure. No free-form output, no omitted sections, no changed hierarchy. Every placeholder {...} in the template must be filled with actual data.Before using aliyun CLI commands, must configure AI-Mode:
bash
# Enable AI-Mode
aliyun configure ai-mode enable
# Set user-agent for skill identification
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-ecs-reboot-or-crash-diagnosis"
# Update plugins
aliyun plugin update
After diagnosis complete, disable AI-Mode:
bash
aliyun configure ai-mode disable
Credentials must be pre-configured outside of agent session. Agent only verifies:
bash
aliyun configure list
Cloud Assistant client must be installed and running on the instance
DescribeCloudAssistantStatus APIInstance status must be Running
Note: If Cloud Assistant is not running, diagnostic commands cannot be executed remotely. Must provide manual diagnostic steps to user.
See RAM Policies for the complete permission list and custom policy example.
Verify instance exists and get basic information:
bash
aliyun ecs describe-instances \
--biz-region-id <REGION_ID> \
--region <REGION_ID> \
--instance-ids '["<INSTANCE_ID>"]'
Confirm from returned JSON:
RegionId — Region ID (matches user provided)Status — Instance status (Running/Stopped)InstanceName — Instance nameOSType — Operating system type ( windows / linux)Record OSType for Step 3 branch selection.
Query instance historical system events to determine if platform maintenance caused reboot:
bash
aliyun ecs describe-instance-history-events \
--biz-region-id <REGION_ID> \
--region <REGION_ID> \
--instance-id <INSTANCE_ID> \
--event-cycle-status Executed
Event Analysis:
Event TypeMeaningDeterminationNext StepSystemMaintenance.RebootReboot caused by system maintenancePlatform-initiated maintenanceInform user, no further investigation neededSystemFailure.RebootReboot caused by underlying hardware/system failurePlatform infrastructure failureSuggest instance migration or contact supportInstanceFailure.RebootReboot caused by instance-level failureInstance internal issue detected by platform****Must continue to Step 3 for system log checkInstanceExpiration.StopInstance stopped due to expirationBilling issueNeed renewal, no further investigationNo relevant eventsNo platform maintenance events foundNot platform-initiatedContinue to Step 3
Important Notes for InstanceFailure.Reboot:
If maintenance event found:
If no maintenance event found:
Before executing diagnostic commands, verify Cloud Assistant is running:
bash
aliyun ecs describe-cloud-assistant-status \
--biz-region-id <REGION_ID> \
--region <REGION_ID> \
--instance-id <INSTANCE_ID>
Check the response:
json
{
"InstanceCloudAssistantStatusSet": {
"InstanceCloudAssistantStatus": [
{
"InstanceId": "i-xxx",
"RegionId": "cn-xxx",
"CloudAssistantStatus": "true",
"LastHeartbeatTime": "2026-04-09T07:26:58Z"
}
]
}
}
Important Notes:
CloudAssistantStatus is a string ("true"/"false"), not booleanLastHeartbeatTime to ensure it's recent (within last few minutes)kdump, crash files named vmcore-*kdump-tools, crash files named dump.* and dmesg.*If CloudAssistantStatus is false or command fails:
If CloudAssistantStatus is true:
Execute Linux diagnostic script via Cloud Assistant to check:
last reboot, /var/log/messages or /var/log/syslog)dmesg)vm.panic_on_oom configurationComplete diagnostic commands: see diagnostic-commands.md
Linux Result Analysis:
FindingPossible CauseSuggestionKernel Panic + crash dump (vmcore/dump.*)Kernel crash, dump file generatedRead dmesg.* file for panic reason, contact Alibaba Cloud technical support for deep analysisKernel Panic + no crash dumpKernel crash, but kdump not configured or not workingProceed to Step 5: Recommend Kdump configuration for future crash captureOOM + panic_on_oom=1OOM triggered kernel panicDisable panic_on_oom or increase memoryOOM KillerMemory insufficient causing process killedOptimize memory usage or upgrade instance typeSysRq triggered crashManual crash trigger via /proc/sysrq-triggerCheck if intentional test, review bash history and audit logsNormal reboot recordsUser or program triggered rebootCheck cron jobs or ops scriptsNo abnormal recordsNo system-level issues foundMay be external factors, suggest monitoring
Before executing diagnostic commands, verify Cloud Assistant is running:
bash
aliyun ecs describe-cloud-assistant-status \
--biz-region-id <REGION_ID> \
--region <REGION_ID> \
--instance-id <INSTANCE_ID>
Check the response:
CloudAssistantStatus: true — Cloud Assistant is running, proceed to Step 3B.2
CloudAssistantStatus: false — Cloud Assistant is not running
Execute Windows diagnostic script via Cloud Assistant to check:
Complete diagnostic commands: see diagnostic-commands.md
Windows Result Analysis:
FindingPossible CauseSuggestionEvent 41 (Kernel-Power)Unexpected shutdown/crashCheck for BSOD, dump filesDump configured + dump file existsSystem crashed and captured dumpContact Alibaba Cloud technical support for dump file analysisDump configured + no dump fileCrash occurred but no dump capturedCheck pagefile and disk spaceDump not configuredCrash dumps disabledEnable memory dump for diagnosisBSOD events foundBlue screen crash occurredCheck bug check code in dumpNo abnormal eventsNo system-level crash recordsMay be power issue or external factor
After executing diagnostic script via RunCommand, query the execution result:
bash
aliyun ecs describe-invocations \
--biz-region-id <REGION_ID> \
--region <REGION_ID> \
--instance-id <INSTANCE_ID> \
--invoke-id <INVOKE_ID>
Important Notes:
--instance-id (not --instance-id.1) for describe-invocations APIInvokeId is returned by the RunCommand API callOutput field from Base64 to get diagnostic resultsInvokeStatus to ensure command execution completed successfullyIf Step 3 found crash dump files (vmcore on Linux, MEMORY.DMP/minidump on Windows), perform preliminary analysis.
Complete analysis commands: see diagnostic-commands.md
Important: If Linux vmcore files need deep analysis or Windows dump files (MEMORY.DMP/minidump) are found, recommend the user contact Alibaba Cloud technical support team for professional crash dump analysis assistance.
If Step 3A found Kernel Panic records but no vmcore files, must advise user to configure Kdump.
/var/crash has no vmcore filesinactive or failed/proc/cmdline does not contain crashkernel= parameterWhy Kdump is needed: Without Kdump, kernel crashes will not generate vmcore files, making root cause analysis impossible.
Configuration requirements:
crashkernel= kernel parameter/var/crash (or configured path)Configuration reference: Provide guidance from diagnostic-commands.md
RHEL/CentOS/Alibaba Cloud Linux:
yum install -y kexec-toolscrashkernel=auto to kernel parameters in /etc/default/grubgrub2-mkconfig -o /boot/grub2/grub.cfgsystemctl enable --now kdumpUbuntu/Debian:
apt-get install -y kdump-toolsUSE_KDUMP=1 in /etc/default/kdump-toolsupdate-grub (crashkernel parameter usually auto-added)systemctl status kdump-toolsIf Step 3B found BSOD events but no dump files:
CrashDumpEnabled registry value is not 0After all diagnostic steps complete, must do both of the following:
references/output-format.md — Get complete output format template