Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
More runlevels?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
halosfan
n00b
n00b


Joined: 02 Jun 2003
Posts: 4

PostPosted: Fri Jun 20, 2003 10:54 pm    Post subject: More runlevels? Reply with quote

Gentoo Linux rc-script guide claims that
Quote:
Because runlevels are not statically mapped to those of init, there can be many more runlevels than the number that init support.


What I want to achieve is the ability to choose from a number of options at the bootloader prompt and, depending on the choice, run a set of services. I believe I understand how I do this if I only want to be able to choose from four or less options: then I should create runlevels "level1", "level2", "level3", "level4" and map init's runlevel numbers 2 through 5 to those newly created runlevels in /etc/inittab, something like this:

Code:

l2:2:wait:/sbin/rc level1
l3:3:wait:/sbin/rc level2
l4:4:wait:/sbin/rc level3
l5:5:wait:/sbin/rc level4


Then, passing 2 through 5 to the kernel from the bootloader would result in the init being called with the corresponding parameter, and the services defined in the corresponding runlevel being started.

Now, what if I want to have more than four options at the bootloader prompt?

Can I achieve this by tweaking the runlevel settings somehow? Or is there another way? Or am I basically out of luck?
Back to top
View user's profile Send private message
bverheg
n00b
n00b


Joined: 01 Sep 2002
Posts: 39
Location: Vlaanderen

PostPosted: Sat Jun 21, 2003 7:06 am    Post subject: Reply with quote

Though this is not mentioned in the man page, the current init program already supports the extra runlevels 7-9.

If this is not enough for you, you can also use the following method:

Pass the option information as some extra parameter to the kernel (make sure not to use an existing parameter name). Then after booting you can read this parameter information from /proc/cmdline, probably in some init script, and have your system configured accordingly.

If you have different boot options that will start nearly all the same services, but only have some minor configuration differences, the latter method might be the preferable one, even if you have spare runlevels left in init.
It eliminates the need to create (and maintain) an extra runlevel directory.
Back to top
View user's profile Send private message
mona-
n00b
n00b


Joined: 18 Dec 2002
Posts: 40

PostPosted: Sat Jun 21, 2003 8:23 am    Post subject: Re: More runlevels? Reply with quote

halosfan wrote:
What I want to achieve is the ability to choose from a number of options at the bootloader prompt


If your bootloader = grub,
set the parameter at /boot/grub/menu.lst (or grub.conf).
like that
Quote:
title=Gentoo linux-2.4.2# (runlevel 2)
root (hd#,#)
kernel /bzImage root=/dev/hda# vga=# init 2

title=Gentoo linux-2.4.2# (runlevel 3)
root (hd#,#)
kernel /bzImage root=/dev/hda# vga=# init 3

title=Gentoo linux-2.4.2# (runlevel 4)
root (hd#,#)
kernel /bzImage root=/dev/hda# vga=# init 4
Back to top
View user's profile Send private message
halosfan
n00b
n00b


Joined: 02 Jun 2003
Posts: 4

PostPosted: Sun Jun 22, 2003 6:31 pm    Post subject: Reply with quote

bverheg: You made my day! Thanks a lot for your help. I should have probably thought about the /proc/cmdline way by myself, but... Thanks!

mona: I truly appreciate your help, but it didn't answer my question. Thanks anyway...
Back to top
View user's profile Send private message
mona-
n00b
n00b


Joined: 18 Dec 2002
Posts: 40

PostPosted: Mon Jun 23, 2003 5:02 am    Post subject: Reply with quote

halosfan

Sorry for my misunderstanding :oops:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum