# [Solved] Baselayout-2.0/OpenRC killed my Wireless?!?

## dpshak

I just did the 'world' update and upgraded to Baselayout-2.0 and kernel-2.6.25-r1 from kernel-2.6.24-r4 on my laptop.  Following 'OpenRC Migration' document, I made all the appropriate changes to my /etc/conf.d/net file, but unfortunately, (the Sun and Venus weren't properly aligned) my wireless didn't work!  :Confused: 

 Here's my current version:

```
 Network(s) setup configuration

# eth0 setup

dns_domain_lo=DPSHomeNet

config_eth0="dhcp"

# wlan0 setup for Home and Truck Access Points

modules_wlan0="iwconfig"

key_DPSHomeNet="####-####-####-####-####-####-## enc open"

preferred_aps_wlan0="DPSHomeNet schneider TA danham56"

associate_order_wlan0="forcepreferredonly"

config_wlan0="dhcp"

# Working settings - Basic Homenetwork

#essid_wlan0="DPSHomeNet"

#key_DPSHomeNet="####-####-####-####-####-####-## enc open"

#[/url]config_wlan0="dhcp"
```

This has happened periodically in the past - thus the 'Working settings' section.  That section still works, however, because I use the laptop in my semi, I need the 'Home and Truck' section to work!  The only other substantial change I made to the original configuration was to change 'forcepreferred' to 'forcepreferredonly'.  With 'forcepreferred' it would just fail stating no access point found - or words to that effect.  Under the last working version, as it was trying to associate with an access point, it would think for a minute, then give a statement 'trying to force preferred in case they are hidden'.  With the upgrade, this didn't happen so I changed to 'forcepreferredonly' and now, at least, I'm getting an error:

```
Truck bin # /etc/init.d/net.wlan0 restart

 * Caching service dependencies ...                                                                                              [ ok ]

 * Bringing down interface wlan0

 *   Stopping dhcpcd on wlan0 ...                                                                                                [ ok ]

 * Bringing up interface wlan0

 *   Configuring wireless network for wlan0

 *   Trying to force preferred in case they are hidden

/lib/rc/net/iwconfig.sh: line 519: [: 0: unary operator expected

Error for wireless request "Set ESSID" (8B1A) :

    SET failed on device wlan0 ; Invalid argument.

 *   wlan0 does not support setting SSID to ""

 *   Connecting to "" in managed mode (WEP Disabled) ...                                                                         [ !! ]

/lib/rc/net/iwconfig.sh: line 519: [: 0: unary operator expected

Error for wireless request "Set ESSID" (8B1A) :

    SET failed on device wlan0 ; Invalid argument.

 *   wlan0 does not support setting SSID to ""

 *   Connecting to "" in managed mode (WEP Disabled) ...                                                                         [ !! ]

/lib/rc/net/iwconfig.sh: line 519: [: 0: unary operator expected

Error for wireless request "Set ESSID" (8B1A) :

    SET failed on device wlan0 ; Invalid argument.

 *   wlan0 does not support setting SSID to ""

 *   Connecting to "" in managed mode (WEP Disabled) ...                                                                         [ !! ]

/lib/rc/net/iwconfig.sh: line 519: [: 0: unary operator expected

Error for wireless request "Set ESSID" (8B1A) :

    SET failed on device wlan0 ; Invalid argument.

 *   wlan0 does not support setting SSID to ""

 *   Connecting to "" in managed mode (WEP Disabled) ...                                                                         [ !! ]

 *   Failed to associate with any preferred access points on wlan0

 *   Couldn't find any access points on wlan0

 *   Failed to configure wireless for wlan0

 * ERROR: net.wlan0 failed to start
```

As you can see, there are 4 errors relating to 'Set ESSID'.  It would seem to me that the code is stepping through the 4 listed access points, but it's not parsing the string properly.  That error relates to this section of the file listed:

```
iwconfig_force_preferred()

{

   eval set -- $(_flatten_array "preferred_aps_${IFVAR}")

   [ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")

   [ $# = 0 ] && return 1

   ewarn "Trying to force preferred in case they are hidden"

   for ssid; do

      local found_AP=false i=0 e=

      while [ ${i} -le ${APS} ]; do

         eval e=\$SSID_${i}

         if [ "${e}" = "${ssid}" ]; then

            found_AP=true

            break

         fi

         i=$((${i} + 1))

      done

      if ! ${found_AP}; then

         SSID=${e}

         iwconfig_associate && return 0

      fi

   done

   ewarn "Failed to associate with any preferred access points on ${IFACE}"

   return 1

}
```

 Line 519 being the 'while [ ${i}' etc.

I was hoping with an error message that pointed to something, I would be able to figure out the proper syntax to use in the configuration file, but I'm clueless!  My programming experience is with Basic, and I have no clue what a unary operator is!  :Embarassed:    And wikipedia wasn't very helpful either! - at least in how it relates to the iwconfig.sh script!

Before I found this: Bash arrays in /etc/conf.d/net  which seems to imply that my old configuration file should still work, I tried returning to the original configuration and booting into 2.6.24-r4 where it had been working and it still didn't work.  This is what leads me to believe it is a baselayout/openrc issue.  (Yes, /bin/sh is linked to bash)  

I have tried putting quotation marks ("") around each ESSID and leaving a space between them and that failed with 'schneider: command not found'. I tried putting an apostrophe (') around each ESSID with a leading and trailing quotation mark (i.e. preferred_aps_wlan0="'DPSHomeNet' 'schneider'") that failed with the above error.  I tried putting the apostrophy around each ESSID with NO quotes and that gave the 'schneider: command not found' error.  I tried with no quotes and no apostrophes and that gave the 'schneider: command not found' error.  Hell, I even tried with JUST the ESSID DPSHomenet and it still failed!  :Shocked: 

Any ideas?Last edited by dpshak on Mon Apr 28, 2008 2:16 am; edited 1 time in total

----------

## d2_racing

Are you sure that your net.wlan0 is still created ?

----------

## dpshak

 *Quote:*   

> Are you sure that your net.wlan0 is still created ?

 

Yes, if I disable the Home and Truck section and replace it with the Working setting section, and restart net.wlan0 the wireless works fine.  It just doesn't work with the multiple (possible) access points from the Home and Truck section.

Edit: And, as you can see, the primary difference between the two configurations is that I specify an ESSID for wlan0 (in the Working settings section) instead of having it try to pick one.

----------

## aj2r

What's your wifi chipset?

----------

## dpshak

 *Quote:*   

> What's your wifi chipset?

 

My chipset is a Broadcom 43xx running through ndiswrapper.

Keep in mind that currently, if I explicitly set the ESSID (DPSHomeNet) and the key_ESSID it works fine.  It USED to scan for the access points specified in 'preferred_aps' prior to the upgrade of the kernel/baselayout/openrc.  Now it seems to be stumbling on the preferred_aps string.

----------

## UberLord

We already have this fixed

http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commitdiff;h=eb75144d8326df4a28eae7f043e1130075483216;hp=3d8e7455d9ebd5a11c1bbe00d3fc06b00adfd979

Hopefully pushing out a new version this week.

----------

## dpshak

BINGO!!!  :Very Happy: 

That solved the problem!   Thank you Uberlord (and all the rest who responded)!

----------

