“INIT:Id "x" respawning too fast,disabled for 5 minutes”有关问题之解决思路

“INIT:Id "x" respawning too fast,disabled for 5 minutes”问题之解决思路

CentOS5,启动过程中出现以下问题:

INIT:Id "x" respawning too fast,disabled for 5 minutes
图形界面无法启动。
首先根据错误信息知道是init程序在执行系统 启动脚本时出现问题,init所执行的脚本是
/etc/inittab,
查看之: [root@localhost ~]# cat /etc/inittab,

找到最后一行:

x:5:respawn:/etc/X11/prefdm -nodaemon

图形就是由这行启动的,ID为x的行在运行级5的时候会启动prefdm程序,而且有respawn参数,此参数的作用是当程序退出后自动重新启动它,根据错误提示里的respawing too fast判断是由于程序启动异常导致频繁重启.

分析如下:

1、[root@localhost ~]# file /etc/X11/prefdm
/etc/X11/prefdm: Bourne shell script text executable
说明该文件是一个可执行的脚本文件
2、[root@localhost ~]# vi /etc/X11/prefdm
#!/bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin

# shut down any graphical boot that might exist
if [ -x /usr/bin/rhgb-client ]; then
    /usr/bin/rhgb-client --quit
fi

# We need to source this so that the login screens get translated
[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n

# Run preferred X display manager
preferred=
if [ -f /etc/sysconfig/desktop ]; then
	. /etc/sysconfig/desktop
	if [ "$DISPLAYMANAGER" = GNOME ]; then
		preferred=/usr/sbin/gdm
	elif [ "$DISPLAYMANAGER" = KDE ]; then
		preferred=/usr/bin/kdm
	elif [ "$DISPLAYMANAGER" = XDM ]; then
	        preferred=/usr/bin/xdm
        elif [ -n "$DISPLAYMANAGER" ]; then
		preferred=$DISPLAYMANAGER
	fi
fi

shopt -s execfail

[ -n "$preferred" ] && exec $preferred "$@" >/dev/null 2>&1 </dev/null

# Fallbacks, in order
exec gdm "$@" >/dev/null 2>&1 </dev/null
exec kdm "$@" >/dev/null 2>&1 </dev/null
exec xdm "$@" >/dev/null 2>&1 </dev/null

# catch all exit error
exit 1
从文件内容可知:首先检测界面显示管理器的配置,由于我只安装了GNOME,所以会去运行/usr/sbin/gdm程序
那么这个程序是什么东东呢?
3、[root@localhost ~]# yum whatprovides /usr/sbin/gdm(要保证已经联网)
   Loaded plugins: fastestmirror, protectbase
   Loading mirror speeds from cached hostfile
    * base: centos.ustc.edu.cn
    * extras: centoso4.centos.org
    * rpmforge: apt.sw.be
    * updates: centos.ustc.edu.cn
   47 packages excluded due to repository protections
   1:gdm-2.16.0-56.el5.centos.i386 : GNOME 显示管理器。
   Repo        : base
   Matched from:
   Filename    : /usr/sbin/gdm

   1:gdm-2.16.0-56.el5.centos.i386 : GNOME 显示管理器。
   Repo        : installed
   Matched from:
   Other       : Provides-match: /usr/sbin/gdm

可以看出这就是GNOME的显示管理器,这就说明我没安装GNOME管理器了!
4、[root@localhost ~]# ll /usr/sbin/gdm
运行结果显示果然没安装,OK!安装吧!
5、[root@localhost ~]# yum install gdm -y

重启系统,搞定over!