Problem Connecting to WPA2-Secured Wifi

What is the problem?

I have been unable to connect to my new wifi router (TP-Link AC1750 running with WPA2 encryption), despite being able to connect to multiple WPA/WPA2 networks in the past. It seems like the raspi 2 (with well-tested usb wifi dongle) is attempting to connect, then disconnects for "reason=0". I found some threads online stating that this could be due to the network running with WPA/WPA2 encryption instead of WPA2 encryption, so I changed it to WPA2 encryption only. This did not solve the problem. I am certain that the essid and passkey are correct in wpa_network_supplicant.txt, where my other networks are registered, and octopi-network.txt is all commented out.

What did you already try to solve it?

  • Changed network settings in router from WPA to WPA2
  • Made sure all quotation marks in octopi network supplicant were edited in vim so that I wouldn't get strange issues with smart quotations from TextEdit
  • Commented out all networks in network supplicant file except for the target network
  • Tried adding additional characteristics to the network blocks (encryption type etc)

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)

  • OctoPrint version : 1.3.8
  • OctoPi version : 0.14.0

Log file output of interest. Note connection to router MAC address (50:c7:bf:de:3a:8a) followed by disconnection. This section of the log file is followed by attempts to connect to the other networks listed in the wpa config file, which are not in range.

Jun 14 10:49:22 octopi wpa_supplicant[492]: wlan0: Associated with 50:c7:bf:de:3a:8a
Jun 14 10:49:22 octopi kernel: [2970825.660165] CPU: 0 PID: 17942 Comm: kworker/u2:2 Not tainted 4.9.28+ #998
Jun 14 10:49:22 octopi kernel: [2970825.660179] Hardware name: BCM2835
Jun 14 10:49:22 octopi kernel: [2970825.661105] Workqueue: cfg80211 cfg80211_event_work [cfg80211]
Jun 14 10:49:22 octopi kernel: [2970825.661274] [<c0016148>] (unwind_backtrace) from [<c0013c90>] (show_stack+0x20/0x24)
Jun 14 10:49:22 octopi kernel: [2970825.661315] [<c0013c90>] (show_stack) from [<c03192f8>] (dump_stack+0x20/0x28)
Jun 14 10:49:22 octopi kernel: [2970825.661387] [<c03192f8>] (dump_stack) from [<c0021c98>] (__warn+0xe4/0x10c)
Jun 14 10:49:22 octopi kernel: [2970825.661410] [<c0021c98>] (__warn) from [<c0021d8c>] (warn_slowpath_null+0x30/0x38)
Jun 14 10:49:22 octopi kernel: [2970825.662330] [<c0021d8c>] (warn_slowpath_null) from [<bf2007f0>] (__cfg80211_connect_result+0x2b4/0x3e0 [cfg80211])
Jun 14 10:49:22 octopi kernel: [2970825.664200] [<bf2007f0>] (__cfg80211_connect_result [cfg80211]) from [<bf1da694>] (cfg80211_process_wdev_events+0x180/0x210 [cfg80211])
Jun 14 10:49:22 octopi kernel: [2970825.666167] [<bf1da694>] (cfg80211_process_wdev_events [cfg80211]) from [<bf1da760>] (cfg80211_process_rdev_events+0x3c/0x70 [cfg80211])
Jun 14 10:49:22 octopi kernel: [2970825.667896] [<bf1da760>] (cfg80211_process_rdev_events [cfg80211]) from [<bf1d5208>] (cfg80211_event_work+0x24/0x2c [cfg80211])
Jun 14 10:49:22 octopi kernel: [2970825.668977] [<bf1d5208>] (cfg80211_event_work [cfg80211]) from [<c00389e8>] (process_one_work+0x11c/0x398)
Jun 14 10:49:22 octopi kernel: [2970825.669129] [<c00389e8>] (process_one_work) from [<c0038ca0>] (worker_thread+0x3c/0x508)
Jun 14 10:49:22 octopi wpa_supplicant[492]: wlan0: CTRL-EVENT-CONNECTED - Connection to 50:c7:bf:de:3a:8a completed [id=0 id_str=]
Jun 14 10:49:22 octopi kernel: [2970825.669162] [<c0038ca0>] (worker_thread) from [<c003e820>] (kthread+0xf8/0x114)
Jun 14 10:49:22 octopi kernel: [2970825.669205] [<c003e820>] (kthread) from [<c000fec8>] (ret_from_fork+0x14/0x2c)
Jun 14 10:49:22 octopi kernel: [2970825.669253] ---[ end trace 6cc71d6259396a3e ]---
Jun 14 10:49:22 octopi wpa_supplicant[492]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jun 14 10:49:22 octopi wpa_supplicant[492]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=US
Jun 14 10:49:23 octopi avahi-daemon[402]: Withdrawing address record for 128.12.6.137 on wlan0.
Jun 14 10:49:23 octopi avahi-daemon[402]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 128.12.6.137.
Jun 14 10:49:23 octopi avahi-daemon[402]: Interface wlan0.IPv4 no longer relevant for mDNS.
Jun 14 10:49:23 octopi dhcpcd[691]: wlan0: deleting route to 128.12.6.128/26
Jun 14 10:49:23 octopi dhcpcd[691]: wlan0: deleting default route via 128.12.6.129
Jun 14 10:49:23 octopi dhcpcd[691]: wlan0: carrier acquired
Jun 14 10:49:23 octopi dhcpcd[691]: wlan0: IAID 06:2b:8a:90
Jun 14 10:49:24 octopi dhcpcd[691]: wlan0: soliciting an IPv6 router
Jun 14 10:49:24 octopi dhcpcd[691]: wlan0: rebinding lease of 128.12.6.137
Jun 14 10:49:25 octopi ntpd[720]: Deleting interface #227 wlan0, 128.12.6.137#123, interface stats: received=64, sent=64, dropped=0, active_time=9410 secs
Jun 14 10:49:25 octopi ntpd[720]: 178.124.134.106 interface 128.12.6.137 -> (none)
Jun 14 10:49:25 octopi ntpd[720]: 213.186.36.183 interface 128.12.6.137 -> (none)
Jun 14 10:49:25 octopi ntpd[720]: 2.248.181.59 interface 128.12.6.137 -> (none)
Jun 14 10:49:25 octopi ntpd[720]: 149.210.142.45 interface 128.12.6.137 -> (none)
Jun 14 10:49:25 octopi ntpd[720]: peers refreshed
Jun 14 10:49:29 octopi dhcpcd[691]: wlan0: probing for an IPv4LL address
Jun 14 10:49:29 octopi dhcpcd[691]: wlan0: DHCP lease expired
Jun 14 10:49:29 octopi dhcpcd[691]: wlan0: soliciting a DHCP lease
Jun 14 10:49:34 octopi dhcpcd[691]: wlan0: using IPv4LL address 169.254.198.94
Jun 14 10:49:34 octopi dhcpcd[691]: wlan0: adding route to 169.254.0.0/16
Jun 14 10:49:34 octopi avahi-daemon[402]: Joining mDNS multicast group on interface wlan0.IPv4 with address 169.254.198.94.
Jun 14 10:49:34 octopi avahi-daemon[402]: New relevant interface wlan0.IPv4 for mDNS.
Jun 14 10:49:34 octopi avahi-daemon[402]: Registering new address record for 169.254.198.94 on wlan0.IPv4.
Jun 14 10:49:35 octopi ntpd[720]: Listen normally on 228 wlan0 169.254.198.94 UDP 123
Jun 14 10:49:35 octopi ntpd[720]: peers refreshed
Jun 14 10:49:36 octopi dhcpcd[691]: wlan0: no IPv6 Routers available
Jun 14 10:51:04 octopi wpa_supplicant[492]: wlan0: CTRL-EVENT-DISCONNECTED bssid=50:c7:bf:de:3a:8a reason=0
Jun 14 10:51:04 octopi dhcpcd[691]: wlan0: carrier lost
Jun 14 10:51:04 octopi wpa_supplicant[492]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jun 14 10:51:04 octopi wpa_supplicant[492]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=US
Jun 14 10:51:05 octopi avahi-daemon[402]: Withdrawing address record for 169.254.198.94 on wlan0.
Jun 14 10:51:05 octopi avahi-daemon[402]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 169.254.198.94.
Jun 14 10:51:05 octopi avahi-daemon[402]: Interface wlan0.IPv4 no longer relevant for mDNS.
Jun 14 10:51:05 octopi dhcpcd[691]: wlan0: deleting route to 169.254.0.0/16

Octopi WPA Supplicant (network of interest is "Smart Bidet Wifi")


country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

# This is only used to configure multiple wifi networks or other advanced wifi features.
# take a look into octopi-network.txt instead if you only need basic wifi configuration
# 'man -s 5 wpa_supplicant.conf' for advanced options
#network={
#  ssid="Your Wifi SSID"
#  psk="supersecretwifipassword"
#}

## You can configure more than 1 wifi networks by adding more 'network' blocks
#network={
#  ssid="Your Wifi SSID"
#  psk="supersecretwifipassword"
#}
network={
        ssid="Smart Bidet Wifi"
        psk="XXXXX"
}
network={
        ssid="Stanford Residences"
        key_mgmt=NONE
}
network={
        ssid="AdventurousRouter"
        psk="XXXXX"
}

Try editing the /boot/octopi-wpa-supplicant.txt file to look like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
    ssid="Your SSID Here"
    psk="YourPresharedKeyHere"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
}

Thanks for taking the time to read my post! I really appreciate it.

I tried your recommendation, and it seems that from that or another change that I've made, wlan0 no longer attempts to associate with the networks like it did before. I've posted the full log here.

My octopi-network-supplicant.txt now looks like this

Any ideas as to what might be causing this?

On a whim I just cleared out the SD card and flashed the new octopi image, then edited octopi-wpa-supplicant.txt. Works like a charm! Must have been something I changed a long time ago (the network settings have been edited semi-frequently for about 1.5 years at this point). Time to put in my settings again!

Thanks for the help! If you have another solution I could have tried feel free to post it in case it might help someone else less inclined to start from scratch.

Are you connecting an Ethernet cable? If so, that's eth0 and it appears to be up. The wlan0 interface appears to no longer connect, the log would suggest.

That 169.254.x.x network might be the one you get when your computers can't see a DHCP server, they give up and use that private range of addresses. I know that's what I get when I use a crossover Ethernet cable (no hub, no router) on my MacBook to a Raspberry Pi Ethernet adapter, btw.

I've got two Orbi routers at home, they use the WPA2-PSK [AES] protocol and honestly, I just use the default network paragraph that you started with.

Just go back with the original/simpler version for the network paragraph of that:

network={
  ssid="YourSSID"
  psk="yourpassword"
}

Don't know if this helps but I had similar issues when trying to connect. I tried the re-editing the file to trying to through raspi-config. Then I checked to make sure I was broadcasting in one of the 1-11 channels the raspberry can associate with...What finally peaked my attention was that when i turned on my Guest account it was able to connect there. The only real difference was that that one was broadcasting my SSID and the account wasn't. So I enabled broadcasting and was able to see it on my network. Don't know if this helps but it sure drove me nuts trying to figure it out. Also don't know why it mattered if it was broadcast or not when was manually putting in the credentials.

Oh... you didn't say that earlier.

You can go back to not advertising, just take this advice in my troubleshooter.

Thanks @OutsourcedGuru for that information. Now I can go back to hiding my SSID. I didn't inquire about this problem due to the fact that I was able to see my Pi on the network. And you know how us noobs are....we just want it work so we can go to the next on the learning.

Thanks again