PDA

View Full Version : change runlevel 5 to runlevel 3


carlainz
24th November 2006, 08:54 PM
hello

i have fedora 5 x86_64 , when i start my box , load in automatic runlevel 5 (graphic mode ), where i can change in runlevel 3 (text mode)?

Thanks :)

bob
24th November 2006, 09:05 PM
From a terminal, 'su -' to get into root, then 'gedit /etc/inittab'

rappermas
24th November 2006, 09:10 PM

Two ways:

Option #1:
Log in, open up a terminal, and type:

su
init 3


Option #2:
At the login prompt, press Ctrl-Alt-Shift-F1. Log in to the shell. Again, type:

su
init 3


You will now be in the third runlevel.

Now, if you want your computer to always boot up in runlevel 3, all you have to do is change a config file--/etc/inittab. Here's what it would look like if I wanted to start in runlevel 5:


#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#

# Default runlevel. The runlevels used by Mandriva Linux 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:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes
# of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"


# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

# Single user mode
~~:S:wait:/bin/sh


Here's what it would look like if I wanted to start in runlevel 3:

#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#

# Default runlevel. The runlevels used by Mandriva Linux 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:3:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes
# of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"


# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

# Single user mode
~~:S:wait:/bin/sh


Notice that this is the section that we are dealing with and it controls what runlevel the system starts at:

# Default runlevel. The runlevels used by Mandriva Linux 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:3:initdefault:

Obviously, you don't want to set your init default value to 0 or 6, because that would render a computer unusable--the only way that you could remedy this would be to fix it from recovery mode. By changing that id:5:initdefault: line to id:3:initdefault:, you can make your computer start up in runlevel 3 by default.

From there, you could always go to any other runlevel that you want.

bob
24th November 2006, 09:12 PM
I bow to Rappermas - took an extra 5 minutes, but that's just freakin' beautiful! :D

rappermas
24th November 2006, 09:27 PM
In any case, I strive to be more helpful than the Microsoft tech support.

carlainz
24th November 2006, 09:44 PM
hi thanks work fine !!!!

i have another question

in text mode if i want to edit the file etc/inittab i have to use vi .
witch is the key to change the 3 in 5 whit vi ?

thanks

rappermas
24th November 2006, 10:05 PM
Vi isn't exactly the most intuitive program to use for beginners. To change that 3 to a 5, hover over it, press the 'i' key on your keyboard (for insert) and delete the 3, type a 5. Then, hit a Esc a few times and type ":wq" to save and quit.

rappermas
24th November 2006, 10:08 PM
I'd recommend that you use nano, though, for editing text files, if you don't have too much experience with Vi, as it is easier to use.