Install Armbian Debian Server onto NanoPi NEO

Hi, all, I flied back and forth between ShenZhen China and Vancouver Canada in January 2018, and took a holiday break in California USA during Chinese Spring Festival in Febrary 2018. Now, I'm back to Vancouver and write this blog. Today, we are going to talk about how to flash the most recent Linux Kernel onto an NanoPi NEO. The board looks like (cited from NanoPi NEO ):

NanoPi NEO

Different from our previous blog where U-Boot and Linux Kernel are manually built, here, we download and install the built Ubuntu from Armbian directly.

Before starting, the following paragraph is cited to explain the relationships among AllWinner, Sunxi and Linaro.

In march 2014, Allwinner joined Linaro as part of the new linaro digital home group. After this, Allwinner stopped communicating with the sunxi community, as linaro membership apparently satisfies the marketing need to be seen as an open source friendly company. Despite Linaro membership, Allwinner still violates the GPL on many counts. (cited from http://linux-sunxi.org/Allwinner .)

PART A: Install Debian Server Built By Armbian onto NanoPi NEO

1. Download Armbian Debian Server for NanoPi NEO

We FIRST go visiting the website https://www.armbian.com/nanopi-neo/ and click Debian server -- mainline kernel icon, a file named Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.7z will be automatically downloaded.

Then, we extract this .7z file by

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ 7za e Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.7z

7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_CA.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)

Processing archive: Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.7z

Extracting Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.img
Extracting armbian.txt
Extracting armbian.txt.asc
Extracting Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.img.asc
Extracting sha256sum.sha

Everything is Ok

Files: 5
Size: 1396723567
Compressed: 256174798

2. Install Armbian Debian Server for NanoPi NEO

After the extracted image file is prepared, it's the time to install the Armbian Debian Server onto our TF card. We FIRST format the TF card:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ sudo mkfs.ext4 /dev/mmcblk0 
[sudo] password for jiapei:
mke2fs 1.42.13 (17-May-2015)
Found a dos partition table in /dev/mmcblk0
Proceed anyway? (y,n) y
Discarding device blocks: done
Creating filesystem with 3942144 4k blocks and 987360 inodes
Filesystem UUID: bf3f62c9-283d-48fe-a0f3-56ab357f7b94
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done

Afterwards, use dd to install the downloaded Armbian Ubuntu Desktop image.

1
2
3
4
5
$ sudo dd bs=4M if=Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.img of=/dev/mmcblk0 conv=fsync
[sudo] password for jiapei:
333+0 records in
333+0 records out
1396703232 bytes (1.4 GB, 1.3 GiB) copied, 157.712 s, 8.9 MB/s

PART B: Boot Into Armbian, Network Configuration and Armbian Upgrading

As known, NanoPi NEO comes with NEITHER a HDMI interface for display, NOR a Wifi interface for wireless network connection. Therefore, we may have to find a wired cable, and connect our NanoPi NEO to a router, which also connects with our host computer. Afterwards, we'll have to find our NanoPi NEO connection via router settings. Here in my case, I'm using a Cisco DPC3848V DOCSIS 3.0 Gateway, with the gateway IP: 192.168.0.1. By visiting http://192.168.0.1 -> Setup -> LAN Setup -> Connected Devices Summary, you should be able to find out which is the newly connected network device, namely NanoPi NEO.

1. SSH Into NanoPi NEO

Through our host computer, SSH into NanoPi NEO:

1
2
3
4
5
6
$ ssh root@192.168.0.76
The authenticity of host '192.168.0.76 (192.168.0.76)' can't be established.
ECDSA key fingerprint is SHA256:L0qZCYEGGallJo9jSpM63TWAYJ4vU/JzIbMJS80Lx8I.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.76' (ECDSA) to the list of known hosts.
root@192.168.0.76's password:

Then you input 1234 as the password, you'll be asked to change your password right away.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
You are required to change your password immediately (root enforced)
_ _ ____ _ _ _
| \ | | __ _ _ __ ___ | _ \(_) | \ | | ___ ___
| \| |/ _` | '_ \ / _ \| |_) | | | \| |/ _ \/ _ \
| |\ | (_| | | | | (_) | __/| | | |\ | __/ (_) |
|_| \_|\__,_|_| |_|\___/|_| |_| |_| \_|\___|\___/


Welcome to ARMBIAN 5.38 stable Debian GNU/Linux 9 (stretch) 4.14.14-sunxi
System load: 0.07 0.04 0.07 Up time: 15 min
Memory usage: 16 % of 240MB IP: 192.168.0.76
CPU temp: 37°C
Usage of /: 7% of 15G

[ General system configuration (beta): armbian-config ]

New to Armbian? Check the documentation first: https://docs.armbian.com
Changing password for root.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:


Thank you for choosing Armbian! Support: www.armbian.com

And then you will be asked to create a new user account.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Creating a new user account. Press <Ctrl-C> to abort

Please provide a username (eg. your forename): nanopineo
Trying to add user nanopineo
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = (unset),
LC_MEASUREMENT = "en_CA.UTF-8",
LC_PAPER = "en_CA.UTF-8",
LC_MONETARY = "en_CA.UTF-8",
LC_NAME = "en_CA.UTF-8",
LC_ADDRESS = "en_CA.UTF-8",
LC_NUMERIC = "en_CA.UTF-8",
LC_MESSAGES = "en_US.UTF-8",
LC_TELEPHONE = "en_CA.UTF-8",
LC_IDENTIFICATION = "en_CA.UTF-8",
LC_TIME = "en_CA.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Adding user `nanopineo' ...
Adding new group `nanopineo' (1000) ...
Adding new user `nanopineo' (1000) with group `nanopineo' ...
Creating home directory `/home/nanopineo' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for nanopineo
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y

Dear nanopineo, your account nanopineo has been created and is sudo enabled.
Please use this account for your daily work from now on.

root@nanopineo:~#

2. Network Configuration

1) Doublecheck IP address

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
root@nanopineo:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.76 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::dc0b:3cff:fe76:8606 prefixlen 64 scopeid 0x20<link>
ether de:0b:3c:76:86:06 txqueuelen 1000 (Ethernet)
RX packets 1544 bytes 145676 (142.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 667 bytes 63483 (61.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 33

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

2) Modify /etc/network/interfaces

I noticed that when you reboot NanoPi NEO, the IP address changed from time to time. The reason why it is so is because the MAC address of NanoPi NEO change randomly after Armbian reboot. Therefore, it's recommended to manually set a static MAC address for NanoPi NEO in file /etc/network/interfaces.

1
root@nanopineo:~# vim /etc/network/interfaces

Just make sure to uncomment this line hwaddress ether # if you want to set MAC manually and write in a fixed MAC address. The final /etc/network/interfaces for my NanoPi NEO is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
root@nanopineo:~# cat /etc/network/interfaces
source /etc/network/interfaces.d/*

# Wired adapter #1
allow-hotplug eth0
no-auto-down eth0
iface eth0 inet dhcp
#address 192.168.0.100
#netmask 255.255.255.0
#gateway 192.168.0.1
#dns-nameservers 8.8.8.8 8.8.4.4
hwaddress ether d2:d0:78:47:06:b3 # if you want to set MAC manually
# pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838


# Wireless adapter #1
# Armbian ships with network-manager installed by default. To save you time
# and hassles consider using 'sudo nmtui' instead of configuring Wi-Fi settings
# manually. The below lines are only meant as an example how configuration could
# be done in an anachronistic way:
#
#allow-hotplug wlan0
#iface wlan0 inet dhcp
#address 192.168.0.100
#netmask 255.255.255.0
#gateway 192.168.0.1
#dns-nameservers 8.8.8.8 8.8.4.4
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# Disable power saving on compatible chipsets (prevents SSH/connection dropouts over WiFi)
#wireless-mode Managed
#wireless-power off

# Local loopback
auto lo
iface lo inet loopback

And before reboot Armbian, we also need to set a **FIXED** IP address (Here in my case: 192.168.0.36) for the device with the static MAC address you just specified (Here in my case: **d2:d0:78:47:06:b3**).


## 3. Reboot Armbian

Now, reboot Armbian.

```console
root@nanopineo:~# sudo reboot

After a while, ssh into Armbian with created user nanopineo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ ssh nanopineo@192.168.0.36
The authenticity of host '192.168.0.36 (192.168.0.36)' can't be established.
ECDSA key fingerprint is SHA256:L0qZCYEGGallJo9jSpM63TWAYJ4vU/JzIbMJS80Lx8I.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.36' (ECDSA) to the list of known hosts.
nanopineo@192.168.0.36's password:
_ _ ____ _ _ _
| \ | | __ _ _ __ ___ | _ \(_) | \ | | ___ ___
| \| |/ _` | '_ \ / _ \| |_) | | | \| |/ _ \/ _ \
| |\ | (_| | | | | (_) | __/| | | |\ | __/ (_) |
|_| \_|\__,_|_| |_|\___/|_| |_| |_| \_|\___|\___/


Welcome to ARMBIAN 5.38 stable Debian GNU/Linux 9 (stretch) 4.14.14-sunxi
System load: 0.99 0.30 0.10 Up time: 0 min
Memory usage: 16 % of 240MB IP: 192.168.0.36
CPU temp: 43°C
Usage of /: 8% of 15G

[ 0 security updates available, 3 updates total: apt upgrade ]
Last check: 2018-03-01 06:30

[ General system configuration (beta): armbian-config ]


nanopineo@nanopineo:~$

4. Armbian Upgrading

Then we simply upgrade Armbian.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
nanopineo@nanopineo:~$ sudo apt update

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for nanopineo:
Hit:1 http://security.debian.org stretch/updates InRelease
Hit:4 http://apt.armbian.com stretch InRelease
Ign:2 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Hit:3 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease
Hit:5 http://cdn-fastly.deb.debian.org/debian stretch-backports InRelease
Hit:6 http://cdn-fastly.deb.debian.org/debian stretch Release
Reading package lists... Done
Building dependency tree
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
nanopineo@nanopineo:~$ apt list --upgradable
Listing... Done
linux-dtb-next-sunxi/stretch 5.41 armhf [upgradable from: 5.38]
linux-image-next-sunxi/stretch 5.41 armhf [upgradable from: 5.38]
tzdata/stable-updates 2018c-0+deb9u1 all [upgradable from: 2017c-0+deb9u1]
nanopineo@nanopineo:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
linux-dtb-next-sunxi linux-image-next-sunxi tzdata
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.2 MB of archives.
After this operation, 240 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://cdn-fastly.deb.debian.org/debian stretch-updates/main armhf tzdata all 2018c-0+deb9u1 [264 kB]
Get:2 http://apt.armbian.com stretch/main armhf linux-dtb-next-sunxi armhf 5.41 [175 kB]
Get:3 http://apt.armbian.com stretch/main armhf linux-image-next-sunxi armhf 5.41 [19.7 MB]
Fetched 20.2 MB in 14s (1387 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = (unset),
LC_TIME = "en_CA.UTF-8",
LC_MONETARY = "en_CA.UTF-8",
LC_ADDRESS = "en_CA.UTF-8",
LC_TELEPHONE = "en_CA.UTF-8",
LC_MESSAGES = "en_US.UTF-8",
LC_NAME = "en_CA.UTF-8",
LC_MEASUREMENT = "en_CA.UTF-8",
LC_IDENTIFICATION = "en_CA.UTF-8",
LC_NUMERIC = "en_CA.UTF-8",
LC_PAPER = "en_CA.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Preconfiguring packages ...
(Reading database ... 32833 files and directories currently installed.)
Preparing to unpack .../tzdata_2018c-0+deb9u1_all.deb ...
Unpacking tzdata (2018c-0+deb9u1) over (2017c-0+deb9u1) ...
Preparing to unpack .../linux-dtb-next-sunxi_5.41_armhf.deb ...
Unpacking linux-dtb-next-sunxi (5.41) over (5.38) ...
Preparing to unpack .../linux-image-next-sunxi_5.41_armhf.deb ...
update-initramfs: Deleting /boot/initrd.img-4.14.14-sunxi
Removing obsolete file uInitrd-4.14.14-sunxi
Unpacking linux-image-next-sunxi (5.41) over (5.38) ...
Setting up linux-dtb-next-sunxi (5.41) ...
Setting up tzdata (2018c-0+deb9u1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory

Current default time zone: 'Etc/UTC'
Local time is now: Thu Mar 1 06:34:05 UTC 2018.
Universal Time is now: Thu Mar 1 06:34:05 UTC 2018.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

Setting up linux-image-next-sunxi (5.41) ...
update-initramfs: Generating /boot/initrd.img-4.14.18-sunxi
update-initramfs: Converting to u-boot format
nanopineo@nanopineo:~$

5. Kernel Doublechecking

Finally, we have the system and kernel doublechecked.

1
2
3
4
5
6
7
8
9
10
11
nanopineo@nanopineo:~$ uname -r
4.14.14-sunxi
nanopineo@nanopineo:~$ uname -a
Linux nanopineo 4.14.14-sunxi #1 SMP Thu Jan 25 12:20:57 CET 2018 armv7l GNU/Linux
nanopineo@nanopineo:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.3 (stretch)
Release: 9.3
Codename: stretch
nanopineo@nanopineo:~$