You are not logged in.

#1 2008-03-26 17:35:51

supermighty
Member
Registered: 2005-04-18
Posts: 5

Profile selection at boot

Is there a way to specify specific config files for Arch at boot time. I would like to create different grub entries depending on where my laptop is at. Ie: home, coffee shop(open wifi), work (wpa closed wifi) etc... Not only would I like to select different network profiles at boot I would also like to have each of these different grub entries load a different set of modules. Such as not loading my wifi card drivers or daemon when I boot using the home profile, and not loading my ethernet driver when I'm on a wireless profile.

Thanks in advance.

Offline

#2 2008-03-27 00:05:10

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: Profile selection at boot

Actually I don't think it's worth it as you have to choose at boot instead of when the system is running, ie there are no advantages, but if you want to try, you might google for runlevels
http://www.linux.com/feature/114107
http://www.linfo.org/runlevel_def.html
http://www.redhat.com/docs/manuals/linu … -init.html
http://wiki.archlinux.org/index.php/Adding_Runlevels

Offline

#3 2008-03-27 00:24:27

supermighty
Member
Registered: 2005-04-18
Posts: 5

Re: Profile selection at boot

I guess what I'm looking for is something similar to gentoo's softlevels. You can have an unlimited number of named runlevels that basically run system configuration commands after the sysinit. I can think of five different, at boot, runlevels I would like to be able to select. For my laptop needs at boot would be the most appropriate time to select the system configuration, because once I boot I don't change my configuration. If things did change I could always run a script to adjust my settings after boot, or do it manually, but I haven't yet had the need for that.

I'm guessing that because there is nothing I have found in the wiki, and through basic googling, that Arch doesn't support this?


Thanks for the links btw.

Offline

#4 2008-03-27 00:29:04

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: Profile selection at boot

supermighty wrote:

I would like to create different grub entries depending on where my laptop is

This has been deprecated (and is actually an older version of this wiki article) but may still work. You still need netcfg2 installed I believe.
you can pass a NET= value on the kernel boot line, telling netcfg which profile you wish to start with

I'm not sure you can load specific modules using grub though.


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#5 2008-03-27 00:50:51

supermighty
Member
Registered: 2005-04-18
Posts: 5

Re: Profile selection at boot

Thanks I'll try NET= out.

Does anyone else do dynamic loading of modules based on your laptops location?

Offline

#6 2008-03-27 10:20:00

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: Profile selection at boot

supermighty wrote:

I guess what I'm looking for is something similar to gentoo's softlevels. You can have an unlimited number of named runlevels that basically run system configuration commands after the sysinit.

But afaik you can have only 4 softlevels mapped to init runlevels to choose from at boot. I'm not familiar enough with gentoo though.

I can think of five different, at boot, runlevels I would like to be able to select. For my laptop needs at boot would be the most appropriate time to select the system configuration, because once I boot I don't change my configuration. If things did change I could always run a script to adjust my settings after boot, or do it manually, but I haven't yet had the need for that.

I believe you can manage to have 3 more runlevels editing /etc/inittab

my:789:wait:/my/bootscript
x2:789:respawn:/your/login/manager

you can base your new bootscript on rc.multi: you can change the DAEMONS variable name to DAEMONS{7,8,9} (like it's suggested in the archwiki) and so on, but it might be a pain to mantain, even if init scripts aren't updated often.


I'm guessing that because there is nothing I have found in the wiki, and through basic googling, that Arch doesn't support this?

Not out of the box, but it doesn't take much effort.

Offline

#7 2008-03-27 11:22:20

supermighty
Member
Registered: 2005-04-18
Posts: 5

Re: Profile selection at boot

carlocci wrote:

But afaik you can have only 4 softlevels mapped to init runlevels to choose from at boot. I'm not familiar enough with gentoo though.

In gentoo softlevel scripts live at /etc/runlevel/<softlevel name>, they are just directories with sym links to init.d/.  To use one you add softlevel=<name of softlevel directory> to the end of your grub kernel line. It works like what dyscoria was suggesting with the NET= and netcfg2. The softlevels themselves are not linked to init runlevels. They are just scripts that are run after a normal N3 boot.

The thing I like about softlevels is that they are simple. Just create a directory and drop in some sym links. I've not much experience using Arch's rc style boot. I'll look into adjusting it to support something like softlevels. I wanted to ask first in case I was missing something obvious. big_smile

Offline

#8 2008-03-27 13:53:47

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: Profile selection at boot

supermighty wrote:
carlocci wrote:

But afaik you can have only 4 softlevels mapped to init runlevels to choose from at boot. I'm not familiar enough with gentoo though.

In gentoo softlevel scripts live at /etc/runlevel/<softlevel name>, they are just directories with sym links to init.d/.  To use one you add softlevel=<name of softlevel directory> to the end of your grub kernel line. It works like what dyscoria was suggesting with the NET= and netcfg2. The softlevels themselves are not linked to init runlevels. They are just scripts that are run after a normal N3 boot.

thanks for your explanation, now it's clear.

The thing I like about softlevels is that they are simple. Just create a directory and drop in some sym links. I've not much experience using Arch's rc style boot. I'll look into adjusting it to support something like softlevels. I wanted to ask first in case I was missing something obvious. big_smile

I think it should be easy to write a script to parse /proc/cmdline, or maybe you could adapt gentoo rc script directly: we steal some guides and wikis of theirs anyway smile

Offline

#9 2008-05-29 06:17:31

lefallen
Member
From: Melbourne, Australia
Registered: 2006-07-06
Posts: 36
Website

Re: Profile selection at boot

Sorry for bringing this thread back to life but I noticed that appending this to your kernel line in grub seems to work:
  NETWORKS=<net_profile_name>
eg:

kernel /boot/vmlinuz26 root=/dev/sda4 ro NETWORKS=HomeWired

With the older netcfg, it USED to be NET= but I tried this instead and it appears to work.  Hope this helps smile

Last edited by lefallen (2008-05-29 06:18:39)


JABBER: lefallen -A-T- jabber.quadronyx.com.au
E-MAIL: archlinuxforums -A-T- quadronyx.org
BLOG: http://www.quadronyx.com.au/blogs/fallen
~o~

Offline

#10 2008-06-22 23:02:03

ShogunPanda
Member
Registered: 2008-06-22
Posts: 4

Re: Profile selection at boot

Hi guys!
If you're still interested, I wrote a patch to add runlevel support in Arch.
Check it out: http://bbs.archlinux.org/viewtopic.php? … 89#p384789


Greetins by the Shogun.
Have fun and enjoy your life!

Offline

Board footer

Powered by FluxBB