ubuntu 11.04 改變預設運行等級

來源:互聯網
上載者:User

轉載:http://forum.ubuntu.org.cn/viewtopic.php?t=339148


想將ubunut 11.04 的預設運行層級改為命令列模式,按照下面的方法來做,

"Ubuntu開機啟動到字元介面


預設安裝的Ubuntu Linux會直接到圖形介面。不過很多時候我並不需要在圖形介面上做事,字元介面的命令列就足夠了。想起在RedHat裡可以通過修改/etc /inittab來把預設運行等級(run level)從5改到3來實現,不幸的是Ubuntu中並沒有這個檔案。剛剛在Google上找了一遍,發現Ubuntu也是可以相容inittab的, 不過需要自己手工建一個罷了。


Ubuntu安裝後預設的run level為2,這個可以用runlevel命令查看。因為runlevel=2,所以在啟動過程中自動執行/etc/rc2.d/目錄下的以S開頭的腳 本。Ubuntu之所以能直接啟動到圖形介面,是由於運行gdm所致。所以,只要把gdm的啟動指令碼禁用就可以了,方法就是把檔案名稱的第一個字母S改成 K:


cd /etc/rc2.d

sudo mv S30gdm K30gdm

這是一種方法,而且非常簡單。但我更習慣於設定一個新的run level,讓那個新的run level作為啟動到字元介面。這樣便於管理。Ubuntu沒有/etc/inittab檔案,只好建立一個了,內容只有一行:


id:3:initdefault:

這樣下次啟動時就會自動運行/etc/rc3.d/目錄下的指令碼,而不再是/etc/rc2.d/中的。所以接下來要進入到/etc/rc3.d/中,看看gdm的啟動指令檔名:


ls -l *gdm

如果是以S打頭的,把檔案名稱改成以K打頭的就行了。"


但是,敲入 ls -l *gdm 時,提示"no such file or directory"

查看一下rc3.d裡面內容如下

root@ubuntu:/etc/rc3.d# ls -al

total 20

drwxr-xr-x 2 root root 4096 2011-07-18 15:53 .

drwxr-xr-x 130 root root 12288 2011-07-23 00:46 ..

-rw-r--r-- 1 root root 677 2011-03-29 04:10 README

lrwxrwxrwx 1 root root 20 2011-07-14 20:23 S20kerneloops -> ../init.d/kerneloops

lrwxrwxrwx 1 root root 27 2011-07-14 20:23 S20speech-dispatcher -> ../init.d/speech-dispatcher

lrwxrwxrwx 1 root root 19 2011-07-14 20:23 S25bluetooth -> ../init.d/bluetooth

lrwxrwxrwx 1 root root 23 2011-07-14 21:16 S38open-vm-tools -> ../init.d/open-vm-tools

lrwxrwxrwx 1 root root 20 2011-07-14 20:23 S50pulseaudio -> ../init.d/pulseaudio

lrwxrwxrwx 1 root root 15 2011-07-14 20:23 S50rsync -> ../init.d/rsync

lrwxrwxrwx 1 root root 15 2011-07-14 20:23 S50saned -> ../init.d/saned

lrwxrwxrwx 1 root root 19 2011-07-14 20:23 S70dns-clean -> ../init.d/dns-clean

lrwxrwxrwx 1 root root 18 2011-07-14 20:23 S70pppd-dns -> ../init.d/pppd-dns

lrwxrwxrwx 1 root root 14 2011-07-18 15:53 S75sudo -> ../init.d/sudo

lrwxrwxrwx 1 root root 24 2011-07-14 20:23 S90binfmt-support -> ../init.d/binfmt-support

lrwxrwxrwx 1 root root 22 2011-07-14 20:23 S99acpi-support -> ../init.d/acpi-support

lrwxrwxrwx 1 root root 21 2011-07-14 20:23 S99grub-common -> ../init.d/grub-common

lrwxrwxrwx 1 root root 18 2011-07-14 20:23 S99ondemand -> ../init.d/ondemand

lrwxrwxrwx 1 root root 18 2011-07-14 20:23 S99rc.local -> ../init.d/rc.local

root@ubuntu:/etc/rc3.d# cd ..

root@ubuntu:/etc# cd rc2.d

root@ubuntu:/etc/rc2.d# ls -l *gdm

ls: cannot access *gdm: No such file or directory

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.