ubuntu下運行等級設定以及引導載入程式路徑問題

來源:互聯網
上載者:User

linux運行等級共有7級:
           0:系統直接關機
           1:單一使用者模式
     2:和等級3一致,但無NFS服務
           3:完整的含有網路功能的純文字模式
           4:系統保留功能
           5:與運行等級3類似,但使用X Window
           6:系統重啟
從上面7級可以看出,我們可以設定運行等級其實只能設定1,2,3,5。0和6我不用解釋吧,如果設定為4,系統會不斷的自動關機或自動重啟的。
 
預設情況下,要想修改預設運行等級,要修改/etc/inittab檔案。但是ubuntu系統並沒有這個檔案。而是需改/etc/init/rc-sysinit.conf這個檔案:
view plain
description     "System V initialisation compatibility" 
author          "Scott James Remnant <scott@netsplit.com>" 
 
start on filesystem 
stop on runlevel 
 
# Default runlevel, this may be overriden on the kernel command-line 
# or by faking an old /etc/inittab entry 
env DEFAULT_RUNLEVEL=3 
 
# There can be no previous runlevel here, but there might be old 
# information in /var/run/utmp that we pick up, and we don't want 
# that. 
# 
# These override that 
env RUNLEVEL= 
env PREVLEVEL= 
 
task 
 
script 
    # Check for default runlevel in /etc/inittab 
    if [ -r /etc/inittab ] 
    then 
        eval "$(sed -nre 's/^[^#][^:]*:([0-6sS]):initdefault:.*/DEFAULT_RUNLEVEL="\1";/p' /etc/inittab || true)" 
    fi 
 
    # Check kernel command-line for typical arguments 
    for ARG in $(cat /proc/cmdline) 
    do 
        case "${ARG}" in 
        -b|emergency) 
            # Emergency shell 
            [ -n "${FROM_SINGLE_USER_MODE}" ] || sulogin 
            ;; 
        [0123456sS]) 
            # Override runlevel 
            DEFAULT_RUNLEVEL="${ARG}" 
            ;; 
        -s|single) 
            # Single user mode 
            [ -n "${FROM_SINGLE_USER_MODE}" ] || DEFAULT_RUNLEVEL=S 
            ;; 
        esac 
    done 
    # Run the system initialisation scripts 
    [ -n "${FROM_SINGLE_USER_MODE}" ] || /etc/init.d/rcS 
 
    # Switch into the default runlevel 
    telinit "${DEFAULT_RUNLEVEL}" 
end script 

看到env DEFAULT_RUNLEVEL=3這一行沒,對了,這裡就是系統預設的運行等級。我們可以通過修改這裡的值來達到修改運行等級效果。
 
查看系統的運行等級:runlevel
切換系統運行等級:init  0~6
===============================================================
我直接將env DEFAULT_RUNLEVEL設定為1,也就是單一使用者模式進入後,系統竟然在準備進入選擇使用者的介面卡住不動了。解決方案就是系統重新啟動,長按shirt鍵進入引導載入程式選擇介面,選擇第一個啟動菜單,按e鍵,然後根據提示好像按ctrl+X使用root進入純命令模式。將之前修改的值改回到原來的值,重啟,ok!!
 
修改引導載入程式預設是修改/boot/grub/menu.lst檔案,但是ubuntu9.10沒有這個檔案,而是修改/boot/grub/grub.cfg這個檔案。。。

摘自:Java, go's

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.