You are not logged in.

#1 2009-08-05 15:06:09

mrpringle
Member
Registered: 2009-07-11
Posts: 74

Speeding up boot time of network services.

Hi,
I'm trying to speed up my boot time. It seems to be slowed down a fair bit by netcfg using dhcp to assign an IP address to my wireless adapter.
Is there a way this can be put to the background so other services can start while netcfg is trying to bring the interface online?

My setup is as follows.
netcfg is configured with a wireless profile and a wired profile.
The wired profile is disabled in my rc.conf, the wireless profile is enabled.
net-profiles is in my daemons list.
wpa_supplicant is used on my wireless adapter.

Should I be using something besides netcfg. I would really like to speed up my boot time.

Offline

#2 2009-08-05 15:33:09

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Speeding up boot time of network services.

Why don't you just put a '@' before net-profiles in your DAEMONS list? (That's the standard way to background a daemon.) This assumes that nothing coming later in the list is going to be relying on netcfg to have finished bringing the network up (or can fail gracefully when network is still unavailable).

Offline

#3 2009-08-05 23:55:28

mrpringle
Member
Registered: 2009-07-11
Posts: 74

Re: Speeding up boot time of network services.

Profjim wrote:

Why don't you just put a '@' before net-profiles in your DAEMONS list? (That's the standard way to background a daemon.) This assumes that nothing coming later in the list is going to be relying on netcfg to have finished bringing the network up (or can fail gracefully when network is still unavailable).

Thanks. I wasn't aware of this.

This has reduced my boot time by about 10 seconds.

Offline

#4 2009-08-06 00:37:05

mrpringle
Member
Registered: 2009-07-11
Posts: 74

Re: Speeding up boot time of network services.

Actually. Now that I've got that problem solved it leads me to another issue.

If wpa_supplicant can't find an association netcfg gives up and the wireless adapter goes offline.
I would like netcfg to keep searching for an association if this is possible.

I've got two profiles set up in wpa_supplicant. One for home and another for university. The university profile requires a certificate to authenticate so wpa_supplicant has to be used.

I think net-auto might be what I need, but I've added (to my rc.conf):
AUTO_NETWORKS=(auto-wireless wlan0)

and added net-auto to the daemons list, but it doesn't seem to work.

If i type netcfg-auto-wireless wlan0 in the command prompt it says
No profiles matched the found networks.

What am I doing wrong?

Offline

#5 2009-08-06 00:55:23

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Speeding up boot time of network services.

You've done the right thing with AUTO_NETWORKS and net-auto. Now when netcfg-auto-wireless runs, it has to do a scan and see what essids show up, and it will try to load the first profile it finds that matches. I'm not sure whether this still works in the current release of netcfg. (In fact there are several versions which might be called "the current release.") I've contributed some to the next version of netcfg but iphitus hasn't yet merged in my patches. There should be a new beta release soon.

Let's assume that you're not running against some bug in netcfg right now, that it's just a question of getting your configurations right. Things for you to check: are you able to "netcfg profile1" and "netcfg profile2" successfully from the command line? If so, then the problem is with netcfg-auto-wireless's attempt to scan for available networks. Does "ifconfig wlan0 up; iwconfig wlan0 mode managed; iwlist wlan0 scan" produce results for you? (Replace your network interface for "wlan0.") Do the ESSIDs of your profile1 and profile2 appear in that scan output?

Offline

#6 2009-08-06 01:07:30

mrpringle
Member
Registered: 2009-07-11
Posts: 74

Re: Speeding up boot time of network services.

"netcfg wireless" and "netcfg wired" work.

I think the problem is I don't have an essid specified in my wireless profile. Here is /etc/network.d/wireless

CONNECTION="wireless"
DESCRIPTION="A wpa_supplicant configuration based wireless connection"
INTERFACE="wlan0"
SECURITY="wpa-config"
WPA_CONF="/etc/wpa_supplicant/wpa_supplicant.conf"
IP="dhcp"

my wpa_supplicant.conf file has two profiles specified. One is WPA2-PSK, the other is WPA-EAP and requires a cerficiate.

Does this mean netcfg isn't suitable for my situation?

Offline

#7 2009-08-06 01:22:41

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Speeding up boot time of network services.

1. I think it won't harm the manual use of the profile at all to add an ESSID to the profile. That should enable netcfg-auto-wireless to get to the point of deciding, OK, this is the profile to try to load. (I'm just going by memory of the code here, so I could be wrong. But I think I'm right.)

2. netcfg as it's currently written doesn't parse and has no understanding of the internals of your own wpa_supplicant config files. It just passes them to wpa_supplicant. So the fact that you have two networks defined inside that config file will be invisible to netcfg.

3. However, I think wpa_supplicant knows how to auto-detect which network to connect to, at least if the config file is set up properly. I used to do this on Xubuntu. (I _think_ it was wpa_supplicant that was behaving intelligently here, not the other wireless tools Debian-based systems used on top of wpa_supplicant.) So you should be able to just tell netcfg manually to load the profile as you've presented it, and wpa_supplicant should figure out which wireless network is available and it should connect to. Is this not working?

Because of 1. and 2., there's no advantage you can gain from using netcfg-auto-wireless. If you can get what I describe in 3 working, then just use net-profile to try to load your single wireless profile. (Or make your own daemon which is based on net-profile and which tries to load wired if it can else falls back to wireless. Or whatever you want. If you can write shell scripts, these daemons aren't very complex.)

Last edited by Profjim (2009-08-06 01:26:56)

Offline

#8 2009-08-06 01:31:57

mrpringle
Member
Registered: 2009-07-11
Posts: 74

Re: Speeding up boot time of network services.

wpa_supplicant is able to automatically detect the wireless connection to use.

If i specify the essid in my wireless file it works, but since my wpa_supplicant.conf file can connect to two different SSIDs I would need to set up two wireless config files pointing to the same wpa supplicant config file - I tried putting two ESSID's separated by a space in my wireless config file but it didn't like it.

I may as well use wpa_supplicant for my university connection and netcfg for my home connection which just uses PSK. THen I can set up two wireless profile and net-auto should work.

Maybe ifplugd would be a better solution though. I'm not really sure.

Offline

#9 2009-08-06 01:58:46

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Speeding up boot time of network services.

Yeah, you could write two profiles with different ESSIDs in them, pointing to a single wpa_supplicant.conf file, but given you situation, what does that gain you? Why use netcfg-auto-wireless in that case to decide whether to load one of those profiles or fail, as opposed to just having the single wireless profile and trying to load it directly with net-profile.

Ifplugd's main purpose is to listen for an ethernet cable being plugged in/removed, and run a script (e.g. a script that tells netcfg to load/unload a profile) when it sees that happen. This doesn't compete with netcfg but complements it. (You could have the ifplugd script do whatever you want; you don't HAVE TO use netcfg.)

You could also opt to use wpa_supplicant.conf manually in some situations, and netcfg (on top of wpa_supplicant) in other situations. No harm in doing so. I just don't see what in your situation motivates that. What does it appear to you that you're able to do by avoiding netcfg, that you wouldn't be able to do using netcfg? As I said, you can have netcfg load your wpa_supplicant.conf-based scripts even if there's further complexity encoded in the wpa_supplicant.conf. Netcfg just won't know about it.

One change you might consider is to break your current wpa_supplicant.conf file into two files (you can name them whatever you want, just specify the names in your netcfg profiles). Then you could stick an ESSID into the associated netcfg profile, and then the net-auto functionality might work for you.

If you want some more intelligent network decisions (like, use wired if available else load whichever of these two wifi profiles you can), you'll have to write some script that incorporates that decision-making and farms out the basic tasks to netcfg.

Offline

#10 2009-08-06 02:27:46

mrpringle
Member
Registered: 2009-07-11
Posts: 74

Re: Speeding up boot time of network services.

Profjim wrote:

Why use netcfg-auto-wireless in that case to decide whether to load one of those profiles or fail, as opposed to just having the single wireless profile and trying to load it directly with net-profile.

This is what I had originally, but the main issue is netcfg seems to give up if it can't find an association. I would like it to keep trying.
I know I keep bringing up what gentoo does :-), but in gentoo wpa_supplicant would continuously scan for an essid it could try and connect to.

This may not be so much of a problem though if I restart the  net-profiles script when the laptop wakes up from sleep or standby mode. I might just leave the netcfg configuration as is, unless it causes any problems.

Thanks for your help

Offline

#11 2009-08-06 10:54:21

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Speeding up boot time of network services.

mrpringle wrote:

in gentoo wpa_supplicant would continuously scan for an essid it could try and connect to.

I see. You'd have to use wpa_supplicant manually to do that; this isn't something netcfg does (not even netcfg-auto-wireless: that also gives up if it can't find an association when it's run),

Offline

#12 2009-08-06 12:19:12

ckristi
Member
From: Bucharest, Romania
Registered: 2006-11-21
Posts: 225

Re: Speeding up boot time of network services.

Why don't you try using Wicd? It's well documented here: http://wiki.archlinux.org/index.php/Wicd. It has a nice GUI, it will run as a daemon substituting the network/netcfg daemons. It also brings back your interface up when your laptop wakes from suspend state.


In love I believe and in Linux I trust

Offline

Board footer

Powered by FluxBB