You are not logged in.

#1 2012-01-07 16:45:21

aksdb
Member
Registered: 2007-10-07
Posts: 38

netcfg: set profile via kernel line

/etc/rc.d/net-profiles states, that:

# $NET env var is passed from the kernel boot line

However, even if I put "NET=<some profile>" into my kernel line, net-profiles still loads the profile specified in rc.conf instead. What's wrong here? Is $NET really passed? Where does this happen exactly?

Thanks!

Last edited by aksdb (2012-01-07 17:19:58)

Offline

#2 2012-01-07 18:56:54

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: netcfg: set profile via kernel line

What happens if you don't specify anything in rc.conf? Maybe the rc.conf setting overrides the one in your boot manager?


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#3 2012-01-07 19:32:35

aksdb
Member
Registered: 2007-10-07
Posts: 38

Re: netcfg: set profile via kernel line

net-profiles first checks for the values of $NET, then the one in rc.conf. So if $NET was set, it would/should work.

Offline

#4 2012-01-13 17:24:48

aksdb
Member
Registered: 2007-10-07
Posts: 38

Re: netcfg: set profile via kernel line

No one? *bump*

Offline

#5 2012-01-28 10:35:31

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

Re: netcfg: set profile via kernel line

I also have noticed this no longer works but can't say when it stopped as I didn't use that boot option for a while on the machine I use it on.  Years ago it was 'NET', then it changed to 'NETWORKS' but now it appears that neither work.  I haven't had time to look myself yet and see what the deal is though.


JABBER: krayon -A-T- chat.qdnx.org
E-MAIL: archlinuxforums -A-T- quadronyx.org
WEB: http://www.qdnx.org/krayon/
~o~

Offline

#6 2012-01-30 16:49:32

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

Re: netcfg: set profile via kernel line

Still haven't had time to look into this.  A work around that should work is putting something this in your rc.local:

NET=$(sed -n 's#.*NET=\([^ $]*\).*$#\1#p' /proc/cmdline)
[ ! -z "$NET" ] && netcfg2 "$NET"

Last edited by lefallen (2012-01-30 16:50:41)


JABBER: krayon -A-T- chat.qdnx.org
E-MAIL: archlinuxforums -A-T- quadronyx.org
WEB: http://www.qdnx.org/krayon/
~o~

Offline

#7 2012-01-31 16:15:54

aksdb
Member
Registered: 2007-10-07
Posts: 38

Re: netcfg: set profile via kernel line

Nice, I'll try this as soon as possible. Thank you very much!

Offline

#8 2012-01-31 18:37:15

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: netcfg: set profile via kernel line

I'm not really sure how this is supposed to work because netcfg is just a bash script... Who exactly exports NET? OTOH this whole thing is ugly. Netcfg is a userlang app -- why would you want to control it from kernel cmdline? If you need a better profile management it should be implemented in netcfg codebase.


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#9 2012-02-01 11:15:48

aksdb
Member
Registered: 2007-10-07
Posts: 38

Re: netcfg: set profile via kernel line

Leonid.I wrote:

I'm not really sure how this is supposed to work because netcfg is just a bash script... Who exactly exports NET? OTOH this whole thing is ugly. Netcfg is a userlang app -- why would you want to control it from kernel cmdline? If you need a better profile management it should be implemented in netcfg codebase.

Please take a look at your /etc/rc.conf which clearly supports the use of network profiles during boot. Since networking is setup during boot (using netcfg profiles) it also makes sense to change that behavior even on the kernel command line. If grub already shows me a menu to select which kernel (config) to boot, then why would I want another menu from netcfg asking me what network profile I need if that should be tied to the selected kernel?
Sure, it's probably not the most often used scenario, but it doesn't hurt either.

Offline

#10 2012-02-01 16:08:33

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: netcfg: set profile via kernel line

aksdb wrote:

Since networking is setup during boot (using netcfg profiles) it also makes sense to change that behavior even on the kernel command line. If grub already shows me a menu to select which kernel (config) to boot, then why would I want another menu from netcfg asking me what network profile I need if that should be tied to the selected kernel?

Grub menu and kernel boot line are not supposed to be abused by high-level apps. They are ONLY for kernel parameters.

rc.conf is used AFTER init has finished, while you are suggesting to use some of it BEFORE init even commenced. Would you start your favourite desktop widget from grub as well?

Of course, you are free to do anything you want but I wouldn't be surprised if that piece of netcfg code is removed soon (it is defunct ATM anyway). And I'm not sure what was the logic behind putting it there in the first place.

Last edited by Leonid.I (2012-02-01 16:09:04)


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#11 2012-02-01 16:14:28

aksdb
Member
Registered: 2007-10-07
Posts: 38

Re: netcfg: set profile via kernel line

Leonid.I wrote:

rc.conf is used AFTER init has finished, while you are suggesting to use some of it BEFORE init even commenced. Would you start your favourite desktop widget from grub as well?

Kinda ... thanks to runlevels I already have two grub lines where one boots to console (runlevel 3) and one to X11 (runlevel 5).

And btw. it is not a "high level app" that is supposed to "abuse" it ... it's an init script (/etc/rc.d/net-profiles).

Offline

#12 2012-04-14 11:06:36

jouke
Member
Registered: 2009-10-14
Posts: 72

Re: netcfg: set profile via kernel line

I'm guessing it stopped working after
https://projects.archlinux.org/svntogit … 1f37e396de

Note this part:

if [ -f /proc/cmdline ]; then
for cmd in $(cat /proc/cmdline); do
case $cmd in
- *=*) eval $cmd ;;
+ disablemodules=*) eval $cmd ;;
+ load_modules=off) exit ;;
esac
done

That was back in 2008. For systemd, alternatives are available. Perhaps I reinstate the behavior for initscripts fans.

Offline

#13 2012-04-14 12:46:22

aksdb
Member
Registered: 2007-10-07
Posts: 38

Re: netcfg: set profile via kernel line

2008? Damn, then my dual booting times are much longer ago than I remembered :-) Thanks for looking that up.

But "systemd" is a good idea too. I completely lost that off my radar. It's probably about time to switch from initscripts to systemd.

Thanks for tracing back that change!

Offline

Board footer

Powered by FluxBB