# r8712u: network connection randomly stops working?

## mrlase

Hello all,

I am having some issues with my wireless usb adapter losing connectivity at seemingly random intervals. For example, I'll be browsing the internet, when all of a sudden I'll have no internet connectivity.

Output of dmesg

```

ADDRCONF(NETDEV_UP): wlan0: link is not ready 

r8169 0000:07:00.0: eth0: link down  

```

Output of /var/log/messages

```

Jul 16 20:29:07 localhost dhcpcd[16250]: wlan0: carrier lost

Jul 16 20:29:07 localhost wpa_cli: interface wlan0 DISCONNECTED

Jul 16 20:29:07 localhost wpa_cli: executing 'false /etc/init.d/net.wlan0 --quiet stop' failed

Jul 16 20:29:09 localhost ntpd[18243]: Deleting interface #15 wlan0, 192.168.1.115#123, interface stats: received=72, sent=74, dropped=0, active_time=16627 secs

Jul 16 20:29:09 localhost ntpd[18243]: 96.44.142.5 interface 192.168.1.115 -> (none)

Jul 16 20:29:09 localhost ntpd[18243]: 184.105.192.247 interface 192.168.1.115 -> (none)

Jul 16 20:29:09 localhost ntpd[18243]: 208.87.104.40 interface 192.168.1.115 -> (none)

Jul 16 20:29:09 localhost ntpd[18243]: 205.196.146.72 interface 192.168.1.115 -> (none)

Jul 16 20:29:09 localhost ntpd[18243]: peers refreshed

Jul 16 20:29:11 localhost dhcpcd[16250]: received SIGHUP, releasing

Jul 16 20:29:11 localhost dhcpcd[16250]: wlan0: removing interface

Jul 16 20:29:11 localhost dhcpcd[688]: sending signal 1 to pid 16250

Jul 16 20:29:11 localhost dhcpcd[688]: waiting for pid 16250 to exit

Jul 16 20:29:12 localhost kernel: ADDRCONF(NETDEV_UP): wlan0: link is not ready

Jul 16 20:29:12 localhost dhcpcd[703]: dhcpcd not running

Jul 16 20:29:12 localhost kernel: r8169 0000:07:00.0: eth0: link down

Jul 16 20:29:12 localhost kernel: ADDRCONF(NETDEV_UP): eth0: link is not ready

Jul 16 20:29:13 localhost ntpd[18243]: Deleting interface #14 wlan0, fe80::21a:efff:fe17:5322#123, interface stats: received=0, sent=0, dropped=0, active_time=16634 secs

Jul 16 20:29:13 localhost ntpd[18243]: peers refreshed

Jul 16 20:29:16 localhost kernel: ADDRCONF(NETDEV_UP): wlan0: link is not ready

```

Output of uname -a - note, kernel was compiled using genkernel as described by the handbook

```

Linux taipei 3.3.8-gentoo #1 SMP Sun Jul 8 15:50:54 EDT 2012 x86_64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz GenuineIntel GNU/Linux

```

Output of lsmod

```
Module                  Size  Used by

ipv6                  228393  56 

snd_hda_codec_realtek   101622  1 

snd_hda_intel          20232  5 

snd_hda_codec          60868  2 snd_hda_codec_realtek,snd_hda_intel

processor              25085  0 

nvidia              12275151  24 

r8169                  40510  0 

thermal_sys            12602  1 processor

snd_hwdep               5078  1 snd_hda_codec

snd_pcm                56441  3 snd_hda_intel,snd_hda_codec

snd_timer              15545  2 snd_pcm

i2c_i801                7262  0 

snd                    47863  14 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer

intel_agp              10320  0 

intel_gtt              11801  1 intel_agp

joydev                  8647  0 

snd_page_alloc          5977  2 snd_hda_intel,snd_pcm

i2c_core               16239  2 nvidia,i2c_i801

mii                     3459  1 r8169

pcspkr                  1715  0 

r8712u                139230  0 

button                  4247  0 

sha256_generic          9821  0 

libiscsi               29707  0 

scsi_transport_iscsi    30753  1 libiscsi

tg3                   119724  0 

libphy                 14520  1 tg3

e1000                  84114  0 

fuse                   56837  5 

nfs                   134804  0 

lockd                  61977  1 nfs

sunrpc                166148  3 nfs,lockd

jfs                   139032  0 

raid10                 25560  0 

raid456                45466  0 

async_raid6_recov       1209  1 raid456

async_memcpy            1166  1 raid456

async_pq                3051  1 raid456

async_xor               2169  2 raid456,async_pq

xor                     4425  1 async_xor

async_tx                1718  5 raid456,async_raid6_recov,async_memcpy,async_pq,async_xor

raid6_pq               77410  2 async_raid6_recov,async_pq

raid1                  22826  0 

raid0                   6078  0 

dm_snapshot            24195  0 

dm_crypt               13679  0 

dm_mirror              11366  0 

dm_region_hash          6156  1 dm_mirror

dm_log                  7428  2 dm_mirror,dm_region_hash

dm_mod                 58148  20 dm_snapshot,dm_crypt,dm_mirror,dm_log

scsi_wait_scan           695  0 

hid_sunplus             1377  0 

hid_sony                2496  0 

hid_samsung             2822  0 

hid_pl                  1297  0 

hid_petalynx            1906  0 

hid_monterey            1473  0 

hid_microsoft           2771  0 

hid_logitech            6829  0 

hid_gyration            2012  0 

hid_ezkey               1306  0 

hid_cypress             1810  0 

hid_chicony             2089  0 

hid_cherry              1441  0 

hid_belkin              1606  0 

hid_apple               4945  0 

hid_a4tech              1884  0 

sl811_hcd               8863  0 

usbhid                 22298  0 

ohci_hcd               19269  0 

ssb                    37460  1 ohci_hcd

uhci_hcd               18832  0 

usb_storage            39987  1 

ehci_hcd               32802  0 

usbcore               122272  9 r8712u,hid_sony,sl811_hcd,usbhid,ohci_hcd,uhci_hcd,usb_storage,ehci_hcd

usb_common               850  1 usbcore

aic94xx                64496  0 

libsas                 45181  1 aic94xx

lpfc                  438566  0 

qla2xxx               313986  0 

megaraid_sas           65643  0 

megaraid_mbox          24030  0 

megaraid_mm             6937  1 megaraid_mbox

megaraid               35864  0 

aacraid                65690  0 

sx8                    11236  0 

DAC960                 62148  0 

cciss                  43533  0 

3w_9xxx                29241  0 

3w_xxxx                20787  0 

mptsas                 33137  0 

scsi_transport_sas     21297  3 aic94xx,libsas,mptsas

mptfc                  10429  0 

scsi_transport_fc      36642  3 lpfc,qla2xxx,mptfc

scsi_tgt                8328  1 scsi_transport_fc

mptspi                 11311  0 

mptscsih               16717  3 mptsas,mptfc,mptspi

mptbase                54664  4 mptsas,mptfc,mptspi,mptscsih

atp870u                23993  0 

dc395x                 26843  0 

qla1280                19371  0 

imm                     8772  0 

parport                25175  1 imm

dmx3191d                9060  0 

sym53c8xx              63260  0 

gdth                   73123  0 

advansys               51810  0 

initio                 15391  0 

BusLogic               19341  0 

arcmsr                 23411  0 

aic7xxx               106128  0 

aic79xx               110288  0 

scsi_transport_spi     17592  5 mptspi,dmx3191d,sym53c8xx,aic7xxx,aic79xx

sg                     21140  0 

pdc_adma                5314  0 

sata_inic162x           6378  0 

sata_mv                23624  0 

ata_piix               21207  4 

ahci                   19277  0 

libahci                16882  1 ahci

sata_qstor              5081  0 

sata_vsc                3934  0 

sata_uli                2905  0 

sata_sis                3554  0 

sata_sx4                8109  0 

sata_nv                18287  0 

sata_via                7480  0 

sata_svw                4078  0 

sata_sil24             10124  0 

sata_sil                7172  0 

sata_promise            9741  0 

pata_sl82c105           3539  0 

pata_cs5530             4173  0 

pata_cs5520             3603  0 

pata_via                8241  0 

pata_jmicron            2312  0 

pata_marvell            2817  0 

pata_sis                9996  1 sata_sis

pata_netcell            2110  0 

pata_sc1200             2919  0 

pata_pdc202xx_old       4307  0 

pata_triflex            3085  0 

pata_atiixp             3609  0 

pata_opti               2687  0 

pata_amd                9908  0 

pata_ali                8887  0 

pata_it8213             3279  0 

pata_pcmcia             9685  0 

pcmcia                 29452  2 ssb,pata_pcmcia

pcmcia_core            10525  1 pcmcia

pata_ns87415            3193  0 

pata_ns87410            2685  0 

pata_serverworks        4993  0 

pata_artop              4733  0 

pata_it821x             8253  0 

pata_optidma            4426  0 

pata_hpt3x2n            5330  0 

pata_hpt3x3             2949  0 

pata_hpt37x            10721  0 

pata_hpt366             4950  0 

pata_cmd64x             5805  0 

pata_efar               3395  0 

pata_rz1000             2642  0 

pata_sil680             4470  0 

pata_radisys            2823  0 

pata_pdc2027x           6137  0 

pata_mpiix              2779  0 

libata                138325  52 

*removed random ones for formatting

```

Make.conf

```

CFLAGS="-march=native -O2 -pipe"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j6"

CHOST="x86_64-pc-linux-gnu"

GENTOO_MIRRORS="http://mirrors.rit.edu/gentoo/ http://www.gtlib.gatech.edu/pub/gentoo http://mirror.lug.udel.edu/pub/gentoo/"

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

INPUT_DEVICES="evdev"

VIDEO_CARDS="nvidia"

LINGUAS="en ko"

USE="-gnome -kde -minimal -qt4 dbus jpeg lock session startup-notification thunar udev mmx sse sse2 truetype xinerama unicode cjk nls 256-color perl git subversion imap ssl smtp gdbmpam tcpd sqlite djvu"

source /var/lib/layman/make.conf

PORTDIR_OVERLAY="/usr/local/portage $PORTDIR_OVERLAY"

```

iwconfig

```

lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"XXXXXX"  Nickname:"rtl_wifi"

          Mode:Managed  Frequency:2.437 GHz  Access Point: XX:XX:XX:XX:XX:XX   

          Bit Rate:150 Mb/s   Sensitivity:0/0  

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:****-****-****-****-****-****-****-****   Security mode:open

          Power Management:off

          Link Quality=100/100  Signal level=62/100  Noise level=0/100

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

eth0      no wireless extensions.

```

route

```

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         DD-WRT          0.0.0.0         UG    2002   0        0 wlan0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

192.168.1.0     *               255.255.255.0   U     2002   0        0 wlan0

```

/etc/wpa_supplicant/

```

network={

  ssid="xxxxxx"

  psk=removed

}

```

/etc/conf.d/net

```

modules="wpa_supplicant"

config_wlan0="dhcp"

wpa_supplicant_wlan0="-Dwext"

wpa_timeout_wlan0=60

```

I CAN get it to work again if I issue /etc/init.d/net.wlan0 restart, however, I would prefer it were working all the time. Would anyone have an idea of what might be wrong?

Hope I included everything needed to diagnose this problem.

----------

## Logicien

Hello,

the rt8712u module is a staging driver. Because of this, it is not consider as stable. This module do not use the 80211 api. I bought a card that was drived by the rt8712u module and I could not use it as an access point with Linux because Hostapd need cards that use 80211. This is the information part.

About your problem, be sure you have the latest linux-firmware package installed. The rt8712u module use the rtl8712u.bin firmware file from this package.

You should have a look at the module options:

```
modinfo rt8712u

...

parm:           wifi_test:int

parm:           video_mode:int

parm:           chip_version:int

parm:           rfintfs:int

parm:           lbkmode:int

parm:           hci:int

parm:           network_mode:int

parm:           channel:int

parm:           mp_mode:int

parm:           wmm_enable:int

parm:           vrtl_carrier_sense:int

parm:           vcs_type:int

parm:           busy_thresh:int

parm:           ht_enable:int

parm:           cbw40_enable:int

parm:           ampdu_enable:int

parm:           rf_config:int

parm:           power_mgnt:int

parm:           low_power:int

parm:           ifname: Net interface name, wlan%d=default (string)

parm:           initmac:MAC-Address, default: use FUSE (charp)

```

I do not know the signification of all the options, but some are obvious. I would disable any power management by adding

```

echo 'options rt8712u low_power=0 power_mgnt=0' >> /etc/modprobe.d/modprobe.conf
```

----------

## khayyam

 *mrlase wrote:*   

> 
> 
> ```
> wlan0     IEEE 802.11bgn  ESSID:"XXXXXX"  Nickname:"rtl_wifi"
> 
> ...

 

The birate of 150 Mb/s is probably the cause of the DISASSOC ... higher bit rate means that data is packed more closely together, and can therefore be more prone to signal corruption. Note that lowering the bitrate will help when at distance from the AP.

Please try the following for testing purposes ...

```
iwconfig wlan0 rate 24M
```

Also, your wpa_supplicant.conf is rather sparse. You should at least provide key_mgmt and proto (WPA2, I assume)

```
network={

        ssid="xxxxxx"

        scan_ssid=1

        proto=RSN

        key_mgmt=WPA-PSK

        group=CCMP TKIP

        pairwise=CCMP TKIP

        psk=removed

        priority=1

}
```

HTH & best ...

khay

----------

## saellaven

I have a r8712u dongle on my dad's computer and it's been running for months without any problems.

Just a few questions that may help:

are you using any other data heavy USB hardware? USB is a shared bus and something like a USB drive can cause bus contention

are there any power hungry devices that could be dropping the voltage on your USB bus?

do you still experience disconnects when you're close to your router (ie, is it a signal strength issue?)

----------

## mrlase

Bit of an update:

I disabled wicd and it's daemons and haven't had a problem since. My uptime right now is 9 hours and 44 minutes so I'll consider this solved if it is still connected by morning. Thank you for all the help. If anything arises, I will report back.

----------

## khayyam

 *mrlase wrote:*   

> I disabled wicd and it's daemons and haven't had a problem since. My uptime right now is 9 hours and 44 minutes so I'll consider this solved if it is still connected by morning. Thank you for all the help. If anything arises, I will report back.

 

mrlase ... and you didn't think to mention you were using wicd? From the above we have absolutely no clue that this is part of the equation ... and so think its an issue of basic connectivity. Please, in future, such information is far more inportant than the output of 'route'.

best ... khay

----------

