Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[solved] Headless wifi setup - conflict between NetworkManager and /etc/network/interfaces

Featured Replies

Hi,

 

I have few boards that were once connected to wifi manually, but now are headless. I would like now to upgrade Armbian and put wifi connection during sd card flash.

 

Tried the classic way: /etc/network/interfaces

 

Quote

auto wlan0
iface wlan0 inet dhcp
        wpa-ssid wifi
        wpa-psk 12345678

 

When the board boots it connects to the wifi, I see few pings and then it goes offline

 

After taking one of the boards for troubleshooting using serial console I found that NeworkManager starts right after the network is up and screws everything:


 

Quote

 

Feb 10 04:59:33 orangepilite wpa_supplicant[526]: wlan0: Trying to associate with f8:d1:11:11:ee:c4 (SSID='wifi' freq=2412 MHz)
Feb 10 04:59:33 orangepilite wpa_supplicant[526]: wlan0: Associated with f8:d1:11:11:ee:c4
Feb 10 04:59:33 orangepilite wpa_supplicant[526]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Feb 10 04:59:33 orangepilite wpa_supplicant[526]: wlan0: WPA: Key negotiation completed with f8:d1:11:11:ee:c4 [PTK=CCMP GTK=TKIP]
Feb 10 04:59:33 orangepilite wpa_supplicant[526]: wlan0: CTRL-EVENT-CONNECTED - Connection to f8:d1:11:11:ee:c4 completed [id=0 id_str=]

...snip...

 

Feb 10 04:59:36 orangepilite NetworkManager[669]: <info>  [1549774776.5293] supplicant: wpa_supplicant running
Feb 10 04:59:36 orangepilite NetworkManager[669]: <info>  [1549774776.5297] device (wlan0): supplicant interface state: init -> starting
Feb 10 04:59:36 orangepilite wpa_supplicant[665]: ctrl_iface exists and seems to be in use - cannot override it
Feb 10 04:59:36 orangepilite wpa_supplicant[665]: Delete '/run/wpa_supplicant/wlan0' manually if it is not used anymore
Feb 10 04:59:36 orangepilite wpa_supplicant[665]: Failed to initialize control interface '/run/wpa_supplicant'.
                                                  You may have another wpa_supplicant process already running or the file was
                                                  left by an unclean termination of wpa_supplicant in which case you will need
                                                  to manually remove this file before starting wpa_supplicant again.

Feb 10 04:59:36 orangepilite wpa_supplicant[665]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Feb 10 04:59:36 orangepilite NetworkManager[669]: <error> [1549774776.7041] sup-iface[0x1ff0890,wlan0]: error adding interface: wpa_supplicant couldn't grab this interface.
Feb 10 04:59:36 orangepilite NetworkManager[669]: <info>  [1549774776.7052] device (wlan0): supplicant interface state: starting -> down

 

Executing sudo ifdown wlan0 && sudo ifup -v wlan0 restores the connection

 

My question is: what is the correct way to put wifi configuration on the sd card of a headless Armbian installation?

 

Thanks

from this link you can try this way :

 

nano /etc/wpa_supplicant.conf

ap_scan=1 

ctrl_interface=/var/run/wpa_supplicant

network={ ssid="xxxxxx" 

scan_ssid=1 

psk="yyyyyyy"

}

added to /etc/network/interfaces

auto wlan0 

iface wlan0 inet dhcp

pre-up sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dnl80211 

post-down sudo killall -q wpa_supplicant

 

  • Author

Thanks for the idea

 

I found this solution to be more compatible: /etc/NetworkManager/NetworkManager.conf
 

Quote

 

--- /etc/NetworkManager/NetworkManager.conf.bak 2019-02-10 04:57:51.988000067 +0000
+++ /etc/NetworkManager/NetworkManager.conf     2019-04-16 11:14:51.616145076 +0000
@@ -4,7 +4,7 @@
 plugins=ifupdown,keyfile

 [ifupdown]
-managed=true
+managed=false

 [device]
 wifi.scan-rand-mac-address=no

 

Source: https://wiki.debian.org/NetworkManager#Wired_Networks_are_Unmanaged

  • Author

The `ifupdown` method to connect a headless device no longer works with the latest Armbian 21.02.3. For some reason the interface remains down and requires manual `sudo ifup -v wlan0`

`rc.local` does not start as there is root password change prompt blocking it

Anyone knows what do I need to change to start wlan0 on boot? Or any other way to configure network on a device without HDMI?

Thanks

  • Author

UPDATE

I have set up a fresh sd card to investigate and collect logs, but this time `ifupdown` worked :)
Probably it was some typo I made in /etc/network/interfaces during setup

 

Also, a note for future myself when I visit this thread again, there is a way to create the connection through `armbian_first_run.txt`. I tested and it worked. So, probably, better to switch to this way to have less conflicts between Network Manager and ifupdown

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.