0
miha

Configuring WiFi ready before 1st boot?

Recommended Posts

I have problem, I am not able to get console working to access my nanopi neo air. PSU is not issue, opi+2 runs with same power w/o issues. Sdcard is not problem either. Tested with more than one image and based on how onboard leds behaves, i believe that system boots up ok. Now the question: How to modify image on sdcard so that it connects to my WIFi (WPA2-PSK) on boot automatically making ssh to nano working? Or should I mount image, before writing to sdcard, and do the needed changes inside mounted image? What and how? Thanks!

Share this post


Link to post
Share on other sites

Well, still no success. Added to /etc/cron.d/armbian-updates line

@reboot root /root/script.sh

 

And script has permissions 755 and content:

#!/bin/bash
touch /root/file
df >> /root/file
ifconfig -a >> /root/file
ls -R / >>/root/file
cat /proc/cpuinfo >>/root/file
cat /proc/meminfo >>/root/file
lsusb -vvv >>/root/file

 

Booted nanopi up with sdcard and I let nanopi running  hours before switching power off. The file is not created.

 

is it so that crond is not enabled on 1st boot? I'll need to check this. I may need to test with another sdcard although I think that it's not the problem because opi+2 and raspi3 boots up w/o issues on that card.

 

EDIT:

Changed script to:

 

#!/bin/bash
/bin/touch /root/file
/bin/df >> /root/file
/sbin/ifconfig -a >> /root/file
/bin/ls -R / >>/root/file
/bin/cat /proc/cpuinfo >>/root/file
/bin/cat /proc/meminfo >>/root/file
/usr/bin/lsusb -vvv >>/root/file

Share this post


Link to post
Share on other sites

You can try adding this (before exit 0):

sleep 10 # just in case since this is a dirty workaround
nmcli device wifi connect UUID
echo "password"| nmcli --ask c up UUID

to your /etc/rc.local and Wifi network should be established.

BTW: serial console looks like this on Windows, when powering/connecting via the OTG USB port:

windows-pi-usb.png
 

Share this post


Link to post
Share on other sites

New power (2.4A), new sdcard (Sandisk Ultra 32GB) and arduino (reset connected to gnd) acting as USB2UART, providing connection for OSX-software Serial.

And Arduino connected to Debug UART-ports on nanopi neo air. TX/RX/GND. Speed 115200, Data bits 8, Parity None, Stop bits 1

 

Attached output. Proves that my nanopi neo air is not completely dead.

 

neo_air_boot_miha.txt

Share this post


Link to post
Share on other sites

Added following line to /etc/rc.local, just above the exit 0:

nmcli dev wifi connect "mySSID" password "mypwd"

 

And device connects to wifi automatically after reboot. More elegant solution is needed but this is good for now. I need to figure out also how to connect two different wifi's, depending on location home/work automatically. Plan is to use nanopi with batteries as movable air quality measuring station. Thank Igor for you help!

Share this post


Link to post
Share on other sites

yes, I'll give a try for nightly builds for sure. I let neo air run during the night and now nmap does not show neon air on net anymore. Does anyone know how to wire UART from neo air for example to OPI+2's GPIO so that I can drop arduino? 

Share this post


Link to post
Share on other sites
On 6.1.2018 at 1:15 PM, miha said:

Now the question: How to modify image on sdcard so that it connects to my WIFi (WPA2-PSK) on boot automatically making ssh to nano working?

 

Set up a Wi-Fi connection as root with network manager on your other board (OPi Plus 2?). Copy the created profile below /etc/NetworkManager/system-connections/ to the image of your NEO Air. Done. If you want to support more than one location, add as many profile files as necessary.

 

I do this all the time since 18 months now and it works always. Only thing you have to take care of: NM has to create a profile that is useable by all users (then Wi-Fi connection is established at boot). If you fail here then the Wi-Fi connection will be activated only after login which renders the whole attempt useless.

Share this post


Link to post
Share on other sites

Installed Welcome to ARMBIAN 5.37.180110 nightly Debian GNU/Linux 9 (stretch) 4.14.13-sunxi

 

Now trying to get bluetooth working, have two RuuviTags to connect

 

root@nanopiair:~# systemctl status ap6212-bluetooth
● ap6212-bluetooth.service - LSB: Patch firmware for ap6212 adapter
   Loaded: loaded (/etc/init.d/ap6212-bluetooth; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-01-11 16:31:55 UTC; 7min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 464 ExecStart=/etc/init.d/ap6212-bluetooth start (code=exited, status=1/FAILURE)

Jan 11 16:31:55 nanopiair systemd[1]: Starting LSB: Patch firmware for ap6212 adapter...
Jan 11 16:31:55 nanopiair ap6212-bluetooth[464]: sh: echo: I/O error
Jan 11 16:31:55 nanopiair ap6212-bluetooth[464]: Can't get port settings: Input/output error
Jan 11 16:31:55 nanopiair ap6212-bluetooth[464]: Can't initialize device: Input/output error
Jan 11 16:31:55 nanopiair ap6212-bluetooth[464]: Can't get device info: No such device
Jan 11 16:31:55 nanopiair systemd[1]: ap6212-bluetooth.service: Control process exited, code=exited status=1
Jan 11 16:31:55 nanopiair systemd[1]: Failed to start LSB: Patch firmware for ap6212 adapter.
Jan 11 16:31:55 nanopiair systemd[1]: ap6212-bluetooth.service: Unit entered failed state.
Jan 11 16:31:55 nanopiair systemd[1]: ap6212-bluetooth.service: Failed with result 'exit-code'.
 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
0