STAGE 2: Radxa Zero 2 Pro with minimal Armbian image (1/4) - First add wifi
Add wifi to your super speedy minimalist Armbian os running on the mighty Radxa Zero 2 Pro
5/13/20244 min read


Ok so you installed the minimalist Armbian OS to max out the power you can get from your Radxa Zero 2 Pro ...
BUT
No desktop, no wifi, no ethernet, what about headless ?
Sure you can use the device as is, but if you want to maybe make a nicer environment to code in or work on GPIO stuff then we need to add some features.
1) Boot the device with keyboard, mouse and screen attached and get to the bash prompt
2) Set up a temporary static IP address so enable access to the internet and downloading of isc-dhcp-client
As key dynamic IP assignment scripts are missing from the minmal instalation you have we need to create a temporary static IP address in order to access the internet and download some additional Armbian compoanets.
Check you can see your wireless adapater on the radxa Zero 2 pro
sudo iwconfig
This should report that wlan0 is present and give you some key details
Check that wireless-tools and wpasupplicant are present (they both should already be installed) by ...
sudo apt install wireless-tools
sudo apt install wpasupplicant
It is likely that wlan0 is DOWN (see the iwconfig report) so we need to get it up ...
sudo ip link set wlan0 up
Next add some details about your wifi access point or router (the box that you link to for your wifi)
wpa_passphrase "SSID" "password" | sudo tee /etc/wpa_supplicant.conf
Replace "SSID" with the name of your wifi connection and "password" with your password. Note that later in the proceedings you probably want to look carefully at permissions if you are storing that password, but for now lets get it up and running.
Now we need to set up a config file where the drivers can find the info to log on to your wifi network ...
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
Next add a temporary static IP address on your local network. Check the IP address on other devices and pick a number not used (you may need to check your router for used addresses) ... you will probably end up with something like 192.168.0.x or 192.168.1.x depending on how your router is configured.
sudo ip addr add 192.168.x.x/yy dev wlan0
Replace x with the IP address you chose and yy with the subnet mask yy = 24 if the subnet mask is 255.255.255.0 and 16 if it is 255.255.0.0 - again check other devices if you aren't sure or your router.
Add a gateway (the Ip address of your access-point or router) which is typically 192.168.0.1 or 192.168.1.1
sudo ip route add default via 192.168.x.x
Add some places to look for maps of the internet (google is a good one) into a config file
sudo nano /etc/resolv.conf
There will already be some nameservers in here, so just add these to the list with your nano editor
nameserver 8.8.8.8
nameserver 8.8.4.4
Save your changes.
All should now work, test it with ...
ping google.com
3) Use the temporary static IP address to download additional components form the internet and change to a more common dynamicaly assigned IP address set-up
Grab the dynamic IP assignment scripts from the internet relating to Armbian
sudo apt install isc-dhcp-client
Now you can remove the static IP address
sudo ip addr del 192.168.x.x/24 dev wlan0
x.x. is simply the numbers you picked for your temporary static IP address
Finally enable dynamic IP setting
sudo dhclient wlan0
4) OK you are done but you need to make this persistent (Wifi will work when you reboot) ... but first time to update and upgrade your OS ... don't reboto after this until you finish 5)
As you have access now to the internet update and upgrade
sudo apt update
sudo apt upgrade
Don't reboot yet ...
5) How to make this all persistent so it works every time you boot up automatically
It seems this version of Armbian uses netplan and not NetworkManager to configure persistent networking access so ... we need to create a configuration file for netplan
Now we find netplan to be particularly irritating to script for as indention is super critical - DON'T use TAB !!! Each indention is exactly 2 spaced ! If you deviate from this you will spend hours trying to debug the configuration file script.
Create the config file which starts on boot ...
sudo nano /etc/netplan/01-netcfg.yaml
Type in this honouring the indents are 2 spaces and not tabs
network:
version: 2
renderer: networkd
wifis:
wlan0:
dhcp4: yes
access-points: "SSID":
password: "your-password"
You will need to add your wifi SSID and the password you use to log onto it inside the quotes.
Next you will need to move other competing config files for dhcp and ethernet as there appear to be dìsome defaults setup which also run at boot time and compete with your nice script.
Check the /etc/netplan/ directory
We found two other .yaml files 20-eth-fixed-mac.yaml and 10-dhcp-all-interfaces.yaml so just change their filename by adding .bck at the end to prevent them from running
Next apply your new netplan script
sudo netplan apply
You may get a warning about permissions which seems to be erroneous as we changed the permissions as instructed by the warning but still got the same warning, so we guess you can ignore this.
This is it - a lot of instructions, but simple to do ... just reboot and you will have wifi automatically active and stable so we can now add a super light-weight desktop manager and GUI !
Support
Connect
contact@bestsbcnow.com
All information on this site is provided as is. Use at your own risk.
© 2024. All rights reserved.