[Moto X Q&A] mspinksosu:
Hello everyone. First of all, I have tried this on different roms with the same result. I've done a lot of research, but I'm getting a little desperate. Here's my story so far:

Stock Moto X with Android 5.1: (don't remember the specific build number or kernel but it was up to date)

It started about two to three weeks ago. IIRC, there was a security patch update a week prior. hmm....

Wifi would disconnect once every few days. On reconnect it would fail and just show "Saved". Toggling the wifi sometimes worked. Sometimes I tried airplane mode etc. Then it started disconnecting once a day or so. I started trying a few things:

Rebooting the phone sometimes made it work for the rest of the day. Most threads I found ask you to forget the wifi, reconnect, switch to 2.4GHz band etc. I tried them all. I changed the security on my router. I tried other networks with no security. At this point I'm pretty sure it's the phone.

Rebooting didn't really seem to help all that much. Now it's disconnecting many times a day.

I didn't want to wipe my phone just yet, so I cleared the cache. No luck.

I'm a little concerned some app might be causing problems, so I factory reset the phone. Wifi worked for about a day or so. Then back to the same routine... :-/

I even did it again. This time without installing all my apps right away. Just the Google apps and one music app. Same thing. Worked for maybe a day.

At this point it refuses to connect to

any

network. Tries three times, then fails.

Eventually, I said the hell with it and unlocked the bootloader, installed TWRP and successfully installed CyanogenMod 12. A big thank you to dray_jr for putting everything I needed in one place. I've always wanted to try it. It's very nice btw.

CyanogenMod 12.1 cm-12.1-20160127-SNAPSHOT-YOG7DAO3J1-ghost.zip:

Guess what? Same crap. It won't connect to any wifi at all.

CyanogenMod 11 cm-11-20141115-SNAPSHOT-M12-ghost.zip

Since it was so easy to install, I decided to just go to CyanogenMod 11. Issue still persists.

While on CM11 last night I did some snooping with the debugger:

06-05 23:38:46.849 5484-5484/? I/wpa_supplicant: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=c0:3f:0e:ef:ba:02 status_code=1
06-05 23:38:47.805 5484-5484/? I/wpa_supplicant: wlan0: Trying to associate with SSID 'GLaDOS'
06-05 23:38:48.273 5484-5484/? I/wpa_supplicant: wlan0: CTRL-EVENT-ASSOC-REJECT status_code=1
06-05 23:38:49.735 5484-5484/? I/wpa_supplicant: wlan0: Trying to associate with SSID 'GLaDOS'
06-05 23:38:49.887 754-767/system_process I/art: Background sticky concurrent mark sweep GC freed 116030(6MB) AllocSpace objects, 19(472KB) LOS objects, 25% free, 19MB/26MB, paused 1.831ms total 120.524ms
06-05 23:38:50.949 5484-5484/? I/wpa_supplicant: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=c0:3f:0e:ef:ba:02 status_code=1
06-05 23:38:52.446 5484-5484/? I/wpa_supplicant: wlan0: Trying to associate with SSID 'GLaDOS'
06-05 23:38:53.606 5484-5484/? I/wpa_supplicant: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=c0:3f:0e:ef:ba:02 status_code=1
06-05 23:38:53.607 5484-5484/? I/wpa_supplicant: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="GLaDOS" auth_failures=1 duration=10 reason=CONN_FAILED
06-05 23:38:53.609 754-1164/system_process E/WifiStateMachine: ConnectModeState SSID state=temp-disabled nid=0 [id=0 ssid="GLaDOS" auth_failures=1 duration=10 reason=CONN_FAILED]
06-05 23:38:53.610 754-1164/system_process E/WifiConfigStore: SSID temp disabled for "GLaDOS"-WPA_PSK had autoJoinStatus=0 self added false ephemeral false
06-05 23:38:53.610 754-1164/system_process E/WifiConfigStore: message=id=0 ssid="GLaDOS" auth_failures=1 duration=10 reason=CONN_FAILED
06-05 23:38:55.072 754-1164/system_process E/WifiStateMachine: WifiStateMachine Disconnected CMD_START_SCAN source -2 25, 26 -> obsolete
06-05 23:38:55.533 754-1164/system_process E/WifiStateMachine: WifiStateMachine shouldSwitchNetwork txSuccessRate=0.00 rxSuccessRate=0.00 delta 1000 -> 1000
06-05 23:38:55.550 754-1164/system_process E/WifiStateMachine: CMD_AUTO_CONNECT sup state ScanState my state DisconnectedState nid=0 roam=3
06-05 23:38:55.550 754-1164/system_process E/WifiConfigStore: saveWifiConfigBSSID Setting BSSID for "GLaDOS"-WPA_PSK to any
06-05 23:38:55.550 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.552 754-1164/system_process E/WifiStateMachine: CMD_AUTO_CONNECT will save config -> "GLaDOS" nid=0
06-05 23:38:55.552 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.575 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.577 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.578 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.578 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.579 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.580 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.581 754-1164/system_process E/WifiConfigStore: will read network variables netId=0
06-05 23:38:55.589 754-1164/system_process E/WifiStateMachine: CMD_AUTO_CONNECT did save config -> nid=0
06-05 23:38:55.590 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:38:55.591 754-1164/system_process E/WifiConfigStore: will read network variables netId=0
06-05 23:38:55.596 5484-5484/? I/wpa_supplicant: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="GLaDOS"
06-05 23:38:55.598 5484-5484/? I/wpa_supplicant: wlan0: Trying to associate with SSID 'GLaDOS'
06-05 23:38:55.602 754-1164/system_process E/WifiStateMachine: ConnectModeState SSID state=re-enabled nid=0 [id=0 ssid="GLaDOS"]
06-05 23:38:55.602 754-1164/system_process E/WifiConfigStore: SSID re-enabled for "GLaDOS"-WPA_PSK had autoJoinStatus=0 self added false ephemeral false
06-05 23:38:56.679 5484-5484/? I/wpa_supplicant: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=c0:3f:0e:ef:ba:02 status_code=1
06-05 23:38:56.679 5484-5484/? I/wpa_supplicant: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="GLaDOS" auth_failures=1 duration=10 reason=CONN_FAILED
06-05 23:38:56.685 754-1164/system_process E/WifiStateMachine: ConnectModeState SSID state=temp-disabled nid=0 [id=0 ssid="GLaDOS" auth_failures=1 duration=10 reason=CONN_FAILED]
06-05 23:38:56.686 754-1164/system_process E/WifiConfigStore: SSID temp disabled for "GLaDOS"-WPA_PSK had autoJoinStatus=0 self added false ephemeral false
06-05 23:38:56.691 754-1164/system_process E/WifiConfigStore: message=id=0 ssid="GLaDOS" auth_failures=1 duration=10 reason=CONN_FAILED
06-05 23:39:07.119 754-1164/system_process E/WifiStateMachine: WifiStateMachine shouldSwitchNetwork txSuccessRate=0.00 rxSuccessRate=0.00 delta 1000 -> 1000
06-05 23:39:07.133 754-1164/system_process E/WifiStateMachine: CMD_AUTO_CONNECT sup state ScanState my state DisconnectedState nid=0 roam=3
06-05 23:39:07.133 754-1164/system_process E/WifiConfigStore: saveWifiConfigBSSID Setting BSSID for "GLaDOS"-WPA_PSK to any
06-05 23:39:07.133 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:39:07.135 754-1164/system_process E/WifiStateMachine: CMD_AUTO_CONNECT will save config -> "GLaDOS" nid=0
06-05 23:39:07.136 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:39:07.158 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:39:07.159 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:39:07.160 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:39:07.161 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:39:07.162 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL
06-05 23:39:07.163 754-1164/system_process E/wifi_gbk2utf: g_pItemList is NULL

If anyone has any idea what's going on, I would love to know. For now, I will continue researching.