View previous topic :: View next topic |
Author |
Message |
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9617 Location: beyond the rim
|
Posted: Sun Apr 27, 2003 1:33 am Post subject: boot into different runlevels |
|
|
For my notebook, I have two very different environments for work, my home environment (nfs mounted home, cable-LAN) and my environment for university (wireless-LAN, local home). Because these need different services started (e.g. I don't need pcmcia at home but at unversity) and I usually shutdown the computer before changing locations I searched for a opportunity to choose different runlevels at boot-time. And I found it:
- Create your different runlevels (I have default and uni) with the desired services
- Search in your /etc/inittab the following block
Code: | l0:0:wait:/sbin/rc shutdown
l1:1:wait:/sbin/rc single
l2:2:wait:/sbin/rc nonetwork
l3:3:wait:/sbin/rc default
l4:4:wait:/sbin/rc default
l5:5:wait:/sbin/rc default
l6:6:wait:/sbin/rc default
|
Change the line l4:4:wait:/sbin/rc default to l4:4:wait:/sbin/rc <your new runlevel>
Add a new entry to your /boot/grub/grub.conf, which is identical to your default entry and add a 4 at the end of the kernel parameter list
repeat the previous two steps if you need more than two different runlevels (but use numbers 5 or 6, not 4)
reboot
This should work similar with lilo and the append-parameter in lilo.conf. The magic is that the kernel passes every parameter it does not understand on to init.
Maybe this is widespread knowledge, but I had to look at the kernel source to get it (I was actually searching there for something completely different ) |
|
Back to top |
|
|
optilude Apprentice
Joined: 29 May 2002 Posts: 248 Location: England
|
Posted: Tue Apr 29, 2003 6:30 pm Post subject: |
|
|
To have a lot more flexibility (switching arbitrary configuration files and runlevels based on hardware profiles), as well as the addition to choose the correct runlevel automatically (presuming it is possible to detect it from the environment), try hprofile:
https://forums.gentoo.org/viewtopic.php?t=46180&highlight=hardware+profile
Obviously, hprofile is more complicated to set up, so it may not be appropriate for everyone, but it works great for me (well... I wrote it...)
Martin _________________ --
"Life is both a major and a minor key" -- Travis |
|
Back to top |
|
|
smokeslikeapoet Tux's lil' helper
Joined: 03 Apr 2003 Posts: 96 Location: Cordova, TN USA
|
Posted: Thu May 08, 2003 7:42 am Post subject: |
|
|
Great, but what if I want Runlevel 4 the same as the existing default runlevel, do I have to rc-update all of the packages I currently have in my default runlevel into my new runlevel?
What I would like to do is take my existing default and name it "gui" then remove xdm and any other xdm dependent scripts from the default runlevel.
Often when I'm doing maintaince, or testing a new kernel config. I would rather not start xdm. _________________ -SmokesLikeaPoet
Folding@Home |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9617 Location: beyond the rim
|
Posted: Thu May 08, 2003 4:16 pm Post subject: |
|
|
Your runlevel settings are stored in /etc/runlevels/ , just do Code: | cp /etc/runlevels/{default,gui}
rc-update del xdm default |
and repeat the second line for every service that should not run in default. |
|
Back to top |
|
|
|
|
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
|
|