# Atheros 5005G and laptop (WLAN HELP)

## Marko

I have just installed Gentoo on my laptop.

And it has Atheros 5005G wireless network card (propably integrated?)

I don't simply know how I can get my wlan working...

And I need your help to get my laptop to internet without any cables.

And please try to keep it simple cause I'm newbie with Gentoo. So really simple instructions would be nice and yes I tried to search from this forum first and I didn't find anything that helped me, but I keep looking and I really appreciate if someone can help me.

----------

## abester

Welcome to Gentoo, Marko! 

You're in luck with your laptop's wireless, Atheros is one of the few companies out there That Care. They provide full source code drivers (within FCC limitations) for their product so you don't need messy M$ drivers and fiddle with ndiswrapper. 

Its going to be somewhat complicated if you have no oppertunity to plugin your laptop to some wired network temporarily to download the necessary files. If you do have this oppertunity, plugin your laptop and go online. You can now download & install the Atheros drivers by doing (as root)

```
 emerge wireless-tools madwifi-ng madwifi-ng-tools 
```

If you don't have access to the internet, do this anyway and write down the location of the files its trying to download. If it wants to emerge a whole bunch of apps, don't bother with them you only need these three, possibly you can add --nodeps after emerge. You can then download these files somewhere else and store them in your laptop's /usr/portage/distfiles directory. 

You should now have the driver and all the tools you need to configure your wireless network. To connect you obviously need to know your network's settings, in particular its ESSID and optionally a WEP key. 

Load the drivers by 

```
modprobe ath_pci
```

If you have an external wifi card don't bother with the lights, they are off by default. 

Now its time to configure your network. Type

```
iwconfig
```

There should be a list of your network interfaces and wether or not they have wireless extensions. Atheros cards deviate somewhat and actually provide 2 NICs, wifi0 and ath0. You only need to bother with ath0 or the one that shows a lot of info. 

If you don't see the ath but only the wifi you need one additional step, type

```
wlanconfig ath0 create wlandev wifi0 wlanmode ap
```

Now all you have to do is enter the config data for your network:

```
iwconfig ath0 essid YOURESSID key YOURKEY
```

Allow some time, and you can see if you're associated with iwconfig again, it should say the mac adress of the station you're connected to. Only thing now is to request an IP, simply type

```
 dhcpcd ath0 & 
```

And you're done!

This is pretty basic and lowlevel stuff, but thats how I do it. I'm sure there are some graphical config utilities if you prefer those, but I don't use that. Anyway this way you can always connect and its great for the first time! Good luck.

----------

## Marko

wireless tools worked out fine but.

here is the problem.

```
localhost ~ # emerge madwifi-ng madwifi-ng-tools

!!! Invalid PORTDIR_OVERLAY (not a dir): '/home/wolf31o2/portage'

!!! Invalid PORTDIR_OVERLAY (not a dir): '/home/wolf31o2/portage'

Calculating dependencies... done!

>>> Emerging (1 of 3) net-wireless/madwifi-ng-tools-0.0.1443.20060207 to /

 * madwifi-ng-r1443-20060207.tar.gz MD5 ;-) ...                                                                        [ ok ] * madwifi-ng-r1443-20060207.tar.gz RMD160 ;-) ...                                                                     [ ok ] * madwifi-ng-r1443-20060207.tar.gz SHA1 ;-) ...                                                                       [ ok ] * madwifi-ng-r1443-20060207.tar.gz SHA256 ;-) ...                                                                     [ ok ] * madwifi-ng-r1443-20060207.tar.gz size ;-) ...                                                                       [ ok ] * checking ebuild checksums ;-) ...                                                                                   [ ok ] * checking auxfile checksums ;-) ...                                                                                  [ ok ] * checking miscfile checksums ;-) ...                                                                                 [ ok ] * checking madwifi-ng-r1443-20060207.tar.gz ;-) ...                                                                   [ ok ]>>> Unpacking source...

>>> Unpacking madwifi-ng-r1443-20060207.tar.gz to /var/tmp/portage/madwifi-ng-tools-0.0.1443.20060207/work

>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/madwifi-ng-tools-0.0.1443.20060207/work/madwifi-ng-r1443-20060207 ...

Makefile.inc:94: Default KERNELPATH not found, using /usr/src/linux

Makefile.inc:124: *** KERNELCONF: /usr/src/linux/.config does not exist..  Stop.

!!! ERROR: net-wireless/madwifi-ng-tools-0.0.1443.20060207 failed.

Call stack:

  ebuild.sh, line 1546:   Called dyn_compile

  ebuild.sh, line 937:   Called src_compile

  madwifi-ng-tools-0.0.1443.20060207.ebuild, line 39:   Called die

!!! emake tools failed

!!! If you need support, post the topmost build error, and the call stack if relevant.

```

and what is this, that comes allways when I emerge something

```
!!! Invalid PORTDIR_OVERLAY (not a dir): '/home/wolf31o2/portage'

```

----------

## abester

Did you install Gentoo correctly? Please post the contents of /etc/make.conf file here. 

The second part of the error message indicates you don't have a kernel installed... In order to install the drivers you'll have to install the kernel headers, typically in /usr/src/linux

----------

## Marko

 *abester wrote:*   

> Did you install Gentoo correctly?

 

I really hope so  :Very Happy: 

make.conf:

```
# These settings were set by the catalyst build script that automatically built this stage

# Please consult /etc/make.conf.example for a more detailed example

#CFLAGS="-O2 -pipe"

CFLAGS="-march=athlon64 -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CXXFLAGS="${CFLAGS}"

PORTDIR_OVERLAY="/home/wolf31o2/portage"

MAKEOPTS=""

ACCEPT_KEYWORDS=""

USE=" X alsa amd64 arts avi berkdb bitmap-fonts cairo cdr cli crypt cups dbus dlloader dri dvd dvdr eds elibc_glibc emboss encode esd fam firefox fortran gdbm gif gnome gpm gstreamer gtk gtk2 hal input_devices_evdev input_devices_keyboard input_devices_mouse ipv6 isdnlog jpeg kde kernel_linux ldap libg++ mad mikmod mp3 mpeg ncurses nls nptl nptlonly ogg opengl oss pam pcre pdflib perl png ppds pppd python qt3 qt4 quicktime readline reflection sdl session spell spl ssl tcpd truetype truetype-fonts type1-fonts udev unicode userland_GNU vorbis xml xorg xv zlib"

FEATURES=""

```

 *abester wrote:*   

> The second part of the error message indicates you don't have a kernel installed... In order to install the drivers you'll have to install the kernel headers, typically in /usr/src/linux

 

How?

----------

## abester

How did you install Gentoo? If you are new to gentoo I suggest you follow the guide. 

It also explains how you should install your kernel. I would really read this if I were you, it saves trouble. 

Your make.conf file requires some cleanup. You really don't need PORTDIR_OVERLAY for a generic Gentoo install unless you know what you're doing. Besides by the looks of it the dir its pointing to doesn't even exist.

----------

## Marko

I reinstalled the Gentoo by the book (i think) and still it does the same error.

But no this message anymore:

```
!!! Invalid PORTDIR_OVERLAY (not a dir): '/home/wolf31o2/portage' 
```

So what can be the problem...

----------

## tekknokrat

The errorr message with the portage overlay:

Do what abester said. Delete or comment the line in make.conf (# PORTDIR_OVERLAY=....) where # is the comment tag and dont forget to save your work.

Then try emerging again: emerge madwifi-ng

"madwifi-ng-tools" will dependly also be emerged. 

Seems like you also already unmasked them, didn't you?

after that the steps are 

modprobe ath_pci autocreate=none (avoid autocreating)

iwconfig wifi0 (for looking that the pseudo device wifi0 ist created)

wlanconfig ath0 create wlandev wifi0 wlanmode sta (@abester think was a typo  :Wink: )

I think in this way (without) autocreating its easier to understand.

Bringing your card up:

iwconfig ath0 essid YOURESSID [key YOURKEY]  (if you have a wep key then also the bracket part. for wpa it differs)

iwconfig ath0 (if you see the MAC ADDRESS next to Access Point your associated and can perform the next steps, else something went wrong. do an "ifconfig ath0 up" and wait at least a 30 seconds associating can take some time)

dhcpcd -d ath0 (you get an ip address automatically from your router)

or

ifconfig 192.168.0.1 netmask 0xffffff00 (for static ip)

----------

## Marko

I commented that line.

And no it doesn't work.

This is the error:

```
Unpacking source...

>>> Unpacking madwifi-ng-r1443-20060207.tar.gz to /var/tmp/portage/madwifi-ng-tools-0.0.1443.20060207/work

>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/madwifi-ng-tools-0.0.1443.20060207/work/madwifi-ng-r1443-20060207 ...

Makefile.inc:94: Default KERNELPATH not found, using /usr/src/linux

Makefile.inc:124: *** KERNELCONF: /usr/src/linux/.config does not exist..  Stop.

!!! ERROR: net-wireless/madwifi-ng-tools-0.0.1443.20060207 failed.

Call stack:

  ebuild.sh, line 1546:   Called dyn_compile

  ebuild.sh, line 937:   Called src_compile

  madwifi-ng-tools-0.0.1443.20060207.ebuild, line 39:   Called die

!!! emake tools failed

!!! If you need support, post the topmost build error, and the call stack if relevant. 
```

Now I'm updating my Gentoo and then I will try again.

----------

## Marko

Updating didn't help.

Still the same prob...

----------

## UberPinguin

To echo abester: Welcome to Gentoo.  To better guage the required verbosity/simplicity, are you new to Linux as well?

What do you see when you 

```
ls /usr/src/linux/
```

  Do you know what kernel is running?  What are the contents of /boot/ ?

Depending on what kernel you have installed (probably gentoo if you followed the guide verbatim), you will want to emerge either gentoo-sources or vanilla-sources.  Make sure the version of the *-sources matches the version that you are actually running (i.e. if you are running kernel-gentoo-2.6.17-r5 then emerge gentoo-sources-2.6.17-r5).  This will create the missing directory and symlink in /usr/src/.  The next step is to create the .config file in /usr/src/linux. I believe there is a way to derive this file from the compiled kernel but am honestly not certain.  You may need to go through and manually configure the kernel.  There are detailed documents available from Gentoo for this.

Now you should be ready to finish emerging madwifi-ng and madwifi-ng-tools.

----------

## Marko

Some update  :Very Happy: 

Now I installed those and iI have a prob with key.

```
iwconfig ath0 essid myessid key 123456788901234

gives:

Error for wireless request "Set Encode" (8B2A) :

invalid argument "12345678901234".

```

----------

## UberPinguin

Are you sure the key is correct?  The key length (in characters) is determined by the level of encryption:

5 characters = 64-bit WEP

13 characters = 128-bit WEP

16 characters = 152-bit WEP

29 characters = 256-bit WEP

The sample password you provided is 14 characters long, which would be invalid for any encryption scheme.  You should only need to specify a key if the ESSID you are connecting to uses encryption.

----------

## Marko

 *UberPinguin wrote:*   

> Are you sure the key is correct?  The key length (in characters) is determined by the level of encryption:
> 
> 5 characters = 64-bit WEP
> 
> 13 characters = 128-bit WEP
> ...

 

The key that I gave you isn't right  :Very Happy: 

The real key is 13 characters long and should be in ASCII form.

----------

## UberPinguin

 *Marko wrote:*   

> The real key is 13 characters long and should be in ASCII form.

 

Then try 

```
iwconfig ath0 essid myessid key s:123456788901234
```

You may find 

```
man iwconfig
```

 useful.

----------

## Marko

 *UberPinguin wrote:*   

> 
> 
> Then try 
> 
> ```
> ...

 

That gives me:

```
Couldn't load module wlan_wep
```

----------

## Marko

I solved that prob by doing this:

# modprobe wlan_wep

And next I will try to get ip from my router.

----------

## Marko

Ip gotted.

But when the machine boots it whines

Could not load module wlan_scan_sta

And also when it boots the wlan losts the essid and key.

And how I can get that wlan works in boot....

----------

## UberPinguin

Please provide the output of 

```
/sbin/modprobe -l | grep wlan
```

and 

```
dmesg | grep wlan_scan
```

Once we get the wlan_scan_sta module loading properly, you should have a look at wpa_supplicant. IMHO it is more flexible as far as handling multiple networks than wireless-tools.  Have a look at http://gentoo-wiki.com/HOWTO_Wireless_Configuration_and_Startup and http://gentoo-wiki.com/HOWTO_Atheros_Wifi_Card_/_MadWifi_Install.  These two pages have been invaluable to me in getting my own setup working - even though I discovered that my adapter uses the one unsupported atheros chipset   :Confused:  .

[EDIT] wlan_scan_sta is provided by madwifi-ng.  Try reemerging madwifi-ng and madwifi-tools to get the appropriate modules re-installed.

----------

## Marko

/sbin/modprobe -l | grep wlan

```
/lib/modules/2.6.17-gentoo-r8/net/wlan_scan_ap.ko

/lib/modules/2.6.17-gentoo-r8/net/wlan_scan_sta.ko

/lib/modules/2.6.17-gentoo-r8/net/wlan_xauth.ko

/lib/modules/2.6.17-gentoo-r8/net/wlan_wep.ko

/lib/modules/2.6.17-gentoo-r8/net/wlan_tkip.ko

/lib/modules/2.6.17-gentoo-r8/net/wlan_ccmp.ko

/lib/modules/2.6.17-gentoo-r8/net/wlan_acl.ko

/lib/modules/2.6.17-gentoo-r8/net/wlan.ko

```

dmesg | grep wlan_scan

```
couldn't load module 'wlan_scan_sta' (-38)

unable to load wlan_scan_sta

```

Here are the outputs

----------

## UberPinguin

And what about 

```
uname -r
```

?

----------

## Marko

That gives me:

```
2.6.17-gentoo-r8

```

----------

## UberPinguin

Possibly try reemerging madwifi-ng and madwifi-ng-tools if you haven't done so since that kernel dance a few posts ago.

----------

## Marko

 *UberPinguin wrote:*   

> Possibly try reemerging madwifi-ng and madwifi-ng-tools if you haven't done so since that kernel dance a few posts ago.

 

No that didn't help.

----------

## UberPinguin

Are you able to connect to your WAP manually?  It is possible that the wlan_scan_sta module is not even necessary.  If you can still connect, then remove wlan_scan_sta from /etc/modules.autoload.d/kernel-2.6 and follow the instructions at this wiki.  Again, I strongly recommend using wpa_supplicant over wireless-tools.

----------

