Changing run-levels and recovering from run-level problem
by Selva[ Edit ] 2008-05-08 11:37:30
In Linux there are six run-levels,they are:
0 - halt
1 - Single user mode (or) recover mode (or) safe mode
2 - Multiuser without NFS
3 - Full multiuser mode-(by default boot to command mode)
4 - unused
5 - Muti-user XWindow mode -(by default boot to GUI(XWindow) mode )
6 - reboot
Changing the run-level:
By default the system will boot in run-level 5.To change the run-levle edit the file /etc/inittab.In this file go to the line which is like id:5:initdefault: (Here number 5 indicates the default run-level into which the system boots),You can the change number 5 to any run-level(0-6) you want(caution: don't use 0 or 6).
Run-level Problem:
Some times the user may change the run-level specified in /etc/inittab file(in the line id:5:initdefault:)to 0 (or) 6 ,since the run-level 0 is halt and run-level 6 is reboot,the system will restarts every time you boot or goes to halt
Recovering from run-level problem:
Step 1:Boot the system
Step 2:Press space-key when boot-screen ( a line like 'Booting into RedHat EnterPrise Linux in 5 seconds..') appers.Now You will get another boot screen with line like:
RedHat Enterprise Linux(kernel 2.6.9).Goto that Line and press: e
Step3:Now You will get another boot screen with three lines like:
root(hd0,1)
kernel /vmlinuz-2.6.9-42.EL root Lablr=/ hdc=ide-scsi
initd /initrd-2.6.9-42.EL.img
Step 4:Goto 2nd line(kernel /vmlinuz-2.6.9-42.EL root Lablr=/ hdc=ide-scsi)by using arrow key and press: e
Step 5:Now you will get line like:
grub edit>kernel /vmlinuz-2.6.9-42.EL root Lablr=/ hdc=ide-scsi
with a blinking cursor.Now enter 1 and then press: Enter key
Step 6:Now You will get another boot screen with three lines like:
root(hd0,1)
kernel /vmlinuz-2.6.9-42.EL root Lablr=/ hdc=ide-scsi 1
initd /initrd-2.6.9-42.EL.img
Step 7: Goto Second line and press: b.Now the system will boot into run-level 1
Step 8:When system enters to run-level 1 you will get command line like:
Sh-3.00#
Step 9:Now you can edit the /etc/inttab file by entering vi /etc/inttab .Change the line id:6:initdefault: to id:5:initdefault:
Step 10:Ater editing save the file and give command init 6.Now system will reboots and boots to run-level 5