# Selecting runlevel at boot time

## BackSeat

I've read the Gentoo init system details, but one thing that isn't made clear. If I want to bring up my system to a specific runlevel - for  example, nonetwork - what do I need to do at boot time or to the menu.lst to achieve that?

Thanks,

BS

----------

## AutoBot

Try this  :Smile: 

```

man inittab

```

----------

## BackSeat

I'm sorry, I didn't make myself clear.

I have a laptop which, when running in an office environment, I want to bring up with eth0 running DHCP. This is set in my 'default' runlevel.

However, when I'm working disconnected, I currently have to wait for the DHCPREQUEST to timeout on eth0. I do have another runlevel, 'nonetwork', which does not enable DHCP.

My question is: what can I do with grub which allow me to select whether I boot to the 'default' or 'nonetwork' runlevel?

Thanks,

BS

----------

## BackSeat

Hmmmm.... I'm now trying to run mysql, but it won't run without the network being up. I've done this sort of thing many times before, so I am sure I am just getting caught in a Gentooism. Can someone shed some  light on how to get mysql  running on a standalone machine?

Thanks,

BS

----------

## BackSeat

Well, either this topic is of no interest to anyone else, or it is too difficult to do!

Is it possible to select the runlevel at boot time that Gentoo will boot to?

----------

## AutoBot

Unless I still don't understand the question I believe you could just type:

```

init 3

```

Or whatever level you wanted in the prompt before you boot.

----------

## richajoh

Since you mentioned menu.lst I'll assume you are using grub.

Yes you can do this, quite easily actually.

When you boot up and are sitting at the grub menu, highlight your gentoo boot and hit 'e' for edit.   This will bring up the grub command line for that boot.  Highlight the line beginning with 'kernel' and hit 'e' again.   You can now edit that line.   At the end put the number of the runlevel you want, such as 3, and hit enter.  Be sure there is a space between the last statement and your '3'.

Now you are back to the editor with your new kernel line highlighted.  From here just hit 'b' for boot and off you go.

I created a new runlevel 3 that doesn't boot X (redhat style) and made 5 the default (X) in inittab.

----------

## BackSeat

Thanks for the replies; however, I already know about numeric runlevels. My question was 'how do I select at boot time to boot to the runlevel I call "nonetwork" or the one I call "fred" or whatever'?

Or can't this be done?

Thanks

----------

## richajoh

I believe you need to associate your new runlevel with one of the numbers in inittab.

I did this with mine, copied 'default' to 'nox', removed xdm from nox, and changed 3 to point to 'nox'.  Then made 5 the default.

When the kernel is done loading it hands the boot off to inittab, it needs to know about your new runlevel.

----------

## AutoBot

 *richajoh wrote:*   

> I believe you need to associate your new runlevel with one of the numbers in inittab.
> 
> I did this with mine, copied 'default' to 'nox', removed xdm from nox, and changed 3 to point to 'nox'.  Then made 5 the default.
> 
> When the kernel is done loading it hands the boot off to inittab, it needs to know about your new runlevel.

 

Such I was assuming that BackSeat had already done something similar, sorry to assume will try to be more specific next time.

----------

