一、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. Adobe Photoshop CS6下载安装

    下载链接 http://yunpan.cn/cACgP6Lv5ygit (提取码:f37a) 第一步关键是断开网络,拔掉网线或断开无线 点击登录后,如果没有进入下面的界面,检查是否断网成功 至于选择安 ...

  2. js实现弹窗一个ip在24小时只弹出一次的代码

    function cookieGO(name) { var today = new Date(); var expires = new Date(); expires.setTime(today.ge ...

  3. AngularJS 指循环数组对象

    <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...

  4. 【动态规划 floyd】SPOJ ACPC13

    为什么rzz会把这题放在NOI模拟赛的T2? 题目大意 有一张$n$个点$m$条边的有向图,每条边有权值$w_i$. 定义一个任务$(a_i,b_i,c_i)$是如下一条路径: 最多经过$c_i$条边 ...

  5. Integer和int使用==比较的总结

    public static void main(String[] args) { int i1 = 128; Integer i2 = 128; Integer i3 = new Integer(12 ...

  6. 在网页标题上加个logo

    只需在title标签上加个link标签即可 <link rel="icon" href="images/icon.png" > <title& ...

  7. GNU汇编 存储器访问指令

    .text .global  _start _start: mov r0,#0xff str r0,[r1] ldr r2,[r1]

  8. Shell学习——终端打印

    1.echo1.1.默认情况下,echo在每次调用后会添加一个换行符1.2.待打印的内容,可以用单引号.双引号或者直接打印,不同的方式,有各自的限制1.2.1.使用不带引号的echo时,没法打印分好( ...

  9. java的有用基础知识(2013-05-02-bd 写的日志迁移

    JDK 是整个Java的核心,包括了Java运行环境.Java工具和Java基础类库.是java开发工具包 jre是java的运行环境(如果不做开发就不用安装jdk单独安装jre就可以运行java程序 ...

  10. scrapy之分布式

    分布式爬虫 概念:多台机器上可以执行同一个爬虫程序,实现网站数据的分布爬取. 原生的scrapy是不可以实现分布式爬虫? a) 调度器无法共享 b) 管道无法共享 工具 scrapy-redis组件: ...