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


Recommended Posts

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

Link to post
Share on other sites
Donate and support the project!

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

 

Link to post
Share on other sites

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...