# [solved] wpa_supplicant in gentoo's way

## pzhang

DO NOT HAVE MULTIPLE MODULES SETTINGS IN /etc/conf.d/net, MEGER THEM TOGETHER.

Hi folks,

I have trouble using wpa_supplicant in gentoo. I could do "wpa_supplicant -Dwext -ieth1 -c /etc/wpa_supplicant.conf -B" and then "dhclient" to connect to internet. But when I do it in gentoo'way, I had trouble.

/etc/init.d/net.eth1 start gave me

/etc/init.d/net.eth1 restart

 * Service net.eth1 starting

 * Starting eth1

 *   Loading networking modules for eth1

 *     modules: apipa arping bridge ccwgroup tuntap macchanger macnet rename ifplugd iwconfig essidnet iptunnel iproute2 pppd system dhclient ip6to4

 *       ifplugd provides plug

 *       iwconfig provides wireless

 *       iproute2 provides interface

 *       pppd provides ppp

 *       dhclient provides dhcp

 *   Configuring eth1 for MAC address 00:13:CE:37:87:78 ...               [ ok ] *   ifplugd does not work on wireless interfaces

 *   Configuring wireless network for eth1

 *   Scanning for access points

 *     Found "<hidden>" at 00:14:6C:17:08:7E (managed, encrypted)

 *     Found "<hidden>" at 00:12:17:C5:79:28 (managed, encrypted)

 *   WEP key is not set for "<hidden>" - not connecting

 *   Couldn't associate with any access points on eth1

 *   Failed to configure wireless for eth1                                [ !! ] * ERROR:  net.eth1 failed to start

so it uses iwconfig over wpa_supplicant although my /etc/conf.d/net has

modules=( "wpa_supplicant" )

wpa_supplicant_eth1="-Dwext"

And if I add modules_force_eth1=( "wpa_supplicant" )

I would get 

/etc/init.d/net.eth1 restart

 * Caching service dependencies ...                                       [ ok ] * Service net.eth1 starting

 * Starting eth1

 *   WARNING: You are forcing modules!

 *   Do not complain or file bugs if things start breaking

 *   Loading networking modules for eth1

 *     modules: wpa_supplicant

 *       wpa_supplicant: missing required function "interface_exists"

 * ERROR:  net.eth1 failed to start

I don't have a clue how to fix it. Does somebody tell me how to debug it?

baselayout-1.12.4-r2

ipw2200-1.1.3

ipw2200-firmware-3.0

wpa_supplicant-0.5.4

wireless-tools-28Last edited by pzhang on Mon Aug 14, 2006 11:43 pm; edited 1 time in total

----------

## UberLord

Sounds like someone forgot to etc-update or net.eth1 isn't a symlink to net.lo

----------

## pzhang

Those seems fine. Any other causes? I can provide more info if you tell me what you need. It works great if I use WEP instead. Thank you for the great script!

cfg-update -l

No (._cfg????_*) files found...

ls -l /etc/init.d/net.eth1

lrwxrwxrwx 1 root root 6 2005-09-26 22:58 /etc/init.d/net.eth1 -> net.lo

 *UberLord wrote:*   

> Sounds like someone forgot to etc-update or net.eth1 isn't a symlink to net.lo

 

----------

## UberLord

Post the output of this

sed -e 's/#.*//;/^\s*$/d'

Sanitise any keys or mac addresses if you must.

----------

## pzhang

First of all, I had WPA2-PSK AES enabled in the router and essid broadcast disabled. I had re-emerged net-wireless/wireless-tools, net-wireless/wpa_supplicant, and sys-apps/net-tools.

Thanks!

/etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

eapol_version=1

ap_scan=2

fast_reauth=1

network={

        ssid="*****"

        scan_ssid=1

        priority=5

        proto=RSN

        key_mgmt=WPA-PSK

        auth_alg=OPEN

        pairwise=CCMP

        group=CCMP

        psk="********"

}

/etc/conf.d/net

modules=( "wpa_supplicant" )

wpa_supplicant_eth1="-Dwext"

modules=( "dhclient" )

config_eth0=( "dhcp" )

modules_force_eth1=( "wpa_supplicant" )

nothing in /etc/conf.d/wireless

emerge --info

Portage 2.1-r2 (default-linux/x86/2006.0, gcc-3.4.6, glibc-2.3.6-r4, 2.6.15-susp end2-r6 i686)

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

System uname: 2.6.15-suspend2-r6 i686 Intel(R) Pentium(R) M processor 2.00GHz

Gentoo Base System version 1.12.4

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

ccache version 2.3 [enabled]

app-admin/eselect-compiler: [Not Present]

dev-lang/python:     2.3.5-r2, 2.4.3-r1

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-r2

sys-devel/binutils:  2.16.1-r3

sys-devel/gcc-config: 1.3.13-r3

sys-devel/libtool:   1.5.22

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/NX/etc /usr/NX/home /usr/kde/3.5/env /usr/kde/3.5/shar e/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /usr/share/t exmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic /config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/"

CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/splash /etc/ terminfo"

CXXFLAGS="-O2 -mcpu=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig ccache distcc distlocks fixpackages metadata-transfer nostr ip sandbox sfperms strict"

GENTOO_MIRRORS="http://csociety-ftp.ecn.purdue.edu/pub/gentoo/ http://gentoo.che m.wisc.edu/gentoo/ http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/ distributions/gentoo"

LANG="en_US.utf8"

LINGUAS="en zh_CN zh_TW"

MAKEOPTS="-j4"

PKGDIR="/usr/portage/packages"

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

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage /usr/portage/local/layman/gentoo-de /usr/por tage/local/layman/portage-xgl"

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

USE="x86 X Xaw3d aac acl acpi alsa apache2 apm arts atlas audiofile avi bash-com pletion berkdb bitmap-fonts bluetooth bzip2 cdr cjk cli crypt cups curl dba dbus  dga dlloader dri dvd dvdr eds emacs emboss encode esd exif expat fbcon fftw fla c foomaticdb fortran gcj gd gdbm gif ginac glut gmp gnome gnutls gphoto2 gpm gst reamer gtk gtk2 gtkhtml guile hal idn ieee1394 imagemagick imap imlib ipv6 isdnl og jack java javascript jpeg kde kerberos lcms ldap leim libg++ libwww lirc logr otate mad maildir mikmod mime mmx mng motif mozilla mp3 mpeg mule mysql nas ncur ses nls nptl nsplugin ofx ogg openal opengl oss pam pcmcia pcre pda pdf pdflib p erl php pic png posix ppds pppd python qt3 qt4 quicktime readline reflection sam ba sasl scanner sdl session sndfile spell spl sse ssl svg tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts udev unicode usb vcd vorbis wifi win32codecs  wmf xine xml xml2 xmms xorg xosd xprint xv xvid zlib elibc_glibc input_devices_ keyboard input_devices_mouse input_devices_synaptics kernel_linux linguas_en lin guas_zh_CN linguas_zh_TW userland_GNU video_cards_radeon video_cards_fbdev video _cards_fglrx video_cards_nv video_cards_nvidia video_cards_vesa video_cards_vga"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, PORTAGE_RSY NC_EXTRA_OPTS

----------

## UberLord

 *pzhang wrote:*   

> 
> 
> /etc/conf.d/net
> 
> modules=( "wpa_supplicant" )
> ...

 

Ding, we have a winner!

You've specified module= twice and the last one always wins. What you want todo is this

modules=( "wpa_supplicant" "dhclient" )

or this

modules=( "dhclient" )

modules_eth1=( "wpa_supplicant" )

----------

## pzhang

That solves the problem! Thank you!

I just followed /etc/conf.d/net.example, and changed the settings accordingly. Since modules occurs in a couple of place, I thought you would merge them together. Anyway, it may be good to put this somewhere in the net.example to remind somebody like me to condense the settings together. Thanks again!

----------

## UberLord

 *pzhang wrote:*   

> Since modules occurs in a couple of place, I thought you would merge them together.

 

shell limitation unfortunately

 *Quote:*   

> Anyway, it may be good to put this somewhere in the net.example to remind somebody like me to condense the settings together. Thanks again!

 

Maybe the example on line 23 isn't clear or high enough then.

----------

## pzhang

I don't know much about shell programming, so I made that mistake. At least for me, that description (from line 23) does not rule out the possibility that we can specify multiple "modules" in the file. And when I read later part of file and uncommented lines useful for me, I ended up my old config file.

----------

## pzhang

Can we do something similar to export ENV="$ENV:new_env" here when we meet the second "modules"? Just a thought.

----------

## UberLord

Not really as all the do is a source /etc/conf.d/${SVCNAME}

You could do this in the config file though

modules=( "${modules[@]}" "another module" )

----------

