1,146 瀏覽數

Bootup RHEL6 – 不同 Linux 以往的開機方式

RedHat01
參考文件 – http://docs.redhat.com/docs/zh-TW/Red_Hat_Enterprise_Linux/6/html/Migration_Planning_Guide/ch04s02.html

這一次 RHEL 6 的開機方式不同於以往,採用了 Upstart 所以很多開機時的設定檔已非以往,現在我們來回想一下 Linux kernel 開機後執行的第一個程式 /sbin/init 會依據 /etc/inittab 檔案來決定做何種設定.

但在 RHEL 6 只留了 initdefault 一​​​​​​​行​​​​​​​設​​​​​​​定​​​​​​​​​​​​ runlevel,其他設定定義接儲存在 ​​​/etc/init 目​​​​​​​錄​​​​​​​中

[root@benjr ~]# cat /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used 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:5:initdefault:

決定開機的Level id:5:initdefault:

下面是各個 runlevel 的定義

  • runlevel 0 – halt (Do NOT set initdefault to this)
  • runlevel 1 – Single user mode
  • runlevel 2 – Multiuser, without NFS (The same as 3, if you do not have networking)
  • runlevel 3 – Full multiuser mode
  • runlevel 4 – unused
  • runlevel 5 – X11
  • runlevel 6 – reboot (Do NOT set initdefault to this)

不同的 runlevel 決定不同的服務是否啟動或關閉.
我們來看一下 /etc/init 目錄的資料內容為何!

[root@benjr ~]# ll /etc/init
total 64
-rw-r–r–. 1 root root 260 Sep 1 2010 control-alt-delete.conf
-rw-r–r–. 1 root root 130 Jun 30 2010 init-system-dbus.conf
-rw-r–r– 1 root root 0 Mar 16 17:09 init.txt
-rw-r–r–. 1 root root 263 Sep 1 2010 kexec-disable.conf
-rw-r–r–. 1 root root 409 Sep 1 2010 plymouth-shutdown.conf
-rw-r–r–. 1 root root 217 Sep 1 2010 prefdm.conf
-rw-r–r–. 1 root root 362 Sep 1 2010 quit-plymouth.conf
-rw-r–r–. 1 root root 281 Sep 1 2010 rc.conf
-rw-r–r–. 1 root root 766 Sep 1 2010 rcS.conf
-rw-r–r–. 1 root root 580 Sep 1 2010 rcS-sulogin.conf
-rw-r–r–. 1 root root 2915 Mar 25 2010 readahead-collector.conf
-rw-r–r–. 1 root root 1559 Mar 25 2010 readahead.conf
-rw-r–r–. 1 root root 726 Mar 25 2010 readahead-disable-services.conf
-rw-r–r–. 1 root root 844 Sep 1 2010 serial.conf
-rw-r–r–. 1 root root 643 Sep 1 2010 splash-manager.conf
-rw-r–r–. 1 root root 329 Sep 1 2010 start-ttys.conf
-rw-r–r–. 1 root root 146 Sep 1 2010 tty.conf

看一下 /etc/inittab 裡面的定義,以及 /etc/init 目錄的資料就可以知道以前 /etc/inittab 所定義的設定都跑到哪裡去了

  • System initialization is started by /etc/init/rcS.conf
  • Individual runlevels are started by /etc/init/rc.conf
  • Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
  • Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf

2 個網友的想法 “Bootup RHEL6 – 不同 Linux 以往的開機方式

  1. 自動參照通知: Busybox | Benjr.tw

  2. 自動參照通知: RHEL6 – upstart | Benjr.tw

發表迴響