分类: LINUX
2012-05-05 22:11:21
Ubuntu使用upstart替换了inittab。 具体的看一下/etc/event.d/目录就可以。
如何使Ubuntu默认不使用图形界面呢?
script
runlevel --reboot || true
if grep -q -w -- "-s\|single\|S" /proc/cmdline; then
telinit S
elif [ -r /etc/inittab ]; then
RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
if [ -n "$RL" ]; then
telinit $RL
else
telinit 2
fi
else
telinit 2
fi
end script
解决办法很简单:
$ sudo mv /etc/rc3.d/S30gdm /etc/rc3.d/K30gdm
然后把最后一行的telinit 2改为telinit 3即可(或者编辑一个/etc/inittab文件,内容为id:3:initdefault:)。Ubuntu中此命令从文本模式启动。
另外,Ubuntu的一个特殊的地方是,它默认的启动级别是2,使用runlevel命令查看,得到N 2。一般系统,如R.H.,启动的级别是5。但仔细查看Ubuntu中的/etc/rc2.d和/etc/rc5.d,它们所包含的内容基本一致。
# runlevel.
If you create your own /etc/inittab file, Ubuntu will honour it.
To
change your runlevels the Ubuntu way look in /etc/init.d/ which
contains startup scripts. Then look in /etc/rc#.d/ which contains
symlinks to scripts in /etc/init.d/. The name of the symlinks determines
what will be started/stopped and in what order. Look in the README file
in any of the /etc/rc#.d/ directories for details.
The # in the /etc/rc#.d/ is the runlevel number.
To stop GDM from loading in runlevel 2 (Ubuntu default runlevel) rename /etc/rc2.d/S30gdm to /etc/rc2.d/K70gdm
The
S tells Ubuntu to start the process, and the K tells Ubuntu to kill it.
The number is the order in which it should be started/stopped.
Have a look at the man page for update-rc.d which can be used to create/update/remove the init script symlinks for you.
EDIT: You can also