Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
boot into different runlevels
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9527
Location: beyond the rim

PostPosted: Sun Apr 27, 2003 1:33 am    Post subject: boot into different runlevels Reply with quote

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:

  1. Create your different runlevels (I have default and uni) with the desired services
  2. 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

  3. Change the line l4:4:wait:/sbin/rc default to l4:4:wait:/sbin/rc <your new runlevel>
  4. 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
  5. repeat the previous two steps if you need more than two different runlevels (but use numbers 5 or 6, not 4)
  6. 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 8) (I was actually searching there for something completely different :roll: )
Back to top
View user's profile Send private message
optilude
Apprentice
Apprentice


Joined: 29 May 2002
Posts: 248
Location: England

PostPosted: Tue Apr 29, 2003 6:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
smokeslikeapoet
Tux's lil' helper
Tux's lil' helper


Joined: 03 Apr 2003
Posts: 96
Location: Cordova, TN USA

PostPosted: Thu May 08, 2003 7:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9527
Location: beyond the rim

PostPosted: Thu May 08, 2003 4:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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