快速核对表 :
1 ) SSH into your instance.
2 ) Run cat
on /var/log/cloud-init-output.log
and dump it into a nice text file.
3 ) You ll see multiple block which contains the structure below:
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
Transaction Summary
================================================================================
Install X Package (+Y Dependent packages)
每个区块都是根据您提供给 EC2 实例的 < code> 用户数据 code> (所有脚本都存储在 < code>/ var/lib/ cloud/ Instentance/ scrips 下) 创建的。
4) 查找关键词,如 failed
, Error
, WARNINing
或 /var/lib/cloud/introud/intround/introps/products/
。
例如,在出现以下错误的情况下:
/var/lib/cloud/instance/scripts/part-001: line 10: vncpasswd: command not found
cp: cannot stat /lib/systemd/system/[email protected] : No such file or directory
sed: can t read /etc/systemd/system/[email protected]: No such file or directory
Failed to execute operation: No such file or directory
Failed to start vncserver@:1.service: Unit not found.
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Cleaning repos: amzn2-core amzn2extra-docker amzn2extra-epel
(*) 您可以快速查看 /var/log/cloud-init-output.log
或 /var/log/cloud-init.log
的结尾,其中含有一般错误信息,可以告知您在执行 < 强用户数据 < /强者 > 脚本时发生了错误。
以上错误 /var/log/cloud-init-output.log
结尾处:
Is this ok [y/d/N]: Exiting on user command
Your transaction was saved, rerun it with:
yum load-transaction /tmp/yum_save_tx.2020-08-31.15-14.VpTvV1.yumtx
Aug 31 15:14:00 cloud-init[3532]: util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
Aug 31 15:14:00 cloud-init[3532]: cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
Aug 31 15:14:00 cloud-init[3532]: util.py[WARNING]: Running module scripts-user (<module cloudinit.config.cc_scripts_user from /usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc >) failed
Cloud-init v. 19.3-3.amzn2 finished at Mon, 31 Aug 2020 15:14:00 +0000. Datasource DataSourceEc2. Up 87.44 seconds
/var/log/cloud-init.log
的结尾处:
Aug 31 15:14:00 cloud-init[3532]: util.py[DEBUG]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 910, in runparts
subp(prefix + [exe_path], capture=False, shell=True)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 2105, in subp
cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: [ /var/lib/cloud/instance/scripts/part-001 ]
Exit code: 1
Reason: -
Stdout: -
Stderr: -
cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)