本人刚开始学linux,不知怎么误操作了,造成系统无法正常关机。
我的版本是centos release 5.6(Final)
kernel 2.6.18-238.el5xen on an i686
以下是出现的一些故障现象。
开机登录后进入的是
-bash-3.2#
运行csh后切换到正常状态
运行halt/poweroff/init 0都关不了机,显示:
The system is going down for system halt NOW!
INIT:Sending processes the TERM signal
INIT:no more processes left in this runlevel
就不动了。
键盘可使用,但是输入的内容只在屏幕显示出来。
运行/sbin/shutdown now最后显示:
Telling INIT to go to single user mode.
INIT:Going single user
INIT:Sending grocesses the TERM signal
INIT:no more processes left in this runlevel
sh-3.2#
在此状态下运行csh后自动登录为root。
若运行exit
系统就重新启动回到登录画面。
登录后运行reboot,系统可正常重启。
在网上查了很多方法,说是inittab文件的问题,我也看不出来。
我的inittab文件内容如下:
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# When our UPS tells us power has failed, assume we have a few minutes
# of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"
# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"
# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
还请各位高手帮忙看看是什么问题。
再此先谢谢各位了。
woshizl12 于 2011-05-13 17:23:17发表:
。关注
ducheng 于 2011-05-13 12:16:47发表:
在root下运行power off
ygbd 于 2011-05-13 09:58:48发表:
回楼上的连长。
谢谢你的提醒。
请问宿主文件怎么看,菜鸟一个,在网上也没查到“宿主文件”指的是什么,就是有关虚拟机的问题有宿主这个概念。
但是我的是装在物理机器上的,不是装在虚拟机上的。
niucecelinux 于 2011-05-12 17:56:26发表:
可能是用户的宿主文件的事 你看看
ygbd 于 2011-05-12 16:58:46发表:
我回复了怎么就是不显示呢?
回2楼的高手,以下是我的rc的内容不知对解决这个问题有没有用
#! /bin/bash
#
# rc This file is responsible for starting/stopping
# services when the runlevel changes.
#
# Original Author:
# Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#
set -m
# check a file to be a correct runlevel script
check_runlevel ()
{
# Check if the file exists at all.
[ -x "$1" ] || return 1
is_ignored_file "$1" && return 1
return 0
}
# Now find out what the current and what the previous runlevel are.
argv1="$1"
set `/sbin/runlevel`
runlevel=$2
previous=$1
export runlevel previous
. /etc/init.d/functions
# See if we want to be in user confirmation mode
if [ "$previous" = "N" ]; then
if [ -f /var/run/confirm ]; then
echo $"Entering interactive startup"
else
echo $"Entering non-interactive startup"
fi
fi
# Get first argument. Set new runlevel to this argument.
[ -n "$argv1" ] && runlevel="$argv1"
# Is there an rc directory for this new runlevel?
[ -d /etc/rc$runlevel.d ] || exit 0
# First, run the KILL scripts.
for i in /etc/rc$runlevel.d/K* ; do
check_runlevel "$i" || continue
# Check if the subsystem is already up.
subsys=${i#/etc/rc$runlevel.d/K??}
[ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
|| continue
# Bring the subsystem down.
if LC_ALL=C egrep -q "^..*init.d/functions" $i ; then
$i stop
else
action $"Stopping $subsys: " $i stop
fi
done
# Now run the START scripts.
for i in /etc/rc$runlevel.d/S* ; do
check_runlevel "$i" || continue
# Check if the subsystem is already up.
subsys=${i#/etc/rc$runlevel.d/S??}
[ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
&& continue
# If we're in confirmation mode, get user confirmation
if [ -f /var/run/confirm ]; then
confirm $subsys
test $? = 1 && continue
fi
update_boot_stage "$subsys"
# Bring the subsystem up.
if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then
export LC_ALL=C
exec $i start
fi
if LC_ALL=C egrep -q "^..*init.d/functions" $i \
|| [ "$subsys" = "single" -o "$subsys" = "local" ]; then
$i start
else
action $"Starting $subsys: " $i start
fi
done
rm -f /var/run/confirm
if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then
/usr/bin/rhgb-client --quit
fi
回复3楼的高手,我运行usermod -s /bin/csh root后重启系统,用root登录是可以正常显示了,但按其他用户登录还是在-bash-3.2界面,而且还是无法正常关机。
huangyandong 于 2011-05-12 15:58:01发表:
开机后你运行了csh后以后的命令就都在csh环境中运行了,而你的csh只是你系统的一个子环境在这个环境中运行关机和重启命令一般是无效的,若要关机的话,你需要先退出csh后再运行关机命令。如果你要想csh做为你的
默认shell的话你可以使用usermod -s /bin/csh Username 来更改就行了
age 于 2011-05-12 15:47:21发表:
你看看 /etc/rc.d/rc 0 目录里是不是空了?
感觉是不能识别level 0要关闭的进程
sjwkwang_ 于 2011-05-12 15:26:19发表:
这个不了解,占坐学习。。