balena-os / wifi-connect

Easy WiFi setup for Linux devices from your mobile phone or laptop
Apache License 2.0
1.28k stars 356 forks source link

wifi-connect giver error on Orange Pi Zero / Armbian Stretch #303

Open jbrepogmailcom opened 5 years ago

jbrepogmailcom commented 5 years ago

pi@orangepizero:~$ sudo ./wifi-connect WiFi device: wlan0 [wifi_connect::network:WARN] No access points found - giving up... Starting access point... [network_manager::dbus_api:ERROR] org.freedesktop.NetworkManager::AddAndActivateConnection method call failed on /org/freedesktop/NetworkManager Error: Creating the captive portal failed caused by: D-Bus failure: org.freedesktop.NetworkManager::AddAndActivateConnection method call failed on /org/freedesktop/NetworkManager caused by: D-Bus failure: Method call failed after 10 retries

majorz commented 5 years ago

DId you succeed in running wifi-connect on your setup? From the logs I see that NetworkManager is not being able to find any networks. This possibly indicates driver issues. What is the output of nmcli d wifi?

mklomp commented 4 years ago

I had the same error on the OrangePi Zero LTS. I got it working by:

$ sudo nmcli radio wifi on && sudo rfkill unblock wlan $ sudo apt install dnsmasq

mtrewartha commented 4 years ago

I've got the same issue on my Balena Fin (running balenaOS) this morning. Here are the details of my setup:

Here are the logs that are being printed out. This is just one snippet from logs that show this repeated over and over. It seems like the only thing wrong is that the D-Bus call to AddAndActivateConnection fails.

[Logs]    [11/13/2019, 8:26:35 AM] [gateway] Waiting for connectivity....
[Logs]    [11/13/2019, 8:27:35 AM] [gateway] No connection found. Starting WiFi Connect...
[Logs]    [11/13/2019, 8:27:35 AM] [gateway] WiFi device: uap0
[Logs]    [11/13/2019, 8:27:45 AM] [gateway] [wifi_connect::network:WARN] No access points found - giving up...
[Logs]    [11/13/2019, 8:27:45 AM] [gateway] Starting access point...
[Logs]    [11/13/2019, 8:27:55 AM] [gateway] [network_manager::dbus_api:ERROR] org.freedesktop.NetworkManager::AddAndActivateConnection method call failed on /org/freedesktop/NetworkManager
[Logs]    [11/13/2019, 8:27:55 AM] [gateway] Error: Creating the captive portal failed
[Logs]    [11/13/2019, 8:27:55 AM] [gateway]   caused by: D-Bus failure: org.freedesktop.NetworkManager::AddAndActivateConnection method call failed on /org/freedesktop/NetworkManager
[Logs]    [11/13/2019, 8:27:55 AM] [gateway]   caused by: D-Bus failure: Method call failed after 10 retries
[Logs]    [11/13/2019, 8:27:55 AM] Service exited 'gateway sha256:fe302f0580293c9c5b91a5945d72dfebd5fb1f313c857c2fc8bce9893706f493'
[Logs]    [11/13/2019, 8:27:57 AM] Restarting service 'gateway sha256:fe302f0580293c9c5b91a5945d72dfebd5fb1f313c857c2fc8bce9893706f493'

Here's the nmcli d wifi output:

root@44dd23f:~# nmcli d wifi
IN-USE  SSID                           MODE   CHAN  RATE        SIGNAL  BARS  SECURITY  
        Trewartha WiFi                 Infra  9     130 Mbit/s  100     ****  WPA2      
        --                             Infra  9     130 Mbit/s  100     ****  WPA2      
        Trewartha WiFi                 Infra  36    270 Mbit/s  100     ****  WPA2      
        Trewartha WiFi                 Infra  3     130 Mbit/s  75      ***   WPA2      
        --                             Infra  3     130 Mbit/s  74      ***   WPA2      
        Trewartha WiFi                 Infra  36    270 Mbit/s  70      ***   WPA2      
        Trewartha WiFi                 Infra  9     130 Mbit/s  67      ***   WPA2      
        --                             Infra  9     130 Mbit/s  67      ***   WPA2      
        Trewartha WiFi                 Infra  161   270 Mbit/s  62      ***   WPA2      
        Trewartha WiFi                 Infra  161   270 Mbit/s  44      **    WPA2      
        Mark's Wi-Fi Network           Infra  6     195 Mbit/s  27      *     WPA2      
        India1                         Infra  6     130 Mbit/s  27      *     WPA2      
        Sivinet2                       Infra  11    195 Mbit/s  25      *     WPA1 WPA2 
        Sivinet                        Infra  11    195 Mbit/s  22      *     WPA2      
        --                             Infra  36    130 Mbit/s  20      *     WPA2      
        MySpectrumWiFi48-2G            Infra  1     195 Mbit/s  19      *     WPA2      
        Network 1031                   Infra  6     195 Mbit/s  19      *     WPA2      
        michon123                      Infra  1     54 Mbit/s   15      *     WPA2      
        DIRECT-11-HP ENVY 5000 series  Infra  1     130 Mbit/s  14      *     WPA2      
        NETGEAR09_EXT                  Infra  6     130 Mbit/s  10      *     WPA1 WPA2 
        MySpectrumWiFi74-2G            Infra  1     540 Mbit/s  9       *     WPA2      
        Pugador-Link                   Infra  10    270 Mbit/s  9       *     WPA2      
        --                             Infra  11    130 Mbit/s  9       *     WPA2      
        MySpectrumWiFi2c-5G            Infra  44    405 Mbit/s  7       *     WPA2      
        --                             Infra  10    130 Mbit/s  4             WPA2      
        MySpectrumWiFic8-2G            Infra  11    195 Mbit/s  4             WPA2      
        bumgl                          Infra  11    195 Mbit/s  4             WPA2      
        NETGEAR-Guest                  Infra  7     130 Mbit/s  2             WPA2      
        WEB-Guest                      Infra  11    195 Mbit/s  2             WPA2      
        NETGEAR86                      Infra  11    195 Mbit/s  2             WPA2      
        MySpectrumWiFi2c-2G            Infra  1     195 Mbit/s  0             WPA2      
        CONFIDENTIAL-2G                Infra  5     195 Mbit/s  0             WPA2      
        Altergott_2G_2GEXT             Infra  11    130 Mbit/s  0             WPA2      
        EvansvilleMN                   Infra  11    130 Mbit/s  0             WPA2      

IN-USE  SSID  MODE  CHAN  RATE  SIGNAL  BARS  SECURITY

Here's my start script:

#!/usr/bin/env bash

# Do an initial check for connectivity
nmcli -t g | grep full

if [ $? -eq 0 ]; then
  printf 'Connected! Starting application...\n'
  cd ../../../app
  <application command>
else
  # If we don't have connectivity, give the OS a minute to try...
  printf 'Waiting for connectivity....\n'
  sleep 1m

  nmcli -t g | grep full

  if [ $? -eq 0 ]; then
    printf 'Connected! Starting application...\n'
    cd ../../../app
    <application command>
  else
    printf 'No connection found. Starting WiFi Connect...\n'
    cd /wifi-connect
    ./wifi-connect
  fi
fi

In case it helps, there's some network configuration in my docker-compose.yml file:

version: 2
services:
  gateway:
    build: ./
    labels:
      io.balena.features.dbus: "1"
    network_mode: host
    privileged: true
    restart: always
    ports:
      - "8883"
    volumes:
      - <a volume>
volumes:
  <a volume name>

I'll see if I can reproduce and if adding sudo nmcli radio wifi on && sudo rfkill unblock wlan to our setup helps.

mtrewartha commented 4 years ago

@majorz In my case, it was an upgrade to balenaOS 2.44.0+rev1 that broke things. Downgrading to 2.38.0+rev1 alleviates the issue. Seems like there's some change in 2.44.0+rev1 that introduced an incompatibility or something...