# Troubleshooting usb wifi - ralink 3572 chipset -

## koopdi

Troubleshooting usb wifi - ralink 3572 chipset -

It works well in Porteus. Here are the related modules Porteus uses.

```
# lsmod | grep rt

rt2800usb              13873  0 

rt2x00usb               6701  1 rt2800usb

rt2800lib              40543  1 rt2800usb

rt2x00lib              27500  3 rt2x00usb,rt2800lib,rt2800usb

mac80211              168115  3 rt2x00lib,rt2x00usb,rt2800lib

cfg80211              127472  2 mac80211,rt2x00lib

crc_ccitt               1236  1 rt2800lib

led_class               2120  1 rt2x00lib

agpgart                21265  3 drm,intel_agp,intel_gtt

parport_pc             24738  0 

parport                25141  2 ppdev,parport_pc
```

I added them:

 *Quote:*   

> File: /etc/conf.d/modules 
> 
> modules="rt2800usb rt2x00usb rt2800lib rt2x00lib mac80211 cfg80211 crc_ccitt led_class"

 

And for the kernel:

 *Quote:*   

> <M>   Ralink driver support  --->
> 
> --- Ralink driver support                                        │ │  
> 
>   │ │    < >   Ralink rt2400 (PCI/PCMCIA) support                         │ │  
> ...

 

 *Quote:*   

> --- Networking support
> 
>     --- Wireless                                                     │ │  
> 
>   │ │    <M>   cfg80211 - wireless configuration API                      │ │  
> ...

 

 *Quote:*   

> Library routines  --->
> 
>     {M} CRC-CCITT functions                                          │ │  
> 
>   │ │    -*- CRC16 functions                                              │ │  
> ...

 

ifconfig shows wlan0 but iwlist says the interface doesn't support scanning 

----------

## NeddySeagoon

koopdi,

What do you have in /lib/firmware ?

If its empty, you need to 

```
emerge linux-firmware
```

dmesg may also help - as the ralink driver loads it will request firmware.

dmesg normally says what file name it needs and if it was found or not.

----------

## koopdi

I have emerged linux-firmware.

I will reboot into gentoo and check dmesg...

 *Quote:*   

> lib/firmware$ ls
> 
> 3com/                         iwlwifi-5000-1.ucode
> 
> GPL-3                         iwlwifi-5000-2.ucode
> ...

 

----------

## koopdi

aaand the dmesg...

http://pastebin.com/UhrgHPCr

 *Quote:*   

> [    2.666286] usb 2-1.8: default language 0x0409
> 
> [    2.672657] usb 2-1.8: udev 5, busnum 2, minor = 132
> 
> [    2.672659] usb 2-1.8: New USB device found, idVendor=148f, idProduct=3572
> ...

 

 *Quote:*   

> 
> 
> [   14.369803] rt2800usb 2-1.8:1.0: usb_probe_interface
> 
> [   14.369808] rt2800usb 2-1.8:1.0: usb_probe_interface - got id

 

 *Quote:*   

> 
> 
> [   14.554744] Registered led device: rt2800usb-phy0::radio
> 
> [   14.554750] Registered led device: rt2800usb-phy0::assoc
> ...

 

----------

## NeddySeagoon

koopdi,

Your kernel and the modules you are providing for it have mismatching version magic.  They means they may not work correctly if at all.

```
[    3.829754] nfs: version magic '3.7.10-gentoo SMP mod_unload modversions ' should be '3.7.10-gentoo SMP mod_unload '
```

says the module was unloaded.

The fix is straightforward.

```
cd /usr/src/linux

make clean
```

now rebuild and reinstall your kernel in the normal way, then reboot into it.

Check the version magic issues have gone from dmesg

Check your wifi again.

There is no sign of any firmware being requested or being loaded but your kernel is broken just now, so all bets are off ....

----------

## koopdi

```
cd /usr/src/linux

make clean

make && make modules_install

cp arch/x86/boot/bzImage /boot/bzImage.efi

```

~reboot with new kernel~

dmesg:

http://pastebin.com/Gfp2GDA2

Still mismatched, it seems

----------

## NeddySeagoon

koopdi,

Your running kernel is

```
[    0.000000] Linux version 3.7.10-gentoo (root@spacerig) (gcc version 4.6.3 (Gentoo 4.6.3 p1.11, pie-0.5.2) ) #4 SMP Fri Mar 22 16:09:17 PDT 2013
```

Note the #4 SMP Fri Mar 22 16:09:17 PDT 2013.  Thats yesterday.  Its about noon on Saturday where you are and that date/time is the build time of the running kernel.

Did you need a 

```
mount /boot
```

before the cp command?

It looks like you are not using the kernel you just made.

----------

## koopdi

I think my date was set wrong. I reset the date and took it from the top, just to be sure.

```
cd /usr/src/linux

make clean

make && make modules_install

mount /dev/sda1 /boot

cp arch/x86/boot/bzImage /boot/bzImage.efi 
```

~reboot with new kernel~

dmesg:

http://pastebin.com/EyLk4hew

This is a fresh install. I don't understand how version magic mismatch happened. I have only installed one set of sources. I did try building with both genkernel, pappy's seeds, and just menuconfig.

My last build attempt was simply configured with menuconfig. The initramfs was built using genkernel.

----------

## koopdi

Tried removing the initrd=/initramfs param from the startup script. That got rid of the magic errors and the system starts way faster now. Still can't scan wlan0 though.

http://pastebin.com/t70Lp4n7

 *Quote:*   

> 
> 
>     2.411561] usb 2-1.8: udev 5, busnum 2, minor = 132
> 
> [    2.411566] usb 2-1.8: New USB device found, idVendor=148f, idProduct=3572
> ...

 

----------

## NeddySeagoon

koopdi,

Ah, you have kernel modules in your initrd that have version magic that does not match the kernel.

If you an initrd that contains kernel modules, you need to rebuild the initrd every time you rebuild the kernel, unless you are very very careful.

The initrd is kernel specific too.

Now that the version magic errors are dealt with, we can be sure that your kernel is sound.

Try 

```
ifconfig wlan0 up
```

 Then try scanning.

If it fails, there may be something useful at the end of dmesg.

----------

## koopdi

Still the same.

Of course, the card works well in linux!

I am posting from porteus using it now.

There is hope. ^_^

http://pastebin.com/VuR00isV

----------

## NeddySeagoon

koopdi,

Look at dmesg in porteus,

What does it say about wlan0 and firmware - post it if you wish.

Comparing something that works with something that doesn't is a good way to debug things.

----------

## koopdi

dmesg:

http://pastebin.com/454eSxVn

```
guest@porteus:~$ dmesg | grep rt2

[   11.209290] Registered led device: rt2800usb-phy0::radio

[   11.209297] Registered led device: rt2800usb-phy0::assoc

[   11.209304] Registered led device: rt2800usb-phy0::quality

[   11.209315] usbcore: registered new interface driver rt2800usb
```

I don't know if it makes sense to compare these as a diff but here goes.

diff dmesg.txt (porteus) /.../dmesg.txt (gentoo):

http://pastebin.com/aF7bZQ7a

----------

## koopdi

/etc/conf.d/net (gentoo)

 *Quote:*   

> modules="wpa_supplicant"
> 
> wpa_supplicant_wlan0="rt2800usb"
> 
> config_wlan0="dhcp"

 

----------

## koopdi

Okay, I figured it out...I think.

< Linux version 3.7.8-porteus 

> Linux version 3.7.10-gentoo

Is it worth trying 3.7.8 instead of 3.7.10?

----------

## NeddySeagoon

koopdi,

Do you have a /etc/init.d/net.wlan0 in Gentoo?

It should be  a symlink to /etc/inid.d/net.lo, just like net.eth0 is.

There is no firmware loaded for your wlan0 in either dmesg, which is very rare for USB devices but it does make life easier.

----------

## koopdi

Compiled latest gentoo-sources-3.8.4,

linked .../net.lo to net.wlan0,

running

.../net.wlan0 start

gives some more errors.

 *Quote:*   

> 
> 
> ...
> 
> ioctl[SIOCSIWPMKSA]: Invalid argument
> ...

 

I typed that by hand so it may not be exact. Is there a way to capture that console output to a file? Using #.../net.wlan0 start > file.txt captures the non-error messages.

 *Quote:*   

> 
> 
> #iwconfig wlan0
> 
> wlan0      no wireless extensions.

 

Edit: Here's the dmesg;

http://pastebin.com/qH1VCk47

The card works fine in knoppix too. What gives? #hair-pull

----------

## khayyam

 *koopdi wrote:*   

> 
> 
> ```
> ioctl[SIOCSIWPMKSA]: Invalid argument
> 
> ...

 

koopdi ... I imagine this is due to having the following in /etc/conf.d/net

 *koopdi wrote:*   

> 
> 
> ```
> wpa_supplicant_wlan0="rt2800usb"
> ```
> ...

 

With this you are providing wpa_supplicant with an 'Invalid argument' as there is no such option/parameter. I imagine this card is supported by MAC80211 so provide wpa_supplicant with the 'netlink' driver:

/etc/conf.d/net

```
wpa_supplicant_wlan0="-Dnl80211"
```

 *koopdi wrote:*   

> 
> 
> ```
> # iwconfig wlan0
> 
> ...

 

This is a sign that CONFIG_CFG80211_WEXT is not enabled in the kernel.

```
# awk '/(WEXT|(CFG|NL)80211)/' .config
```

HTH & best ... khay

----------

## koopdi

Aha! I remember that option. CONFIG_CFG80211_WEXT I looked at the help and it said something like "Enable this option if you need old userspace for wireless extensions with cfg80211-based drivers."

Apparently I /do/ need old userspace extensions. It threw me off.

It works almost now.

wpa_supplicant works with wext or -Dwext but it isn't connecting to me network.

It says "skip - non-WPA network not allowed."

----------

## koopdi

So I matched the encryption method. It works.

Now I can proceed with my install.

THANK YOU BOTH!

<3

----------

## khayyam

 *koopdi wrote:*   

> Apparently I /do/ need old userspace extensions.

 

koopdi ... probably you don't, but for tools that use the depreciated WEXT, like those provided by net-wireless/wireless-tool (iwconfig, iwlist, etc), then you need the emulation for them to work, net-wireless/iw uses MAC80211, but you'd have to get used to different syntax (iw is similar in syntax to iproute2) 

So, the  above 'iwconfig' would be:

```
# iw dev wlan0 link
```

or the equivelant of 'iwlist wlan0 scan'

```
# iw dev wlan0 scan
```

best ... khay

----------

