ubuntu启动慢显示waiting for network configuration

现在ubuntu采用的是upstart启动方式,区别于传统的System V initialization启动方式。

ubuntu启动的时候会根据/etc/init中的系统配置文件来启动服务。

更多关于两种启动方式的区别在这儿

在/etc/init下有一个文件,叫做failsafe.conf,打开这个文件,我的猜测是这个文件定义了一些启动时的延时

其中可以找到这么几句,

1
2
3
4
5
6
7
8
9
    # Plymouth errors should not stop the script because we *must* reach
    # the end of this script to avoid letting the system spin forever
    # waiting on it to start.
    $PLYMOUTH message --text="Waiting for network configuration..." || :
        sleep 40
      
    $PLYMOUTH message --text="Waiting up to 60 more seconds for network configuration..." || :
        sleep 59
    $PLYMOUTH message --text="Booting system without full network configuration..." || :

这里定义了plymouth错误发生时候的延时,比如发生了错误信息

Waiting for network configuration...

那么就sleep 40,即等待40s

因此我们只需要将这几个sleep的语句给注释掉,就应该不用sleep了,从而直接启动。

 

另外,关于这个错误发生的原因,网上的看法是:在boot的过程中,某些process更改了/etc/network/interfaces中的eth0等端口,

因此还可以这么解决:注释掉除lo以外的其他所有端口配置。

但是我很奇怪这样开机岂不是又要自己配置网络,特别像是我这种网络环境经常变化的。

于是还有一种方法就是不允许其它process来更改/etc/network/interfaces,重启前执行

1
chattr +i /etc/network/interfaces

开机后执行

1
chattr -i /etc/network/interfaces

 

主要参考来源:http://www.codewhirl.com/2011/10/ubuntu-11-10-waiting-up-to-60-more-seconds-for-network-configuration/

posted on 2013-05-18 01:41  telnetning  阅读(1223)  评论(0编辑  收藏  举报