快速清单:
1 ) SSH 进入您的实例。
2 ) 继续运行cat
并将/var/log/cloud-init-output.log
其转储到一个不错的文本文件中。
3 ) 你会看到包含以下结构的多个块:
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
Transaction Summary
================================================================================
Install X Package (+Y Dependent packages)
每个块都是根据user data
您提供给 EC2 实例的内容创建的(所有脚本都存储在 下/var/lib/cloud/instance/scripts
)。
4) 搜索关键字,如Failed
,或 。Error
WARNING
/var/lib/cloud/instance/scripts/
例如,如果出现以下错误:
/var/lib/cloud/instance/scripts/part-001: line 10: vncpasswd: command not found
cp: cannot stat '/lib/systemd/system/vncserver@.service': No such file or directory
sed: can't read /etc/systemd/system/vncserver@.service: 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)