Cloud Init无法在EC2中的CentOS 7上安装软件包

时间:2015-05-20 21:39:32

标签: amazon-ec2 centos7 cloud-init

我在用户数据中的EC2实例上定义了云配置文件。许多部件/操作都是由服务器正确运行的,但是软件包安装似乎总是失败:

#cloud-config
package-update: true
package-upgrade: true
# ...
packages:
 - puppet3
 - lvm2
 - btrfs-progs
# ...

我在日志中看到以下内容:

May 20 20:23:39 cloud-init[1252]: util.py[DEBUG]: Package update failed
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 74, in handle
    cloud.distro.update_package_sources()
  File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 278, in update_package_sources
    ["makecache"], freq=PER_INSTANCE)
  File "/usr/lib/python2.6/site-packages/cloudinit/helpers.py", line 197, in run
    results = functor(*args)
  File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 274, in package_command
    util.subp(cmd, capture=False, pipe_cat=True, close_stdin=True)
  File "/usr/lib/python2.6/site-packages/cloudinit/util.py", line 1529, in subp
    cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['yum', '-t', '-y', 'makecache']
Exit code: 1
Reason: -
Stdout: ''
Stderr: ''
May 20 20:23:39 cloud-init[1252]: amazon.py[DEBUG]: Upgrade level: security
May 20 20:23:39 cloud-init[1252]: util.py[DEBUG]: Running command ['yum', '-t', '-y', '--exclude=kernel', '--exclude=nvidia*', '--exclude=cudatoolkit', '--security', '--sec-severity=critical', '--sec-severity=important', 'upgrade'] with allowed return codes [0] (shell=False, capture=False)
May 20 20:23:52 cloud-init[1252]: util.py[WARNING]: Package upgrade failed
May 20 20:23:52 cloud-init[1252]: util.py[DEBUG]: Package upgrade failed
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 81, in handle
    cloud.distro.upgrade_packages(upgrade_level, upgrade_exclude)
  File "/usr/lib/python2.6/site-packages/cloudinit/distros/amazon.py", line 50, in upgrade_packages
    return self.package_command('upgrade', args=args)
  File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 274, in package_command
    util.subp(cmd, capture=False, pipe_cat=True, close_stdin=True)
  File "/usr/lib/python2.6/site-packages/cloudinit/util.py", line 1529, in subp
    cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['yum', '-t', '-y', '--exclude=kernel', '--exclude=nvidia*', '--exclude=cudatoolkit', '--security', '--sec-severity=critical', '--sec-severity=important', 'upgrade']
Exit code: 1
Reason: -
Stdout: ''
Stderr: ''
May 20 20:23:52 cloud-init[1252]: util.py[DEBUG]: Running command ['yum', '-t', '-y', 'install', 'puppet3', 'lvm2', 'btrfs-progs'] with allowed return codes [0] (shell=False, capture=False)
May 20 20:24:03 cloud-init[1252]: util.py[WARNING]: Failed to install packages: ['puppet3', 'lvm2', 'btrfs-progs']
May 20 20:24:03 cloud-init[1252]: util.py[DEBUG]: Failed to install packages: ['puppet3', 'lvm2', 'btrfs-progs']
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 88, in handle
    cloud.distro.install_packages(pkglist)
  File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 70, in install_packages
    self.package_command('install', pkgs=pkglist)
  File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 274, in package_command
    util.subp(cmd, capture=False, pipe_cat=True, close_stdin=True)
  File "/usr/lib/python2.6/site-packages/cloudinit/util.py", line 1529, in subp
    cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['yum', '-t', '-y', 'install', 'puppet3', 'lvm2', 'btrfs-progs']
Exit code: 1
Reason: -
Stdout: ''
Stderr: ''
May 20 20:24:03 cloud-init[1252]: cc_package_update_upgrade_install.py[WARNING]: 3 failed with exceptions, re-raising the last one
May 20 20:24:03 cloud-init[1252]: util.py[WARNING]: Running package-update-upgrade-install (<module 'cloudinit.config.cc_package_update_upgrade_install' from '/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.pyc'>) failed
May 20 20:24:03 cloud-init[1252]: util.py[DEBUG]: Running package-update-upgrade-install (<module 'cloudinit.config.cc_package_update_upgrade_install' from '/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.pyc'>) failed
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/cloudinit/stages.py", line 553, in _run_modules
    cc.run(run_name, mod.handle, func_args, freq=freq)
  File "/usr/lib/python2.6/site-packages/cloudinit/cloud.py", line 63, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python2.6/site-packages/cloudinit/helpers.py", line 197, in run
    results = functor(*args)
  File "/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 111, in handle
    raise errors[-1]
ProcessExecutionError: Unexpected error while running command.
Command: ['yum', '-t', '-y', 'install', 'puppet3', 'lvm2', 'btrfs-progs']
Exit code: 1
Reason: -
Stdout: ''
Stderr: ''

当我实际以root身份运行命令yum -t -y install puppet3 lvm2 btrfs-progs时,它运行正常,但Cloud Init无法独立运行它。

我在这里做错了吗?

1 个答案:

答案 0 :(得分:0)

显然,图像的更高版本修复了一个错误。如果发生这种情况,它可能是Cloud-Init中的合法错误或您的服务器实现它。软件包升级可以解决问题,对映像的更新也会全局修复它。