一、NetworkManager启动问题

1、由于以后要支持e1000版虚拟化网卡,所有centos6镜像均按照NetworkManager服务,并设置开机自启动

2、虚机启动时,默认是NetworkManager服务先启动,后续启动cloud-init,但是NetworkManager启动过程中还未设置好网关,cloud-init就从169.254.169.254获取meta-data,导致获取元数据失败,继而不再重新获取

Mounting local filesystems:  [  OK  ]
Enabling /etc/fstab swaps: [ OK ]
Entering non-interactive startup
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[ OK ]
Starting auditd: [ OK ]
Starting system logger: [ OK ]
Starting system message bus: [ OK ]
Mounting filesystems: [ OK ]
Starting acpi daemon: [ OK ]
Retrigger failed udev events[ OK ]
Starting cloud-init: Cloud-init v. 0.7.5 running 'init-local' at Thu, 19 Oct 2017 07:50:01 +0000. Up 25.44 seconds.
Setting network parameters... [ OK ]
Starting NetworkManager daemon: [ OK ]
Starting cloud-init: Cloud-init v. 0.7.5 running 'init' at Thu, 19 Oct 2017 07:50:02 +0000. Up 26.01 seconds.
ci-info: ++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++
ci-info: +--------+------+--------------+---------------+-------------------+
ci-info: | Device | Up | Address | Mask | Hw-Address |
ci-info: +--------+------+--------------+---------------+-------------------+
ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | . |
ci-info: | eth0 | True | 9.111.222.12 | 255.255.255.0 | fa:16:3e:f3:41:85 |
ci-info: +--------+------+--------------+---------------+-------------------+
ci-info: +++++++++++++++++++++++++++++Route info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+---------+---------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+-------------+---------+---------------+-----------+-------+
ci-info: | 0 | 9.111.222.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U |
ci-info: +-------+-------------+---------+---------------+-----------+-------+
2017-10-19 15:50:02,546 - util.py[WARNING]: No instance datasource found! Likely bad things to come!
Starting cloud-init: Can not apply stage config, no datasource found! Likely bad things to come!
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/bin/cloud-init", line 318, in main_modules
init.fetch()
File "/usr/lib/python2.6/site-packages/cloudinit/stages.py", line 308, in fetch
return self._get_data_source()
File "/usr/lib/python2.6/site-packages/cloudinit/stages.py", line 236, in _get_data_source
pkg_list)
File "/usr/lib/python2.6/site-packages/cloudinit/sources/__init__.py", line 260, in find_source
raise DataSourceNotFoundException(msg)
DataSourceNotFoundException: Did not find any data source, searched classes: ()
------------------------------------------------------------
Starting cloud-init: Can not apply stage final, no datasource found! Likely bad things to come!
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/bin/cloud-init", line 318, in main_modules
init.fetch()
File "/usr/lib/python2.6/site-packages/cloudinit/stages.py", line 308, in fetch
return self._get_data_source()
File "/usr/lib/python2.6/site-packages/cloudinit/stages.py", line 236, in _get_data_source
pkg_list)
File "/usr/lib/python2.6/site-packages/cloudinit/sources/__init__.py", line 260, in find_source
raise DataSourceNotFoundException(msg)
DataSourceNotFoundException: Did not find any data source, searched classes: ()
------------------------------------------------------------
Starting sshd: [ OK ]
NTP server not specified in /etc/ntp/step-tickers or /etc/ntp.conf
Starting crond: [ OK ]
Cloud-init v. 0.7.5 running 'init' at Thu, 19 Oct 2017 07:50:06 +0000. Up 30.44 seconds.

console输出的启动日志

3、临时解决办法:cloud-init只获取一次meta-data,如果拿到就执行cloud-init final阶段,如果获取失败则报错,不再重新获取。

需要手动执行命令:cloud-init init 重新加载元数据。见官方释义:

your 'cloud-init modules --mode init' is a bad command. it shouldnt fail like that, but its not normally called like that.
I think what might be wrong is that you're not getting the systemd files, and your boot just isn't fully working. proper cloud-init boot consists of:
1.) cloud-init init --local
when root filesystem is mounted (not network guaranteed or expected)
2.) cloud-init init
when root filesystem is mounted and expected networking is up
3.) cloud-init modules --mode=config
4.) cloud-init modules --mode=final if [ $(nm-tool|grep State|cut -f2 -d' ') == "connected" ]; then
#Whatever you want to do if the network is online
else
#Whatever you want to do if the network is offline - note, this and the else above are optional
fi

官方说明

以下是重新请求meta-data过程,此时的网关已配置好。

ci-info: ++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++
ci-info: +--------+------+--------------+---------------+-------------------+
ci-info: | Device | Up | Address | Mask | Hw-Address |
ci-info: +--------+------+--------------+---------------+-------------------+
ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | . |
ci-info: | eth0 | True | 9.111.222.12 | 255.255.255.0 | fa:16:3e:f3:41:85 |
ci-info: +--------+------+--------------+---------------+-------------------+
ci-info: ++++++++++++++++++++++++++++++++++Route info+++++++++++++++++++++++++++++++++++
ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
ci-info: | 0 | 169.254.169.254 | 9.111.222.1 | 255.255.255.255 | eth0 | UGH |
ci-info: | 1 | 9.111.222.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U |
ci-info: | 2 | 0.0.0.0 | 9.111.222.1 | 0.0.0.0 | eth0 | UG |
ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
Cloud-init v. 0.7.5 running 'modules:final' at Thu, 19 Oct 2017 07:50:09 +0000. Up 32.83 seconds.
ci-info: no authorized ssh keys fingerprints found for user centos.
ci-info: no authorized ssh keys fingerprints found for user centos.
ec2:
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: 1024 64:51:25:60:d0:dd:b8:4e:7d:44:48:26:10:f9:45:f9 /etc/ssh/ssh_host_dsa_key.pub (DSA)
ec2: 2048 16:59:08:50:37:c3:00:ef:99:95:3f:a3:77:fa:93:a4 /etc/ssh/ssh_host_key.pub (RSA1)
ec2: 2048 a5:6a:dd:74:ca:16:8e:31:bf:b3:4b:0a:c2:00:8a:42 /etc/ssh/ssh_host_rsa_key.pub (RSA)
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
2048 35 27541365050360239591435118454881578709989698650445165117194575889698589475215223627758158702900045160955947733502097866541192556859221451348995793597455183479757238929837171679731292857649919286872697745243345043316525076401529065475241084237855394096516334565000392633100535646579890169878467508388499646801050965943901526178822341472627146211336179874861157576903803503129246774552668615235335787440894750828817448110386642500635061170389250028325735639078142790135990986654283910570646473566300407984700279749726680206710460528663881338239437387901739932914387009958132186216400741136674654292094798863513309928467
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvE3cSVF2vqXcGe+1yuhKx2ZiAP2QKNgzgSRiCpm2MIzIirxnIPmGhgNRSo/GiJfNrw3Pk//i3rNYPAvvC9xs0MDeXGPqcxKemOUYzdmfX3BvdUMVi4nst+oAj3wBGeqEdFMXy5qTvh2zJbTvYDJ4CY8GpPO/WFjV/WqFeaquP6nIbn51rcJMbusj4dLITkXR+/YS+m5xfKI68y7E16HzqWZhDL72orYUZKlkC4BAsY1ySgd+mDslWVnQ6qZcK8cHiIqMHGBI0GlTRil1tg5DBfvXzxtOh0w91pJNvSO9u+XGnzvEy9tTR1Asw/8qecKloCFWnDh4ZFOAdnFVVy171w==
-----END SSH HOST KEY KEYS-----
Cloud-init v. 0.7.5 finished at Thu, 19 Oct 2017 07:50:09 +0000. Datasource DataSourceOpenStack [net,ver=2]. Up 33.31 seconds CentOS release 6.5 (Final)
Kernel 2.6.32-431.el6.x86_64 on an x86_64 boot6-5 login:

cloud-init重新加载meta-data过程

4、根本解决办法:

v1、rc.local运行命令重新加载

v2、修改cloud.cfg,增加超时和重试参数

datasource:
OpenStack:
metadata_urls: ["http://169.254.169.254"]
max_wait: 120
timeout: 10
retries: 5

centos6系列问题的更多相关文章

  1. centos6系列更换阿里yum源

    1.首先备份原来的cent os官方yum源 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak 2. ...

  2. CentOS6系列系统启动常见故障排查与解决方法

    情景一.内核文件损坏 /boot/vmlinuz-2.6.32-642.el6.x86_64 内核文件 1.故障现象 2.解决方法:挂载光盘,进入rescue(救援)模式 3.选择--English- ...

  3. Centos6系列Bond配置方法

    在Windows Server平台因业务需求经常会用到NIC双网卡绑定,同样Linux平台下用于网络负载均衡及网络冗余会用到bond模式. Bond模式:0-6,即7种模式. 模式一:mod=0 ,即 ...

  4. Centos6系列安装nginx

    设置ssh服务为开机启动 输入命令:chkconfig sshd on 即可.注:若是chkconfig sshd off则禁止SSH开机启动 设定账号为bizuser ,密码为123456 第一步: ...

  5. 在centos6系列vps装Tomcat8.0

    In the following tutorial you will learn how to install and set-up Apache Tomcat 8 on your CentOS 6 ...

  6. centos6.7 安装Docker

      一.查看系统版本 [root@localhost ~]# cat /etc/redhat-release CentOS release 6.7 (Final) 二.安装EPEL 1.进入cento ...

  7. CentOS6 启动流程图文解剖

    我们在使用Linux操作系统的时候,我们只需按下电源键,等待,然后输入账户和密码就可以使用Linux操作系统了.那么在按下电源到输入账号和密码之前,操作系统都做了些什么?下面就来讲述在这段时间发生的动 ...

  8. CentOS6.9安装mysql5.7

    1.查看系统版本 uname -a 2.卸载old mysql rpm -qa|grep -i mysql rpm -ev MySQL-client-5.5.25a-1.rhel5 如果提示依赖错误, ...

  9. centos6安装部署git服务器(gitlab6.4)

    环境准备 python版本2.6git版本 1.8.4.1ruby版本ruby-2.0.0-p353gitlab-shell版本 v1.8.0gitlab版本6.4.3 因centos6系列的pyth ...

随机推荐

  1. 将一个命令的输出保存到CSV文件

    执行段: 结果段: 补充:配合不同的命令可以使工作更加简单 使用Imort-Csv命令从文件中导入结构化数据

  2. 安裝 PHP 時出現undefined reference to `libiconv_open’ 之類的錯誤訊息

    在安裝 PHP 到系統中時要是發生「undefined reference to `libiconv_open'」之類的錯誤訊息,那表示在「./configure 」沒抓好一些環境變數值.錯誤發生點在 ...

  3. EF问题集合

    1. 在使用数据迁移的过程中,如果手工删除了本地数据库之后,再次尝试连接被删除的数据库,会有以下提示: System.Data.SqlClient.SqlException (0x80131904): ...

  4. Yarn下Map数控制

    public List<InputSplit> getSplits(JobContext job) throws IOException { long minSize = Math.max ...

  5. GPGPU::数学基础教程

    并行方向需要学习的数学知识 http://dev.gameres.com/Program/Visual/3D/GPGPU_math_Tutorial.html

  6. javascript入门笔记2-window

    1.JavaScript-输出内容(document.write) <script type="text/javascript"> document.write(&qu ...

  7. JDBC-Hibernate-Mybatis

    JDBC sql语句和Java代码混在了一起 Hibernate 自动生成sql语句 Mybatis 将sql语句写在xml文件中,使用时动态生成

  8. windows下配置kafka

    https://blog.csdn.net/evankaka/article/details/52421314

  9. Mac openssl 和curl源码编译

    1.先编译openssl, 下载源码后解压,终端进入源码目录,输入命令配置编译环境:./Configure darwin64-x86_64-cc 等待配置完成后,输入make  和make insta ...

  10. python 错误问题解决

    获取天气信息 #encoding:UTF-8 import urllib.request import re def getHtml(url): page=urllib.request.urlopen ...