Jump to content

AlfaWise H96 Pro+ Armbian Development Headless Server Setup


koakh

Recommended Posts

This is a quick notes post for people that want to setup Armbian on AlfaWise H96 Pro+ eMMC and use it as a Headless Server for Docker Microservices

 

Thanks to @balbes150 @guidol and @Jeycop and all the awsome people of this forum

 

Tech stack used

 

Armbian

- Java 8

- Docker

- Spring Framework/Boot 2.0

- Node Js

- Aurelia Freamework

 

Download Files

 

- Android firmware (Optional, required in case of revert from eMMC flash)

 

- New H96 Pro Plus 7.1.2 firmware download By EBox

 

- Armbian Version

 

Armbian_5.41_S9xxx_Ubuntu_xenial_3.14.29_server_20180305.img

 

Flash SDCard or USBDisk

 

1) use rufus with dd, or linux disks, or dd command to flash above image

 

2) plug SDcard/Usb into Box

 

4) Plug power cable into Box while holding reset button pressed


Note:This step is only required if is the first time boot armbian after flash android firmware.....

 

5) See Armbian booting up

 

8) login with `un:root`, `pw:1234` and configure it

 

7) reboot

 

8) login with root

 

9) start "./install.sh" and wait for finish (5-7 minutes)

 

(WARNING above command flash eMMC, You Lost ANDROID, dont do that if you dont know how to recovery android firmware, or dont want to use eMMC, SKIP to step 14 for the setup with SdCard/Usb Only)

 

10) shutdown with `halt` and remove power cable

 

11) remove SDcard/Usb

 

12) plug power cable in Box, now you should see Armbian booting up without SDCard/Usb

 

13) login to catch ip or scan it with `sudo nmap -sS -p 22 192.168.1.0/24 | grep -a4 -b2 00:80:0F:96:E3:01`. Change to your mac and ip

 

14) SSH To it, and get some info

$ uname -a
Linux amlogic 3.14.29 #114 SMP PREEMPT Mon Mar 5 12:57:46 MSK 2018 aarch64 aarch64 aarch64 GNU/Linux

$ lscpu
lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 2
CPU max MHz: 1512.0000
CPU min MHz: 100.0000
Hypervisor vendor: (null)
Virtualization type: full

Setup WiFi with 3.14 Mali-6 Image Only (The Version that works with Wifi)

 

this required some hacked script to put it to work, lost a few hours to figure it, its not pretty but works after boot and its stable

 

First remove all modules from `/etc/modules` to leave it initialization for `init.d` script

$ cat /etc/modules
#aml_nftl_dev

Next Create a `init.d` hacked script, with some magic and optimized sleeps, without that sleep times or with lower times it wont work, Its very strange that I must load and unload module, and reload again, but its seems the only way to put this working, I know its too strange, and hard to find, maybe someone has a better ways, I belive with some knowledge its easy,

 

Why its working only that way, dont ask me why, I dont care, for me its not pretty, but its hugly and working, Im happy with it, who cares LOL, I dont waste more time for an elegant and pretty solution......

 

move on.....the `init.d` script

$ sudo nano /etc/init.d/wlan

paste

#! /bin/sh
# /etc/init.d/wlan
#
### BEGIN INIT INFO
# Provides:          wlan
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: AlfaWise H96 Pro+ Wireless Boot Script
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.  This example start a
#                    single forking daemon capable of writing a pid
#                    file.  To get other behavoirs, implemend
#                    do_start(), do_stop() or other functions to
#                    override the defaults in /lib/init/init-d-script.
### END INIT INFO

# Some things that run always
touch /var/lock/wlan

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting Wlan Script"
    echo "modprobe wlan"
    /sbin/modprobe wlan
    echo "modprobe wlan -r in 28sec..."
    sleep 28
    /sbin/modprobe wlan -r
    echo "modprobe lan in 28sec..."
    sleep 28
    echo "modprobe wlan..."
    /sbin/modprobe wlan
    ;;
  stop)
    echo "Stopping script wlan"
    /sbin/modprobe wlan -r
    ;;
  *)
    echo "Usage: /etc/init.d/wlan {start|stop}"
    exit 1
    ;;
esac

exit 0

Install systemd service

$ sudo chmod 755 /etc/init.d/wlan
$ sudo systemctl enable wlan

Reboot

$ sudo reboot

Configure wireless with nmtui

$ sudo nmtui

$ ifconfig wlan
wlan0 Link encap:Ethernet HWaddr 84:5d:d7:??:??:??
inet addr:192.168.1.177 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::865d:d7ff:fe4a:3202/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3246 (3.2 KB) TX bytes:1556 (1.5 KB)

check configs saved from nmtui

$ ls /etc/NetworkManager/system-connections/ -la
total 12
drwxr-xr-x 2 root root 4096 Mar 29 18:42 .
drwxr-xr-x 8 root root 4096 Mar 5 10:24 ..
-rw------- 1 root root 419 Mar 29 18:42 scWF_WDS1

$ sudo cat /etc/NetworkManager/system-connections/scWF_WDS1

> Note: If Problems arrise using WiFi, with/without eth0 cable, try disable eth0 with `sudo ifdown eth0`, sometimes the connection is linked somehow to ethernet to prevent this kinds of problems disable ethernet or boot without cable connected

$ sudo reboot

After reboot inspect unload/load driver with

$ sudo tail -f /var/log/syslog | grep wlan
Mar 29 18:42:25 localhost dnsmasq[4152]: using nameserver 192.168.1.10#53(via wlan0)
Mar 29 18:42:25 localhost nm-dispatcher: req:1 'up' [wlan0]: new request (1 scripts)
Mar 29 18:42:25 localhost nm-dispatcher: req:1 'up' [wlan0]: start running ordered scripts...
Mar 29 18:42:28 localhost ntpd[3533]: Listen normally on 8 wlan0 192.168.1.177:123

In other PC ping the wifi IP and wait it responds without do anything, here it starts respond after 2:18 (with usb stick) minutes:seconds, not bad since reboot, shutdown and boot, and with time delays for wifi 

 

some info after login

$ cat /etc/modules
#aml_nftl_dev

$ lsmod
Module Size Used by
wlan 3435325 0
zram 8953 8
cfg80211 415017 1 wlan

Update and Install Stuff

$ sudo apt update && sudo apt upgrade
$ sudo apt install docker.io docker-compose samba openvpn lshw hwinfo

$ docker -v
Docker version 1.13.1, build 092cba3

$ docker-compose -v
docker-compose version 1.8.0, build unknown

Configure Samba

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_ORG
sudo nano /etc/samba/smb.conf

paste above

[users]
comment = All users
path = /home
read only = No
inherit acls = Yes
veto files = /aquota.user/groups/shares/

[root]
comment = Root
path = /
writable = yes
printable = no
write list = root
browseable = no

add a user

$ sudo smbpasswd -a USERNAME
# start service
$ sudo systemctl restart smbd
# enable service
$ sudo systemctl enable smbd.service

Install Java 8 (Optional currently using Docker Containers, but it may be usefull for running quick prototype protects)

$ sudo -i
$ sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
$ sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

#####Important########
To set Oracle JDK8 as default, install the "oracle-java8-set-default" package.
E.g.: sudo apt install oracle-java8-set-default
On Ubuntu systems, oracle-java8-set-default is most probably installed
automatically with this package

$ sudo apt install oracle-java8-set-default

$ java -version
java version "1.8.0_161"

Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

Create docker-compose.yml to run and test my Spring-Boot IoT Project in Arm64v8 Arquitecture

 

Note: this step is ommited, it simply is a docker-compose file to test my IOT project, with four docker arm64v8 container microservices,

 

- Spring Boot Rest Api /Arm64V8

- Spring Boot Moquette/Mqtt Mongo Server with Auth and ACL

- Aurelia Framework / NodeJS WebApp / Mqtt.js Client / Chart.js

- Mongo DB

 

if someone like to test it with a ESP8266 tell me and paste here the docker-composer.yml 

 

move on

 

Backup Image

 

Use the DD command to create image of `/dev/boot` and `/dev/system`

  

Create a mount point to house images, using a samba share here to //192.168.1.1/root, one can use a spare disk or other media

$ sudo nano fstab

add //192.168.1.1/root /mnt/koakhserver cifs username=${USER},password=${PASSWORD},_netdev,noauto 0 0 to the bottom

#/var/swap none swap sw 0 0
#/dev/root / auto noatime,errors=remount-ro 0 1
#proc /proc proc defaults 0 0
/dev/root / ext4 defaults,noatime,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,nosuid 0 0

//192.168.1.1/root /mnt/koakhserver cifs username=${USER},password=${PASSWORD},_netdev,noauto 0 0

Backup eMMC

$ sudo mkdir /mnt/koakhserver -p
$ sudo mount /mnt/koakhserver

$ sudo dd if=/dev/boot of=/mnt/koakhserver/mnt/1tbdisk2/devices/microcomputers/boot.img bs=1024k status=progress
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 3.3319 s, 10.1 MB/s

$ sudo dd if=/dev/system of=/mnt/koakhserver/mnt/1tbdisk2/devices/microcomputers/system.img bs=1024k status=progress
2146435072 bytes (2.1 GB, 2.0 GiB) copied, 150.027 s, 14.3 MB/s
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 197.892 s, 10.9 MB/s

when we need to restore use the reverse process

$ sudo mount /mnt/koakhserver/
$ sudo dd if=/mnt/koakhserver/mnt/1tbdisk2/devices/microcomputers/boot.img of=/dev/boot bs=1024k status=progress
$ dd if=/mnt/koakhserver/mnt/1tbdisk2/devices/microcomputers/system.img of=/dev/system bs=1024k status=progress

Done......I Think I dont forget nothing.....................

 

Thanks to all

Link to comment
Share on other sites

On 8/23/2018 at 11:39 PM, gnthibault said:

Thanks for the post! Did you manage to find a working dtb for kernel 4.18 ? 

meson-gxm-q200.dtb works for me, but only with ubuntu xenial headless. I could not boot ubuntu bionic headless with it. I also didn't try distributions with desktop

Link to comment
Share on other sites

Hum... Actually nothing worked. I was not able to boot with meson-q200.dtb on any of the image I tested from there: https://yadi.sk/d/pHxaRAs-tZiei/5.55/20180817

I tested:

Armbian_5.55_Aml-s9xxx_Debian_stretch_default_4.18.0_20180817.img

Armbian_5.59_Aml-s9xxx_Ubuntu_bionic_default_4.18.0_desktop_20180829.img
Armbian_5.55_Aml-s9xxx_Ubuntu_xenial_default_4.18.0_20180817.img

 

But not even the headless Ubuntu bionic booted successfully. Are you sure that you used the version with 4.18 kernel, or did you actually used the 3.14 version ? (This one always worked for me, but I think it crashes with some usb_modeset related modules)

Link to comment
Share on other sites

20 hours ago, gnthibault said:

Are you sure that you used the version with 4.18 kernel

100% because I could not find working dtb for 3.14 . But, now after googling a bit, I think we have different models - I have H96 Pro without + and in spite of same specs it looks slightly different than yours, so maybe that's why. Does yours have 1000M Ethernet or 100M? As far as I know all s912 with 1000M fall under gxm-q200 category, and all 100M should be gxm-q201

Link to comment
Share on other sites

H96 pro+ features 1000Mb ethernet network inferface.

 

Maybe I am doing aomething wrong.

When I got my SD card ready, I just copy the meson-q200.dtb from dtb directory (the one that starts with amlogic S9xx) to /boot without renaming and without changing acces rights. Is it ok ?

 

I'll try to check with q201 asap. Thanks for your help

Link to comment
Share on other sites

1 hour ago, gnthibault said:

 I just copy the meson-q200.dtb from dtb directory (the one that starts with amlogic S9xx) to /boot without renaming and without changing acces rights. Is it ok ?

Oh no pal, of course it is not ok. You should always rename it to dtb.img - that explains why 3.14 worked. It just took dtb from android on emmc and it did work because android on this box has same 3.14 kernel

Link to comment
Share on other sites

i use meson-gxm-khadas-vim2.dtb also work with my h96pro+  3g/32g (cs-s32 v3)

Armbian_5.59_Aml-s9xxx_Debian_stretch_default_4.18.0_20180829

i don't care about wifi issue because i just run it as a proxy server to passthrough china GFW

 

btw , did anyone try to install wireguard into h96pro+ ?

i try it but fail to start because missing correct kernel-header package

 

"modprobe: FATAL: Module wireguard not found"

 

how to solve it ?

Link to comment
Share on other sites

32 minutes ago, psxsnake said:

The link are outdated, how can i proceed?

 

It isn't outdated. Do what is written in the post above. 
Download the image, read carefully all the instructions. Choose the correct dtb file. 

 

Link to comment
Share on other sites

4 minutes ago, NicoD said:

It isn't outdated. Do what is written in the post above. 

I cant find the image listed

Armbian_5.41_S9xxx_Ubuntu_xenial_3.14.29_server_20180305.img

i have a page with 3 folder in one there are more image with different name and size

ok you sent new link

what is DTB?

Link to comment
Share on other sites

1 minute ago, psxsnake said:

Armbian_5.41_S9xxx_Ubuntu_xenial_3.14.29_server_20180305.img

 

Why would you want to use a 2 year old image? Those are outdated images. Just use a recent image and adjust the dtb for your device. 

Link to comment
Share on other sites

10 minutes ago, NicoD said:

Why would you want to use a 2 year old image? Those are outdated images. Just use a recent image and adjust the dtb for your device. 

yes yes I saw after

what is the difference from

eoan

bullseye

bionic

buster

?

thanks

Link to comment
Share on other sites

  • Werner locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines