# [resolved] wlan0 backgrounding problems & starting problems

## t35t0r

I recently upgraded the entire system to gcc-4.1.1 after which wlan0 and eth0 broke. I was able to fix eth0 by upgrading dhcpcd to v2. net.wlan0 is still broken.

On boot wlan0 starts but if you run ifconfig -a it shows no associated AP, IPV4, or IPV6 address. So I tried:

/etc/init.d/net.wlan0 start

 * Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...

bind(PF_UNIX): Address already in use

ctrl_iface exists and seems to be in use - cannot override it

Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore

Failed to initialize control interface '/var/run/wpa_supplicant'.

You may have another wpa_supplicant process already running or the file was

left by an unclean termination of wpa_supplicant in which case you will need

to manually remove this file before starting wpa_supplicant again.

ok

rm /var/run/wpa_supplicant/wlan0

/etc/init.d/net.wlan0 start

 * Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...                                 [ ok ]

 *   Starting wpa_cli on wlan0 ...                                        [ ok ]

 *     Backgrounding ...

This backgrounding stuff and wpa_cli didn't use to start previously, why is it doing it now?

ifconfig wlan0

wlan0     Link encap:Ethernet  HWaddr 00:90:4B:B4:CB:E5

          inet6 addr: fe80::290:4bff:feb4:cbe5/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:11 Memory:e0200000-e0202000

no IPV4 address, what's going on?

iwlist wlan0 scanning

wlan0     Failed to read scan data : Resource temporarily unavailable

how do i fix this? info:

dmesg | grep wlan0

wlan0: vendor: ''

wlan0: ndiswrapper ethernet device 00:90:4b:b4:cb:e5 using driver bcmwl5, 14E4:4320.5.conf

wlan0: encryption modes supported: WEP; TKIP with WPA; AES/CCMP with WPA

wlan0: no IPv6 routers present

emerge --info

Portage 2.1 (default-linux/x86/2006.0, gcc-4.1.1, glibc-2.3.6-r3, 2.6.16 i686)

=================================================================

System uname: 2.6.16 i686 Intel(R) Celeron(R) M processor         1300MHz

Gentoo Base System version 1.12.1

distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]

ccache version 2.3 [disabled]

dev-lang/python:     2.3.5-r2, 2.4.2

dev-python/pycrypto: 2.0.1-r5

dev-util/ccache:     2.3

dev-util/confcache:  [Not Present]

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.13, 2.59-r7

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1

sys-devel/binutils:  2.16.1-r2

sys-devel/gcc-config: 1.3.13-r2

sys-devel/libtool:   1.4.3-r4, 1.5.22

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/k de/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"

CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/terminfo"

CXXFLAGS="-O2 -march=pentium4 -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude= '/distfiles' --exclude='/local' --exclude='/packages'"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/gentopia /root/ebuilds"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="x86 X acpi alsa apache2 apm arts avahi avi berkdb bitmap-fonts cli crypt cups dbus dri eds emboss encode esd expat extrafilters flac foomaticdb fortran gd gdbm gif gnome gnutls gpm gstreamer gtk gtk2 hal ieee1394 imagemagick imlib ipv6 isdnlog java jpeg jpeg2k kde libg++ libwww mad mdnsresponder-compat mikmo d mmx mmx2 mmxext mono motif mp3 mpeg mysql ncurses nls nptl ogg openexr opengl oss pam pcmcia pcre pdf pdflib perl php png pppd python qt quicktime readline  reflection ruby samba sdl session speex spell spl sse sse2 ssl svga tcltk tcpd threads tiff truetype truetype-fonts type1-fonts udev unicode vim vorbis xml xml2 xorg xv zeroconf zlib elibc_glibc input_devices_mouse input_devices_keyboard input_devices_synaptics kernel_linux userland_GNU video_cards_i810 video_ca rds_vesa video_cards_vga"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_RSYNC_EXTRA_OPTS

/etc/conf.d/net

modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

config_eth0=( "dhcp" )

dhcpcd_eth0="-t 5"

config_wlan0=( "dhcp" )

dhcpcd_wlan0="-t 5"

any idea how to get the wlan0 working again?Last edited by t35t0r on Tue Jun 13, 2006 1:34 am; edited 1 time in total

----------

## t35t0r

iwlist wlan0 scanning works again, but I still can't associate to an AP. How do I stop the wpa_cli from starting? I think it may be causing problems.

----------

## pelut

Are you using the newest wpa_supplicant version? You can try wpa_gui so you will see what is the driver doing.

You can use rc-update del net.wlan0 default to avoid it starting at boot. However, if you mean stop only the wpa_cli and not the entire wlan0 interface I'm afraid I don't know how to do it. Anyway I think that wpa_cli must be running to connect to an AP.

Have you tried to reemerge wpa_supplicant?

I am using wpa_supplicant and ndiswrapper; when I upgraded to gcc-4.1.1 I had to reemerge wpa_supplicant and ndiswrapper to get them working again.

----------

## t35t0r

I've re-emerge wpa_supplicant-0.5.3 and ndiswrapper-1.16 when i recompiled my kernel. Kyuu mentioned that coldplug is starting up the interfaces in such a way that it is blocking wpa_supplicant I have to add:

/etc/conf.d/rc:RC_PLUG_SERVICES="!net.wlan0"

rebooting..

----------

## t35t0r

that didn't help, same problems. Rather than trying to connect via dhcpcd it just backgrounds...

----------

## t35t0r

I was able to connect to an invisible WEP (no password) AP with iwconfig:

/etc/init.d/net.wlan0 stop

/etc/init.d/net.eth0 stop

killall -9 wpa_supplicant

iwconfig wlan0 essid invisibleAP

dhcpcd wlan0

Is there a problem with wpa_supplicant. Should I downgrade?

----------

## UberLord

More like a problem with your wpa_supplicant config

You may need to experiment with the ap_scan variable and other variables as wpa_supplicant doesn't like hidden APs and has to get the driver todo more work.

You can check the status of wpa_supplicant like so

```
wpa_cli status
```

----------

## t35t0r

Hi,

I got the invisible AP (at work) working using ap_scan=2 in wpa_supplicant.conf , but I was having the same problem with a visible WPA/PSK TKIP AP (at home). I'll try the ap_scan=2 for that one also but I remember that I left that value as the default before things started breaking. If ap_scan=2 is the only setting that is operational now it will be annoying to have to change the first network block in wpa_supplicant.conf every time I use a different AP.

This sort of defeats the purpose of that file where one can store the settings for multiple AP's without having to reconfigure anything.

Thanks

----------

## redwood

Did you try changing /etc/conf.d/net as follows?

modules=( "wpa_supplicant" )

# Users of ndiswrapper add this:

#wpa_supplicant_wlan0="-Dndiswrapper"

wpa_supplicant_wlan0="-Dwext"

----------

## t35t0r

Yes, I'm using -Dwext (see first post). On my home network (visible WPA/PSK TKIP), which I'm posting from now, it seems I can only connect using ap_scan=1 (which is fine) , but the connection keeps dropping and sometimes I have to retry connection attemps (e.g. posting on this forum). It stays on for several seconds and then the connection drops for several seconds. I guess I could try downgrading the wpa_supplicant. Any other suggestions?

----------

## t35t0r

Please excuse the long post, but this a better description of what is happening (after downgrading to wpa_supplicant-0.4.8 ..no change from the most recent -0.5.3):

PING google.com (64.233.167.99) 56(84) bytes of data.

64 bytes from 64.233.167.99: icmp_seq=1 ttl=240 time=61.6 ms

64 bytes from 64.233.167.99: icmp_seq=2 ttl=240 time=59.9 ms

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

64 bytes from 64.233.167.99: icmp_seq=8 ttl=240 time=62.1 ms

64 bytes from 64.233.167.99: icmp_seq=9 ttl=240 time=61.3 ms

64 bytes from 64.233.167.99: icmp_seq=10 ttl=240 time=61.5 ms

64 bytes from 64.233.167.99: icmp_seq=11 ttl=240 time=60.5 ms

64 bytes from 64.233.167.99: icmp_seq=12 ttl=240 time=61.5 ms

64 bytes from 64.233.167.99: icmp_seq=13 ttl=240 time=61.0 ms

64 bytes from 64.233.167.99: icmp_seq=14 ttl=240 time=59.8 ms

64 bytes from 64.233.167.99: icmp_seq=15 ttl=240 time=60.1 ms

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

64 bytes from 64.233.167.99: icmp_seq=21 ttl=240 time=60.3 ms

64 bytes from 64.233.167.99: icmp_seq=22 ttl=240 time=60.9 ms

64 bytes from 64.233.167.99: icmp_seq=23 ttl=240 time=61.3 ms

64 bytes from 64.233.167.99: icmp_seq=24 ttl=240 time=61.3 ms

64 bytes from 64.233.167.99: icmp_seq=25 ttl=240 time=60.9 ms

64 bytes from 64.233.167.99: icmp_seq=26 ttl=240 time=60.6 ms

64 bytes from 64.233.167.99: icmp_seq=27 ttl=240 time=61.2 ms

64 bytes from 64.233.167.99: icmp_seq=28 ttl=240 time=59.1 ms

64 bytes from 64.233.167.99: icmp_seq=29 ttl=240 time=60.1 ms

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

The frequency of disconnects is *almost* constant.

----------

## t35t0r

 :Mad: 

1) rc-update del wpa_supplicant default

That fixed it. It's also why when after boot I would try /etc/init.d/net.wlan0 restart or start it would complain with:

bind(PF_UNIX): Address already in use

ctrl_iface exists and seems to be in use - cannot override it

Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore

Failed to initialize control interface '/var/run/wpa_supplicant'.

You may have another wpa_supplicant process already running or the file was

left by an unclean termination of wpa_supplicant in which case you will need

to manually remove this file before starting wpa_supplicant again. 

The ndiswrapper wpa_supplicant (started by net.wlan0) and the wpa_supplicant that was starting from the init scripts kept turning each other on and off , even though ps -Af | grep wpa only showed one instance of wpa_cli and wpa_supplicant. So why is the user even allowed to have wpa_supplicant as an initable process?

----------

## UberLord

Ah, the wpa_supplicant ebuild used to install an init script but doesn't anymore

----------

