# How do I change the runlevel?

## static

How do I change from runlevel 5 to 3 so that X doesn't automatically start on boot?

I know it's about as easy as changing a 5 to a 3 in some file...

----------

## rommel

by editing the inittab?....atleast that how you do it in every other distro...i cant boot gentoo right now i am setting up a system for someone and dont have another monitor....but look there 'etc/inittab' you should see a line that says runelevel:5:something just nano it to a 3

----------

## dArkMaGE

well on most systems you would edit the file /etc/inittab and add a line that says something like

x1:5:respawn:/usr/path/to/[x,g,k]dm -nodaemon

which basically says that:

x1 - a label identifying the entry

5 - the runlevel to run the command in (in this case just 5)

respawn - tells the init program to spawn a new login program when someone logs out

/usr/path/to/[x,g,k]dm - and finally you want to put the name of the executable and make sure to add the -nodaemon so that init retains control of the process

unfortunately, gentoo is a little different.

in order to get things to work in gentoo i think you should then comment out (with a #) the line that says x:a:once:/etc/X11/startDM.sh

and if you want X to boot up on start change the line near the top that says

id:3:initdefault:

to say 

id:5:initdefault:

finally, save the file and run rc-update del xdm default

of course, this will break gentoo's way of doing things and is kinda messy... but it should let you telinit 3 to get to a runlevel without X and telinit 5 to get back to normal X

just a warning, i havent tried this, its just coming off the top of my head so i know theres a better/cleaner way of doing things...

anyhow, good luck

----------

## Guest

huh...i always just changed the 5 to a 3....lol

its the line right after

#Default runlevel

id:3:initdefault:

----------

## Guest

You should check out the init system doc

http://www.gentoo.org/~azarah/rc-scripts.html.

This explains how gentoo handles run levels.

To stop X from starting up, you just need to remove xdm from the 'default' run level:

```
# rc-update del xdm default
```

To put it back:

```
# rc-update add xdm default
```

----------

## static

wow. thanks guys. Do you guys use xdm or kdm or gdm? I'll be using fluxbox and kde3.

----------

## pr0vidence

Text mode for me   :Very Happy: 

----------

## dArkMaGE

well since youre already going to take the time to install kde you might as well use kde's manager kdm.  otherwise id use gdm since it can be installed (for the most part) seperately from gnome

----------

## static

and kdm will work with fluxbox, too? is kdm the one that is handled by "startx"? I don't know anything in this particular area...

----------

## Guest

i boot into run level 3...so text mode then i will start kdm if i want to start kde3...i like that best when emerging i do it from 3 and alot of file stuff i do from 3 also

----------

## dArkMaGE

yes kdm does work with fluxbox (and any other wm for that matter) however unless fluxbox's .ebuild is really smart you have to go into the kde control panel and set it up manually.

if im reading gentoo's files correctly all i think you have to do is add a new session with the same name as the binary that gets called to start up fluxbox (perhaps its just 'fluxbox')

----------

## Jeevz

 *dArkMaGE wrote:*   

> if im reading gentoo's files correctly all i think you have to do is add a new session with the same name as the binary that gets called to start up fluxbox (perhaps its just 'fluxbox')

 

Yup, it is fluxbox.

----------

