Cannot connect to WPA and Open Network

Asked by Penny Chiu on 2019-12-02

I found some issues, so I am tracing netcfg source code which is downloaded from

I saw netcfg.c has defined the state machine in main loop. Depend on different state, the network interface will be up/down. For example, config a WPA wireless network and with DHCP method, I list the state flow, and the wlan0 status after this state as below:
1. GET_INTERFACE (wlan0 down)
2. WCONFIG (no change)
3. WCONFIG_ESSID (wlan0 is up first. If choose essid from the list, wlan0 will be down; if choose enter essid manually, wlan0 will keep up)
5. WCONFIG_WPA (no change)
6. START_WPA (no change)
7. GET_METHOD (no change)
8. GET_DHCP (wlan0 up)

The issue I encountered is choosing essid from the list, wlan0 will be down, so I could see the below errors in syslog during START_WPA state:

Dec 2 04:37:11 localhost netcfg[8076]: INFO: buf = wpa_state=INTERFACE_DISABLED#012address=00:16:01:80:8a:47#012uuid=c9148e48-dd38-516c-80e
Dec 2 04:37:51 localhost netcfg[8076]: message repeated 8 times: [ INFO: buf = wpa_state=INTERFACE_DISABLED#012address=00:16:01:80:8a:47#0]
Dec 2 04:37:53 localhost wpa_supplicant[4114]: wlan0: CTRL-EVENT-SCAN-FAILED ret=-100

And this causes the configuration is failed. But if I choose enter essid manually, it will be successful because wlan0 keeps up during START_WPA state.

My first question is: Why not keeping the wlan0 is up for both use cases because it needs to send commands to wpa_supplicant daemon during START_WPA state?

Another example is setting Open Network. I choose ‘Open Network’ and left wep key as blank. From syslog, I didn’t see the association with access point during WCONFIG_WEP state. Is this expected?
It will be failed due to wlan is carrier down:

Dec 2 05:22:48 localhost netcfg[6898]: DEBUG: State is now 0
Dec 2 05:22:48 localhost netcfg[6898]: DEBUG: Want link on wlan0
Dec 2 05:22:48 localhost netcfg[6898]: INFO: Waiting time set to 3
Dec 2 05:22:49 localhost netcfg[6898]: INFO: ethtool-lite: wlan0: carrier down
Dec 2 05:22:50 localhost netcfg[6898]: message repeated 5 times: [ INFO: ethtool-lite: wlan0: carrier down]

My second question is: Is this expected without association with access point before doing DHCPDISCOVER?

Thanks a lot.

Question information

English Edit question
Ubuntu netcfg Edit question
No assignee Edit question
Last query:
Last reply:

What is the output of:

sudo lshw -C network; lsb_release -a; uname -a


Penny Chiu (pchiu) said : #2

       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: eth0
       version: 15
       serial: 00:04:4b:cc:2e:49
       size: 10Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8168 driverversion=8.045.08-NAPI duplex=half latency=0 link=no multicast=yes port=twisted pair speed=10Mbit/s
       resources: irq:406 ioport:1000(size=256) memory:13004000-13004fff memory:13000000-13003fff
       description: Wireless interface
       product: WLI-U2-KG54
       vendor: Buffalo
       physical id: 3
       bus info: usb@1:2.2.3
       logical name: wlan0
       version: 0.01
       serial: 00:16:01:80:8a:47
       capabilities: usb-2.00 ethernet physical wireless
       configuration: broadcast=yes driver=rt2500usb driverversion=4.9.140-tegra firmware=N/A link=no maxpower=400mA multicast=yes speed=480Mbit/s wireless=IEEE 802.11
       description: Ethernet interface
       physical id: 3
       logical name: rndis0
       serial: fe:99:ee:1d:5f:f1
       capabilities: ethernet physical
       configuration: broadcast=yes driver=g_ether driverversion=29-May-2008 firmware=tegra-xudc link=yes multicast=yes
       description: Ethernet interface
       physical id: 4
       logical name: usb0
       serial: fe:99:ee:1d:5f:f3
       capabilities: ethernet physical
       configuration: broadcast=yes driver=g_ether driverversion=29-May-2008 firmware=tegra-xudc link=yes multicast=yes
       description: Ethernet interface
       physical id: 5
       logical name: l4tbr0
       serial: fe:99:ee:1d:5f:f1
       capabilities: ethernet physical
       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip= link=yes multicast=yes
  *-network:3 DISABLED
       description: Ethernet interface
       physical id: 6
       logical name: dummy0
       serial: 46:1a:14:65:74:19
       capabilities: ethernet physical
       configuration: broadcast=yes driver=dummy driverversion=1.0

Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic

Linux localhost.localdomain 4.9.140-tegra #7 SMP PREEMPT Thu Nov 28 14:01:51 CST 2019 aarch64 aarch64 aarch64 GNU/Linux

Can you help with this problem?

Provide an answer of your own, or ask Penny Chiu for more information if necessary.

To post a message you must log in.