Ubuntu – WiFi (r8712u) is only working after doing rmmod & modprobe

16.04driversnetworkingwireless

My Wifi is not working after logging in. I have no clue why it starts working after manually doing a rmmod && modprobe.
I guess there is something wrong with the order during boot-up.

Below are two snippets of my dmesg. The first one is during normal boot-up.
The second one belongs to my manual rmmod/modprobe step.

Do you have any idea what I can do to fix this?

System: Kubuntu: 16.04 , 4.4.0-10-generic x86_64

[    7.087388] r8169 0000:07:00.0 enp7s0: link down
[    7.087428] IPv6: ADDRCONF(NETDEV_UP): enp7s0: link is not ready
[    7.089674] IPv6: ADDRCONF(NETDEV_UP): enp8s0: link is not ready
[    7.109848] r8712u: module is from the staging directory, the quality is unknown, you have been warned.
[    7.110464] r8712u: register rtl8712_netdev_ops to netdev_ops
[    7.110467] usb 1-4: r8712u: USB_SPEED_HIGH with 4 endpoints
[    7.110907] usb 1-4: r8712u: Boot from EFUSE: Autoload OK
[    7.282782] r8169 0000:08:00.0 enp8s0: link down
[    7.284825] IPv6: ADDRCONF(NETDEV_UP): enp8s0: link is not ready
[    7.617220] usb 1-4: r8712u: CustomerID = 0x000a
[    7.617222] usb 1-4: r8712u: MAC Address from efuse = 00:87:40:10:08:be
[    7.617223] usb 1-4: r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
[    7.617261] usbcore: registered new interface driver r8712u
[    7.621546] r8712u 1-4:1.0 wlx0087401008be: renamed from wlan0
[    7.732358] cfg80211: World regulatory domain updated:
[    7.732360] cfg80211:  DFS Master region: unset
[    7.732361] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    7.732363] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    7.732365] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    7.732366] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[    7.732368] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    7.732370] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    7.732371] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    7.732373] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[    7.732374] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[    7.777931] nvidia-modeset: Allocated GPU:0 (GPU-129106a8-8953-c390-c543-a6e522aa3b5e) @ PCI:0000:03:00.0

After doing: sudo rmmod r8712u && sudo modprobe r8712u

[  188.145386] usbcore: deregistering interface driver r8712u
[  188.282787] usb 1-4: reset high-speed USB device number 2 using ehci-pci
[  192.478971] r8712u: module is from the staging directory, the quality is unknown, you have been warned.
[  192.481375] r8712u: register rtl8712_netdev_ops to netdev_ops
[  192.481380] usb 1-4: r8712u: USB_SPEED_HIGH with 4 endpoints
[  192.481947] usb 1-4: r8712u: Boot from EFUSE: Autoload OK
[  193.181882] usb 1-4: r8712u: CustomerID = 0x000a
[  193.181887] usb 1-4: r8712u: MAC Address from efuse = 00:87:40:10:08:be
[  193.181890] usb 1-4: r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
[  193.182264] usbcore: registered new interface driver r8712u
[  193.184687] r8712u 1-4:1.0 wlx0087401008be: renamed from wlan0
[  193.209228] IPv6: ADDRCONF(NETDEV_UP): wlx0087401008be: link is not ready
[  193.914988] r8712u 1-4:1.0 wlx0087401008be: 1 RCR=0x153f00e
[  193.915733] r8712u 1-4:1.0 wlx0087401008be: 2 RCR=0x553f00e
[  194.022709] IPv6: ADDRCONF(NETDEV_UP): wlx0087401008be: link is not ready
[  194.346729] IPv6: ADDRCONF(NETDEV_UP): wlx0087401008be: link is not ready
[  194.380906] IPv6: ADDRCONF(NETDEV_UP): wlx0087401008be: link is not ready
[  204.899115] IPv6: ADDRCONF(NETDEV_CHANGE): wlx0087401008be: link becomes ready

sudo lshw -class network

  *-network
       description: Wireless interface
       physical id: 1
       bus info: usb@1:4
       logical name: wlx0087401008be
       serial: 00:87:40:10:08:be
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=r8712u ip=192.168.178.20 multicast=yes wireless=IEEE 802.11bgn

lsusb

Bus 001 Device 002: ID 0bda:8172 Realtek Semiconductor Corp. RTL8191SU 802.11n WLAN Adapter

Update: cat /var/log/syslog | grep NetworkManager

ar  5 21:28:12 ferhat-X58A-UD5 NetworkManager[882]: <info>  urfkill disappeared from the bus
Mar  5 21:28:12 ferhat-X58A-UD5 NetworkManager[882]: <info>  ofono is now available
Mar  5 21:28:12 ferhat-X58A-UD5 NetworkManager[882]: <warn>  failed to enumerate oFono devices: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.ofono was not provided by any .service files
Mar  5 21:28:12 ferhat-X58A-UD5 NetworkManager[882]: <info>  ModemManager available in the bus
Mar  5 21:28:12 ferhat-X58A-UD5 NetworkManager[882]: <info>  wpa_supplicant running
Mar  5 21:28:13 ferhat-X58A-UD5 NetworkManager[882]: <error> [1457209693.030273] [platform/wifi/wifi-utils-wext.c:519] wext_get_range(): (wlan0): couldn't get driver range information (19).
Mar  5 21:28:13 ferhat-X58A-UD5 NetworkManager[882]: <info>  (wlan0): driver WEXT range request failed
Mar  5 21:28:13 ferhat-X58A-UD5 NetworkManager[882]: <warn>  (wlan0): failed to initialize WiFi driver
Mar  5 21:28:13 ferhat-X58A-UD5 NetworkManager[882]: (NetworkManager:882): GLib-GObject-CRITICAL **: object NMDeviceWifi 0xfa83d0 finalized while still in-construction
Mar  5 21:28:13 ferhat-X58A-UD5 NetworkManager[882]: (NetworkManager:882): GLib-GObject-CRITICAL **: Custom constructor for class NMDeviceWifi returned NULL (which is invalid). Please use GInitable instead.
Mar  5 21:28:13 ferhat-X58A-UD5 NetworkManager[882]: <warn>  wlan0: factory failed to create device: (unknown)
Mar  5 21:28:13 ferhat-X58A-UD5 NetworkManager[882]: <info>  devices added (path: /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4:1.0/net/wlx0087401008be, iface: wlx0087401008be)
Mar  5 21:28:13 ferhat-X58A-UD5 NetworkManager[882]: <info>  device added (path: /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4:1.0/net/wlx0087401008be, iface: wlx0087401008be): no ifupdown configuration found.
Mar  5 21:28:17 ferhat-X58A-UD5 NetworkManager[882]: <info>  startup complete

Best Answer

You are running Ubuntu 16.04 which is not yet fully tested and debugged and therefore not fully ready for release. I believe the proposed version of Network Manager contains a bug. I am unsure if there is any way to install an earlier version of NM in 16.04. https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1489154

In the meantime, I suggest you do:

gksudo gedit /etc/rc.local

Use nano or kate or leafpad if you don't have the text editor gedit. Change the file to read:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

sleep 3
service network-manager restart

exit 0

Proofread carefully, save and close the text editor.

Reboot. Any improvement?