# USB Wifi RTL8192 Caues Kernel CRASH/PANIC

## Carlos87

Dear Gurus,

I am running a hardened kernel 4.8.17 and my USB wifi doggle is causing freeze. If I run '/etc/init.d/net.enp4s0f0 start' then no problem, its only when I attempt to run '/etc/init.d/net.wlp0s20u1 start' that everything freezes. I tried booting with wlp0s20u1 as default and the system freezes but no issues with enp4s0f0. I've been running gentoo for years with this USB wifi doggle. Its only after I decided to do a fresh install about 6 months ago that this problem started. The hardward has not changed and I compiled the kernel along with the same packages. Only change I see are a few kernel and package upgrades.

```
carlos@gentoo ~ $ lsusb | grep Edimax

Bus 001 Device 002: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
```

```
carlos@gentoo ~ $ sudo dmesg | grep rtl

[    2.036966] usbcore: registered new interface driver rtl8192cu

[    3.466824] rtl8192cu: Chip version 0x10

[    3.499134] rtl8192cu: Board Type 0

[    3.499445] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1

[    3.499718] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin

[    3.500111] ieee80211 phy0: Selected rate control algorithm 'rtl_rc'

[    3.500260] usb 1-1: Direct firmware load for rtlwifi/rtl8192cufw_TMSC.bin failed with error -2

[    3.500527] usb 1-1: Direct firmware load for rtlwifi/rtl8192cufw.bin failed with error -2

[    3.500861] rtlwifi: Loading alternative firmware rtlwifi/rtl8192cufw.bin

[    3.501267] rtlwifi: Firmware rtlwifi/rtl8192cufw_TMSC.bin not available

[   25.477866] rtl8192cu 1-1:1.0 wlp0s20u1: renamed from wlan0
```

I haven't even been able to get ifconfig to show wlp0s20u1. As soon as I try the system freezes up.

I'm willing to give more info if people think this is useful, but would like to start with this.

Many thanks in advance.

Carlos

----------

## NeddySeagoon

Carlos87,

It looks like you have some firmware missing.

```
[    3.501267] rtlwifi: Firmware rtlwifi/rtl8192cufw_TMSC.bin not available 
```

Its provided in linux-firmware.

Its not clear from your dmesg snippet if  rtl8192cu is built in or a module.

If its built in, the firmware must be built into the kernel too. If its a module, the firmware needs to be in /lib/firmware.

----------

## Carlos87

Thank you for your quick reply.

Here is my built in firmware:

```
grep RTL /usr/src/linux-4.8.17-hardened-r2/.config

CONFIG_BT_RTL=y

CONFIG_BT_HCIBTUSB_RTL=y

# CONFIG_USB_RTL8150 is not set

# CONFIG_USB_RTL8152 is not set

# CONFIG_RTL8180 is not set

# CONFIG_RTL8187 is not set

CONFIG_RTL_CARDS=y

# CONFIG_RTL8192CE is not set

# CONFIG_RTL8192SE is not set

# CONFIG_RTL8192DE is not set

# CONFIG_RTL8723AE is not set

# CONFIG_RTL8723BE is not set

# CONFIG_RTL8188EE is not set

# CONFIG_RTL8192EE is not set

# CONFIG_RTL8821AE is not set

CONFIG_RTL8192CU=y

CONFIG_RTLWIFI=y

CONFIG_RTLWIFI_USB=y

CONFIG_RTLWIFI_DEBUG=y

CONFIG_RTL8192C_COMMON=y

# CONFIG_RTL8XXXU is not set

# CONFIG_SERIAL_UARTLITE is not set

# CONFIG_IBM_RTL is not set

```

At one point I even tried setting up linux-firmware and was able to get this :

```
[    3.501267] rtlwifi: Firmware rtlwifi/rtl8192cufw_TMSC.bin not available 
```

to go away but that did not work so I went back to my original setup. The original setup worked 6 months ago so I am very confused.

----------

## NeddySeagoon

Carlos87,

Please put your entire kernel .config file onto a pastebin. wgetpaste can help.

Wifi drivers are in at least two parts.  

You must have all the pieces you need either on the root filesystem or built into the kernel.

Mixing won't work.

----------

## ct85711

You showed the drivers built into the kernel, not the firmware.

To insert firmware into the kernel for builtin drivers, you need to goto

 *Quote:*   

> Device Drivers  --->
> 
>     Generic Driver Options  --->
> 
>         -*- Userspace firmware loading support
> ...

 

This is where you list all the firmware to be included into the kernel.

There is a difference when building a driver as a module or as a built-in.  Modules will have a 'M' next to it, and the kernel will load the kernel as it is needed, and attempt to load any firmware that driver needs from your filesystem.  A built-in driver will have a '*' next to it, and that driver is available immediately, however the kernel has no way to load any firmware that is not directly built into the kernel.  Having it as a module is generally recommended as it is significantly easier to handle as you don't need to worry about the firmware files (as long as it is on your system in the usual places).

----------

## Carlos87

Here is the link to the .config:

http://pastebin.com/aPNL4jA3

----------

## NeddySeagoon

Carlos87,

You have

```
CONFIG_RTLWIFI=y
```

thats built into the kernel.

But 

```
CONFIG_EXTRA_FIRMWARE=""
```

So your firmware is not available when the rtlwifi driver is initialised.

With built in drivers, you must build the firmware into the kernel too.

With modular drivers, the firmware must be in /lib/firmware.

ct85711 has described the fix.

----------

## Carlos87

I had already tried building in the firmware into the kernel and the problem continued. I decided to give it another go and recompile the kernel again with built in firmware as suggested. Once again the problem remains but I am hoping you guys will be able to see something I missed. Again thank you for your help.

Here is the new config:

http://pastebin.com/yPiDRNiN

And this is dmseg showing the prior error about missing firmware is gone:

```

[    2.051405] usbcore: registered new interface driver rtl8192cu

[    3.531956] rtl8192cu: Chip version 0x10

[    3.564195] rtl8192cu: Board Type 0

[    3.564273] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1

[    3.564297] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin

[    3.564352] ieee80211 phy0: Selected rate control algorithm 'rtl_rc'

[   20.539729] rtl8192cu 1-1:1.0 wlp0s20u1: renamed from wlan0
```

----------

## Carlos87

A KEY point that should not be overlooked is that under the first kernel (with out the firmware built in) there was no problem 6 months ago.

----------

## ct85711

 *Quote:*   

> [   20.539729] rtl8192cu 1-1:1.0 wlp0s20u1: renamed from wlan0

 

This indicates it's working, and you more of not using the wrong interface name.  This line says your wireless is called wlp0s20u1 that's due to presistant naming (which is misleading, as it does renumber the devices anyways).

----------

## wrc1944

Just noticed this in the newly released 4.10.2, which may or may not help your usb dongle.: 

 *Quote:*   

> Larry Finger (1):
> 
>       rtlwifi: rtl8192c-common: Fix "BUG: KASAN:
> 
> 

 

Also, if you prefer, the easiest way avoid the interface renaming is to put net.ifnames=0 on your kernel line.

See: https://forums.gentoo.org/viewtopic-t-955646.html

 *Quote:*   

> net.ifnames=1 is the default, as in, enabled, net.ifnames=0 you can set in kernel command line to disable the new names.
> 
> 

 

When the new naming scheme was introduced, I didn't care for it very much, so I've always used the kernel line net.ifnames=0 on all my systems.

For me, on many basic multi-boot desktop systems I never ran into any problems doing so, I just prefer the old wlan0 and eth0 names.

----------

## Carlos87

It's still not working. As soon as I try and run '/etc/init.d/net.wlp0s20u1 start' kernel panics.   :Crying or Very sad: 

----------

## NeddySeagoon

Carlos87,

What is the panic text, if you can see it?

Its a human readable line that says what happened.

The register dump is only useful to kernel devs.

A photo of the panic on the console may be useful.

----------

## Carlos87

The system continues to freeze up before any messages even appear

----------

