2020-08-05
md
Turning an Amlogic S192 Android TV Box into a Linux Appliance

 

 Armbian 22.08 - Ubuntu Focal with 5.15.52 Linux Kernel on an Alfawise S92/Beelink GT1 

In December of 2019, I experimented with an Alfawise S92 TV box and managed to install Armbian 19.11.3 with Linux kernel version 5.3 on an SD card. It was more or less a "dual boot" arrangement: if the SD card was in the reader, Linux would boot, otherwise Android would boot from the on-board eMMC flash memory.The result was not entirely satisfactory mostly because I could not find a device tree for the Armbian image that included a working Wi-Fi driver. Then I did something rather stupid while playing with the armbian-config utility, and "accidently" overwrote Android on the eMMC flash memory without having backed up the "ROM". I hadn't exactly bricked the device, but it could not really function as a Linux server because of the lack of Wi-Fi connectivity and I could not restore the "factory ROM".

If nothing else I am persistent and decided to take another look at the TV box and the timing could not have been better. Clever people have solved my problem and the TV box will probably prove to be a rather good "Linux appliance" that I would consider to be near to a Raspberry Pi 4 if not better.

Given how difficult it has been to get a Raspberry Pi in the last couple of years and the ubiquity of TV boxes, others may be tempted to imitate what is described below. Please be warned that this post is not a set of instructions to follow blindly. Over the years, numerous producers have offered many models of TV boxes of varying quality. Indeed, some producers have released different system boards with different components under the same model number. That seems to be the case for the Beelink GT1. Some retailers do not identify the CPU correctly and almost none specify the Wi-Fi chip used. To use a trite expression: your mileage may vary even if you think you have a TV box that is similar enough to the one I purchased in early 2017 and which is, in all probability, no longer available.

 

Table of Content

  1. TV Box Hardware
  2. Selecting and Modifying the Armbian Image
    1. Selecting the Correct DeviceTree Blob
    2. Selecting the Correct Bootloader
    3. References and Kudos
  3. Booting into Linux
  4. Update and Initial State of Linux
  5. Basic Fixes
  6. Optional Configuration
    1. Reduce Password Requests
    2. Set the Time Zone
    3. Enable mDns Advertising
    4. Change the Host Name
    5. Disable IR Remote Control
  7. Network Configuration
    1. Enable Wi-Fi
    2. Static IP for a Network Interface
    3. Cleaning Up the Network Configuration
  8. Move the OS Image to eMMC Storage
    1. Back Up the Configured Armbian Image
    2. Back Up the eMMC Storage
    3. Copy the OS to the eMMC Storage
  9. The End?

TV Box Hardware toc

When I purchased the Alfawise S92 not long after its late 2016 release, it looked like a good bargain. Here is the conflagration of two advertisements about the device.

Alfawise S92 Specifications
OSAndroid 6.0 Marshmallow (Update to Android 7.1 Nougat possible)
CPUAmlogic S912 Octo core cortex A53 2.0Ghz (max) 64bit
GPUARM Mali-T820MP3 650Mhz up to 4K resolution
RAM2GB DDR3
StorageInternal: 16GB eMMC
External: MicroSD 512 GB max
Ethernet1 Gigabit/sec
Wi-Fi802.11 a/b/g/n/ac Dual Band 2.4/5Ghz
Bluetooth4.0
USB2 x USB 2.0 (1 OTG)
HDMI1 x HDMI 2.0
AV1 x Optical SPDIF
IR1 x IR receiver
Dimensions110 mm square x 18 mm thick
Weight175 gm
Power10 watts (5V @ 2A)

As stated in the introduction, getting Linux drivers for some of the devices on the board was a problem. So here is more information on those for the September 2016 version of the system board (QII_V2.0_20160905).

Alfawise S92 on-board peripheral devices
RadioAzureWave Aigale AW-CM273SM
EthernetRealtek RTL8211F
eMMCLongsys Electronics FORESEE NCEMBSF9-16G
IR56526 TI 65A

The source of this last table is an Armbian forum message by Sparkx. I could not identify the IR receiver on my board nor could I find information about the part number given by Sparkx. Could it be an Atmel T2526? More problematic, I could not find any specific data sheet for the AW-CM273SM.Wi-Fi/Bluetooth chip.

The Unboxing and Teardown review of the Beelink GT1 TV box by Jean-Luc Aufranc (CNXSoft) posted in September 2016 has useful information. Why talk about this TV box? Because the pictures of the board in the review and other comments found on Web forums confirmed that the Beelink GT1 and the Alfawise S92 board are very similar. The GT1 has a slightly smaller case with a different heat sink accommodating a slightly smaller system board. But the difference in the boards seems to be limited to the edges and the placement of all the major components appears to be the same. Furthermore the boards share a common recognized component mark issued by Underwriters Laboratories issued to the Shenzhen Huayan Huihai Electronic Co. a discreet PCB manufacturer. Both boards share the HM model number.

Wi-Fi/Bluetooth radio chips causes major headaches for the Armbian team. Documentation about the chips used by TV box manufacturers can be very scarce. Luckily, Aufranc identified the connectivity peripherals on the boards.

Wired connectivity is achieved via Realtek RTL8211F Gigabit Ethernet transceiver and H2403N transformer, while 802.11ac and Bluetooth 4.0 are done with Aigale AW-CM273SM. It’s the first time I see this module, but it appears to be a compatible replacement of Ampak AP6335 according to one Chinese website.

Among other things, the short Chinese source said that the chip is Bluetooth 4.1 compliant, that it "completely replaces Ap6335" and that "AW-CM273SM module adopts QCA9377 single chip solution. The module design is based on the QCA9377 solution". That explains the AP6335 and QCA9377 sometimes seen in discussions among developpers. The good news is that there are Linux firmware for Ampak wireless/bluetooth combo cards, AP6335 with mainline kernel, support for Ampak AP6255 (bcm43455c0 with SDIO device ID 0xa9bf), etc.

Beelink GT1
Presumably, Armbian could be installed on the Beelink GT1 TV box following the instructions presented below. However it seems that a different Wi-Fi chipset was used in some production runs of that device. To paraphrase the machine translation of a note found in [ROM] Beelink GT1 / Alfawise S92 Superceleron BETA v1 Rom only GT1 with a serial number which starts with S912... use the 9377 wifi chipset ie the Aigale AW-CM273SM.

Selecting and Modifying the Armbian Image toc

The bad news is that TV boxes are not supported by the Armbian team. Even worse, balbes150, who had been porting Armbian to various TV boxes, stopped supporting Amlogic CPUs in October of 2020.

Since the last S912 images from balbes150 were released 4 years after the introduction of the Alfawise S92/Beelink GT1, I thought it might be worthwhile to try to install one of them from this repository. The installation was not straightforward but that was because I had left the TV box in a mess in my last experiments with it. It was necessary to reinstall the stock Android firmware in the eMMC flash memory and from there it was relatively simple to install Armbian on a microSD card. This time I made sure to avoid copying the SD image over to the eMMC flash. A cursory test seemed to confirm that the important elements worked except for the Wi-Fi (and presumably Bluetooth) peripheral even when using the Beelink GT1 dtb (devicetree blob).

In the search for a dtb that would automagically add Wi-Fi capabilities, the Armbian for Amlogic TV Boxes repository by ophub came up. This GitHub was started in September 2021 and is is very actively maintained by ophub who appears to have taken on the task abandoned by balbes150 albeit not within the . The very good news for S192 owners was an announcement by danuzz Beelink GT1(S912, 2GB RAM, 16GM , QCA9377-wifi ) working with meson-gxm-beelink-gt1.dtb(150balbes) reporting a successful installation of Armbian on a Beelink GT 1 including working Wi-Fi and Bluetooth. Notice how it appears that the dtb used by 150balbes was working.

The exchange between ophub and danuzz following the latter's message makes it clear that a very recent kernel must be used. Accordingly, go to the releases and choose one of the 5.15.52 kernels or newer. I chose Armbian_22.08.0_Aml_s912_focal_5.15.52_server_2022.07.06.img.gz released July 3, 2022. As stated, ophub is very active and only 3 days later a new release had become available, but I will continue with the July 3 release of focal while trying to finish writing this post.

Following a question from a reader of this post, I tried to locate the image used in this post, and as the reader had told me, it was no longer available. The nearest image to the one used in writting this post that is currently available is:

There is also a Debian based image.

Given that ophub is deleting older releases, it is probably not wise to put direct links to releases in that repository.

Both of the newer images contain the needed dtb file and u-boot loader. I have tested the Ubuntu based image, Armbian_22.08.0_Aml_s912_jammy_5.15.58_server_2022.07.30.img, modifying the image as described in sub sections 2.1 and 2.2 and creating a user account and rebooting back into it as described in section 3. Everything seems fine, but of course, I can't vouch for the following steps described in the rest of the post, but I would assume most of that discussion would remain valid.

August 5, 2022

I used Balena Etcher to write the image file to a 16 GByte micro SD card. Once the image is on the card, it was a simple matter to remove the card and reinsert it on my Linux desktop machine. The two partitions on the card were then mounted into the file system. I opened a terminal in the BOOT partition to make only small changes as explained next. Since BOOT is a fat partition, uses of Windows will be able to do the same without problem.

Selecting the Correct DeviceTree Blob toc

The extlinux configuration file has to be created from a template.

michel@hp:/media/michel/BOOT$ nano extlinux/extlinux.conf.bak

Only the dtb had to be changed in that file.

label Armbian kernel /zImage initrd /uInitrd fdt /dtb/amlogic/meson-gxm-beelink-gt1.dtb append root=UUID=d7438465-50f5-4136-bbca-72deb63e37d2 rootflags=data=writeback rw rootfstype=ext4 console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 loglevel=1 voutmode=hdmi disablehpd=false overscan=100 sdrmode=auto

It is important to save the modified file under a new name: extlinux/extlinux.conf.

michel@hp:/media/michel/BOOT$ ls -l extlinux total 8 -rw-r--r-- 1 michel michel 385 jui 6 00:33 extlinux.conf -rw-r--r-- 1 michel michel 388 jui 3 07:53 extlinux.conf.bak

This could be done with any GUI text editor such as Geany. I ran into difficulty because of extraneous spaces after the .dtb entry. I can't recall if this was during this installation or a previous one but, just to be safe, do make sure to remove all trailing spaces.

There is a uEnv.txt configuration file in the BOOT partition.

LINUX=/zImage INITRD=/uInitrd FDT=/dtb/amlogic/meson-gxm-octopus-planet.dtb APPEND=root=UUID=f9a4ae8c-c557-4163-bfec-3b00a35a4f86 rootflags=data=writeback rw rootfstype=ext4 console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1

I changed the FDT value to /dtb/amlogic/meson-gxm-beelink-gt1.dtb to be on the safe side, but as far as I can make out it does not matter at this point. However the emmc_autoscript.cmd does read that file and it may be important if the image is moved to the eMMC flash memory.

Selecting the Correct Bootloader toc

There are many bootloaders on the image. Following danuzz, u-boot-zyxq was selected. All that entails is renaming the bootloader as u-boot.ext or, as done below copying the file to that name.

michel@hp:/media/michel/BOOT$ ls *bin u-boot-e900v22c.bin u-boot-n1.bin u-boot-s905.bin u-boot-sei610.bin u-boot-ugoos-x3.bin u-boot-gtking.bin u-boot-odroid-n2.bin u-boot-s905x2-s922.bin u-boot-tx3-bz.bin u-boot-x96max.bin u-boot-gtkingpro.bin u-boot-p201.bin u-boot-s905x-s912.bin u-boot-tx3-qz.bin u-boot-x96maxplus.bin u-boot-gtkingpro-rev-a.bin u-boot-p212.bin u-boot-sei510.bin u-boot-u200.bin u-boot-zyxq.bin michel@hp:/media/michel/BOOT$ cp u-boot-zyxq.bin u-boot.ext michel@hp:/media/michel/BOOT$ ls -l u-boot.ext u-boot-zyxq.bin -rw-r--r-- 1 michel michel 703444 jui 6 00:36 u-boot.ext -rw-r--r-- 1 michel michel 703444 jui 3 07:53 u-boot-zyxq.bin

That last listing is just to verify that u-boot.ext is indeed u-boot-zyxq.bin.

Basically that's all there is to preparing the operating system.

References and Kudos toc

To be befittingly modest, I merrely selected a working image based on the the work of the small and hard-working Armbian team which balbes150, ophub, and danuzz leveraged to provide a working modern Linux image for the AML S192 and the peripherals found on the Alfawise S92 / Beelink GT1.

It looks deceptively simple to get a working image, but advice was sought from many sources, notably

Here are references for the bravest among us.

Booting Into Linux toc

To boot into the Linux image created in the previous section, safely eject the micro SD card and insert it into the SD card reader of the TV box that is not powered. Connect a monitor and a USB keyboard to the TV box. It is probably best to connect to the local network with a Ethernet cable, but it is not mandatory at this point although eventually it will be necessary to connect to the Web.

Serial debug port on S92 card

Additionally, I connected a USB-serial adapter to the debug console serial port on the system board before continuing. This is entirely optional but it was with this connection that the output from the boot loader and the Linux kernel was recorded.

If you to do the same, then the base must be carefully pried away from the case. However, it is not necessary to remove the circuit board from the case and the serial connection can be made with only three male Dupont wires without soldering. The photograph shows the port which is at the front of the TV box opposite the optical SPDIF connector at the back of the box. Do not connect Vcc to the USB serial adapter when powering the TV box with its power supply and don't forget to connect the transmit (Tx) and receive (Rx) signals to their opposite number on the USB serial adapter. Plug in the serial adapter and find the tty device created and open a terminal to connect to it.

michel@hp:~$ ls /dev/ttyU* /dev/ttyUSB0 michel@hp:~$ cu -l /dev/ttyUSB0 -s 115200 Connected.

Power up the TV box; it will boot in Android as usual. Find the UPDATE&BACKUP application icon.

Start the app and click on the Update button in the UpdateLocale (i.e. local update?).

The exact names and icons will depend on the version of the Android installed on the TV box. The following boot loader messages will be sent to the debug serial port .

GXM:BL1:dc8b51:76f1a5;FEAT:ADFC318C:0;POC:3;RCY:0;EMMC:0;READ:0;0.0;CHK:0; TE: 158138 BL2 Built : 20:32:17, Sep 8 2017. gxl g6296b83 - xiaobo.gu@droid12 set vdd cpu_a to 1120 mv set vdd cpu_b to 1050 mv set vddee to 1000 mv Board ID = 10 CPU clk: 1200MHz DQS-corr enabled DDR scramble enabled STICKY_REG0: 0x00000000 STICKY_REG1: 0x00000000 STICKY_REG9: 0x00000000 DDR3 chl: Rank0+1 @ 912MHz - PASS Rank0: 1024MB(auto)-2T-13 Rank1: 1024MB(auto)-2T-13 DataBus test pass! AddrBus test pass! -s Load fip header from eMMC, src: 0x0000c200, des: 0x01400000, size: 0x00004000 New fip structure! Load bl30 from eMMC, src: 0x00010200, des: 0x01100000, size: 0x0000d600 Load bl31 from eMMC, src: 0x00020200, des: 0x05100000, size: 0x0002c600 Load bl33 from eMMC, src: 0x00050200, des: 0x01000000, size: 0x00065800 NOTICE: BL3-1: v1.0(release):a625749 NOTICE: BL3-1: Built : 11:25:15, Aug 25 2017 NOTICE: BL31: BL33 decompress pass mpu_config_enable:ok [Image: gxl_v1.1.3243-377db0f 2017-09-07 11:28:58 qiufang.dai@droid07] OPS=0x82 wdt: reset registers! b7 6 15 cb 9a c7 1c 63 ae bf f2 b4 [0.391567 Inits done] secure task start! high task start! low task start! ERROR: Error initializing runtime service opteed_fast U-Boot 2015.01-g84dda8c (Jul 18 2018 - 19:08:03) DRAM: 2 GiB Relocation Offset is: 76eb4000 register usb cfg[0][1] = 0000000077f5b100 [CANVAS]canvas init boot_device_flag : 1 set wlan gpio pin 6. set bluetooth gpio pin 17. Nand PHY Ver:1.01.001.0006 (c) 2013 Amlogic Inc. init bus_cycle=6, bus_timing=7, system=5.0ns reset failed get_chip_type and ret:fffffffe get_chip_type and ret:fffffffe chip detect failed and ret:fffffffe nandphy_init failed and ret=0xfffffff1 MMC: aml_priv->desc_buf = 0x0000000073eb4790 aml_priv->desc_buf = 0x0000000073eb6ab0 SDIO Port B: 0, SDIO Port C: 1 emmc/sd response timeout, cmd8, status=0x1ff2800 emmc/sd response timeout, cmd55, status=0x1ff2800 init_part() 293: PART_TYPE_AML [mmc_init] mmc init success dtb magic 5f4c4d41 Amlogic multi-dtb tool Multi dtb detected Multi dtb tool version: v2 . Support 3 dtbs. aml_dt soc: gxm platform: q201 variant: 2g dtb 0 soc: gxm plat: q201 vari: 1g dtb 1 soc: gxm plat: q201 vari: 2g dtb 2 soc: gxm plat: q201 vari: 3g Find match dtb: 1 start dts,buffer=0000000073eb9300,dt_addr=0000000073ec4b00 Amlogic multi-dtb tool Multi dtb detected Multi dtb tool version: v2 . Support 3 dtbs. aml_dt soc: gxm platform: q201 variant: 2g dtb 0 soc: gxm plat: q201 vari: 1g dtb 1 soc: gxm plat: q201 vari: 2g dtb 2 soc: gxm plat: q201 vari: 3g Find match dtb: 1 parts: 10 00: logo 0000000002000000 1 01: recovery 0000000002000000 1 02: rsv 0000000000800000 1 03: tee 0000000000800000 1 04: crypt 0000000002000000 1 05: misc 0000000002000000 1 06: boot 0000000002000000 1 07: system 0000000080000000 1 08: cache 0000000020000000 2 09: data ffffffffffffffff 4 init_part() 293: PART_TYPE_AML eMMC/TSD partition table have been checked OK! check pattern success mmc env offset: 0x27400000 In: serial Out: serial Err: serial reboot_mode=cold_boot [store]To run cmd[emmc dtb_read 0x1000000 0x40000] _verify_dtb_checksum()-917: calc faed54c0, store faed54c0 _verify_dtb_checksum()-917: calc faed54c0, store faed54c0 dtb_read()-1039: total valid 2 dtb_read()-1106: do nothing Amlogic multi-dtb tool Multi dtb detected Multi dtb tool version: v2 . Support 3 dtbs. aml_dt soc: gxm platform: q201 variant: 2g dtb 0 soc: gxm plat: q201 vari: 1g dtb 1 soc: gxm plat: q201 vari: 2g dtb 2 soc: gxm plat: q201 vari: 3g Find match dtb: 1 vpu: clk_level in dts: 7 vpu: set clk: 666667000Hz, readback: 666660000Hz(0x300) vpu: vpu_clk_gate_init_off vpp: vpp_init hpd_state=0 cvbs performance type = 6, table = 0 saradc - saradc sub-system Usage: saradc saradc open - open a SARADC channel saradc close - close the SARADC saradc getval - get the value in current channel saradc get_in_range - return 0 if current value in the range of current channel SARADC closed. vpp: vpp_pq_load pq val error !!! Net: dwmac.c9410000amlkey_init() enter! [EFUSE_MSG]keynum is 4 [BL31]: tee size: 0 Start read misc partition datas! info->attemp_times = 0 info->active_slot = 0 info->slot_info[0].bootable = 1 info->slot_info[0].online = 1 info->slot_info[1].bootable = 0 info->slot_info[1].online = 0 info->attemp_times = 0 attemp_times = 0 active slot = 0 wipe_data=successful wipe_cache=successful upgrade_step=2 [OSD]load fb addr from dts [OSD]fb_addr for logo: 0x7f851000 [OSD]load fb addr from dts [OSD]fb_addr for logo: 0x7f851000 [CANVAS]addr=0x7f851000 width=5760, height=2160 amlkey_init() enter! amlkey_init() 71: already init! [EFUSE_MSG]keynum is 4 [BL31]: tee size: 0 [KM]Error:f[key_manage_query_size]L507:key[usid] not programed yet [KM]Error:f[key_manage_query_size]L507:key[deviceid] not programed yet gpio: pin GPIOAO_2 (gpio 102) value is 1 InUsbBurn noSof Hit Enter or space or Ctrl+C key to stop autoboot -- : 0 card in init_part() 278: PART_TYPE_DOS [mmc_init] mmc init success Device: SDIO Port B Manufacturer ID: 3 OEM: 5344 Name: SC16G Tran Speed: 50000000 Rd Block Len: 512 SD version 3.0 High Capacity: Yes Capacity: 14.8 GiB mmc clock: 40000000 Bus Width: 4-bit reading s905_autoscript 1654 bytes read in 4 ms (403.3 KiB/s) ## Executing script at 01020000 start amlogic old u-boot ## Error: "bootfromsd" not defined reading boot_android ** Unable to read file boot_android ** ** Bad device usb 0 ** reading u-boot.ext 703444 bytes read in 44 ms (15.2 MiB/s) ## Starting application at 0x01000000 ... U-Boot 2021.07-rc3-00183-gd6e1cdad51-dirty (Jun 03 2021 - 09:41:29 +0800) octopus-planet Model: Octopus Planet SoC: Amlogic Meson GXM (S912) Revision 22:a (82:2) DRAM: 2 GiB MMC: mmc@72000: 0, mmc@74000: 1 Loading Environment from nowhere... OK In: serial Out: serial Err: serial [BL31]: tee size: 0 [BL31]: tee size: 0 Net: eth0: ethernet@c9410000 starting USB... Bus usb@c9000000: dwc3_meson_gxl_get_phys: usb2 ports: 3 Register 3000140 NbrPorts 3 Starting the controller USB XHCI 1.00 scanning bus usb@c9000000 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 Device 0: unknown device switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found /extlinux/extlinux.conf Retrieving file: /extlinux/extlinux.conf 385 bytes read in 2 ms (187.5 KiB/s) 1: Armbian Retrieving file: /uInitrd 8069614 bytes read in 346 ms (22.2 MiB/s) Retrieving file: /zImage 25739776 bytes read in 1097 ms (22.4 MiB/s) append: root=UUID=f9a4ae8c-c557-4163-bfec-3b00a35a4f86 rootflags=data=writeback rw rootfstype=ext4 console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 loglevel=1 voutmode=hdmi disablehpd=false overscan=100 sdrmode=auto Retrieving file: /dtb/amlogic/meson-gxm-beelink-gt1.dtb 30751 bytes read in 4 ms (7.3 MiB/s) ## Loading init Ramdisk from Legacy Image at 13000000 ... Image Name: uInitrd Image Type: AArch64 Linux RAMDisk Image (gzip compressed) Data Size: 8069550 Bytes = 7.7 MiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK ## Flattened Device Tree blob at 08008000 Booting using the fdt blob at 0x8008000 Loading Ramdisk to 7b783000, end 7bf351ae ... OK Loading Device Tree to 000000007b778000, end 000000007b78281e ... OK Starting kernel ... [BL31]: tee size: 0 domain-0 init dvfs: 4 domain-1 init dvfs: 4

None of the above messages are shown on the screen connected to the box. Once Linux starts loading the following messages will be shown on the screen and in the serial terminal.

[ 8.059185] systemd[1]: Finished Apply Kernel Variables. [ 8.114676] systemd[1]: Finished Create System Users. [ 8.126859] systemd[1]: Starting Create Static Device Nodes in /dev... [ 8.140167] systemd[1]: Finished Set the console keyboard layout. [ 8.182008] systemd[1]: Finished Create Static Device Nodes in /dev. [ 8.190256] systemd[1]: Reached target Local File Systems (Pre). [ 8.205539] systemd[1]: Mounting /var/tmp... [ 8.218566] systemd[1]: Starting udev Kernel Device Manager... [ 8.230833] systemd[1]: Mounted /var/tmp. [ 8.303423] systemd[1]: Finished udev Coldplug all Devices. [ 8.317581] systemd[1]: Starting Helper to synchronize boot up for ifupdown... [ 8.380836] systemd[1]: Started udev Kernel Device Manager. [ 8.614839] gpio-fan gpio-fan: GPIO fan initialized [ 8.634715] meson_vdec: module is from the staging directory, the quality is unknown, you have been warned. [ 8.657401] Registered IR keymap rc-beelink-gs1 [ 8.657573] random: systemd: uninitialized urandom read (16 bytes read) [ 8.666674] random: systemd: uninitialized urandom read (16 bytes read) [ 8.678616] IR NEC protocol handler initialized [ 8.678746] random: systemd: uninitialized urandom read (16 bytes read) [ 8.686852] systemd[1]: Found device /dev/ttyAML0. [ 8.708508] rc rc1: meson-ir as /devices/platform/soc/c8100000.bus/c8100580.ir/rc/rc1 [ 8.720646] rc rc1: lirc_dev: driver meson-ir registered at minor = 0, raw IR receiver, no transmitter [ 8.742824] input: meson-ir as /devices/platform/soc/c8100000.bus/c8100580.ir/rc/rc1/input2 [ 8.754679] meson-ir c8100580.ir: receiver initialized [ 8.809214] debugfs: Directory 'c1105400.audio-controller' with parent 'GXM-BEELINK-GT1' already present! [ 8.825775] debugfs: File 'HDMITX Capture' in directory 'dapm' already present! [ 8.833861] Bluetooth: Core ver 2.22 [ 8.837265] Bluetooth: Starting self testing [ 8.852876] Bluetooth: ECDH test passed in 12362 usecs [ 8.860315] Bluetooth: SMP test passed in 3855 usecs [ 8.863333] Bluetooth: Finished self testing [ 8.869322] NET: Registered PF_BLUETOOTH protocol family [ 8.872273] Bluetooth: HCI device and connection manager initialized [ 8.878320] Bluetooth: HCI socket layer initialized [ 8.880677] panfrost d00c0000.gpu: clock rate = 24000000 [ 8.883383] Bluetooth: L2CAP socket layer initialized [ 8.888488] panfrost d00c0000.gpu: dev_pm_opp_set_regulators: no regulator (mali) found: -19 [ 8.893721] Bluetooth: SCO socket layer initialized [ 8.918139] panfrost d00c0000.gpu: mali-t820 id 0x820 major 0x1 minor 0x0 status 0x0 [ 8.923465] panfrost d00c0000.gpu: features: 00000000,101e76ff, issues: 00000000,24040400 [ 8.931641] panfrost d00c0000.gpu: Features: L2:0x07110206 Shader:0x00000000 Tiler:0x00000809 Mem:0x1 MMU:0x00002821 AS:0xff JS:0x7 [ 8.943811] panfrost d00c0000.gpu: shader_present=0x7 l2_present=0x1 [ 8.965969] [drm] Initialized panfrost 1.2.0 20180908 for d00c0000.gpu on minor 1 [ 9.074868] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 9.124569] systemd[1]: Condition check resulted in Dispatch Password Requests to Console Directory Watch when bootsplash is active being skipped. [ 9.124937] systemd[1]: Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch. [ 9.145216] Bluetooth: HCI UART driver ver 2.3 [ 9.157050] Bluetooth: HCI UART protocol H4 registered [ 9.157064] Bluetooth: HCI UART protocol BCSP registered [ 9.157186] Bluetooth: HCI UART protocol LL registered [ 9.172505] Bluetooth: HCI UART protocol ATH3K registered [ 9.172618] Bluetooth: HCI UART protocol Three-wire (H5) registered [ 9.184391] Bluetooth: HCI UART protocol Intel registered [ 9.184632] Bluetooth: HCI UART protocol Broadcom registered [ 9.184903] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator [ 9.185300] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator [ 9.209966] Driver 'hci_uart_qca' needs updating - please use bus_type methods [ 9.210061] Bluetooth: HCI UART protocol QCA registered [ 9.219091] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 9.222298] Bluetooth: HCI UART protocol AG6XX registered [ 9.234203] Bluetooth: HCI UART protocol Marvell registered [ 9.240953] systemd[1]: Condition check resulted in Kernel Trace File System being skipped. [ 9.250568] systemd[1]: Condition check resulted in Set Up Additional Binary Formats being skipped. [ 9.261571] systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped. [ 9.271462] systemd[1]: Condition check resulted in Platform Persistent Storage Archival being skipped. [ 9.294985] systemd[1]: Found device /dev/disk/by-label/BOOT. [ 9.312127] systemd[1]: Starting File System Check on /dev/disk/by-label/BOOT... [ 9.342576] systemd[1]: Started File System Check Daemon to report status. [ 9.360494] systemd[1]: Found device /sys/subsystem/net/devices/eth0. [ 9.427432] Bluetooth: hci0: BCM: failed to write update baudrate (-56) [ 9.430124] systemd[1]: Starting Load/Save RF Kill Switch Status... [ 9.432809] Bluetooth: hci0: Failed to set baudrate [ 9.478497] systemd[1]: Reached target Bluetooth. [ 9.485399] systemd[1]: Started Load/Save RF Kill Switch Status. [ 9.528107] random: crng init done [ 9.532547] random: 106 urandom warning(s) missed due to ratelimiting [ 9.543252] systemd[1]: Finished File System Check on /dev/disk/by-label/BOOT. [ 9.557733] systemd[1]: Finished Load/Save Random Seed. [ 9.583587] systemd[1]: Mounting /boot... [ 9.610789] systemd[1]: Finished Helper to synchronize boot up for ifupdown. [ 9.617962] Bluetooth: hci0: BCM: Read verbose config info failed (-56) [ 9.623880] ath10k_sdio mmc1:0001:1: qca9377 hw1.1 sdio target 0x05020001 chip_id 0x00000000 sub 0000:0000 [ 9.637094] ath10k_sdio mmc1:0001:1: kconfig debug 0 debugfs 0 tracing 0 dfs 1 testmode 0 [ 9.651009] ath10k_sdio mmc1:0001:1: firmware ver WLAN.TF.1.1.1-00061-QCATFSWPZ-1 api 5 features ignore-otp crc32 7746e551 [ 9.660289] systemd[1]: Mounted /boot. [ 9.676603] systemd[1]: Reached target Local File Systems. [ 9.692310] systemd[1]: Starting Armbian leds state... [ 9.705045] systemd[1]: Starting Armbian ZRAM config... [ 9.715680] systemd[1]: Starting Set console font and keymap... [ 9.727855] systemd[1]: Started ifup for eth0. [ 9.738774] systemd[1]: Starting Raise network interfaces... [ 9.749643] systemd[1]: Starting Preprocess NFS configuration... [ 9.760985] systemd[1]: Starting Mark the need to relabel after reboot... [ 9.768620] systemd[1]: Condition check resulted in Store a System Token in an EFI Variable being skipped. [ 9.778746] systemd[1]: Condition check resulted in Commit a transient machine-id on disk being skipped. [ 9.792432] systemd[1]: Finished Armbian leds state. [ 9.800535] systemd[1]: nfs-config.service: Succeeded. [ 9.806195] systemd[1]: Finished Preprocess NFS configuration. [ 9.816549] systemd[1]: Finished Mark the need to relabel after reboot. [ 9.827999] ath10k_sdio mmc1:0001:1: failed to fetch board data for bus=sdio,vendor=0271,device=0701,subsystem-vendor=0000,subsystem-device=0000 from ath10k/QCA9377/hw1.0/board-2.bin [ 9.829225] systemd[1]: Starting NFSv4 ID-name mapping service... [ 9.857358] ath10k_sdio mmc1:0001:1: board_file api 1 bmi_id N/A crc32 544289f7 [ 9.865268] systemd[1]: Condition check resulted in RPC security service for NFS client and server being skipped. [ 9.878547] systemd[1]: Reached target NFS client services. [ 9.888885] systemd[1]: Condition check resulted in RPC security service for NFS server being skipped. [ 9.936686] systemd[1]: Started NFSv4 ID-name mapping service. [ 10.061944] zram: Added device: zram0 [ 10.067173] zram: Added device: zram1 [ 10.072312] zram: Added device: zram2 [ 10.307688] zram0: detected capacity change from 0 to 1980328 [ 10.367794] Adding 990160k swap on /dev/zram0. Priority:5 extents:1 across:990160k SSFS [ 10.518221] meson8b-dwmac c9410000.ethernet eth0: PHY [0.2009087f:00] driver [RTL8211F Gigabit Ethernet] (irq=49) [ 10.540074] meson8b-dwmac c9410000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0 [ 10.552205] zram1: detected capacity change from 0 to 102400 [ 10.561464] meson8b-dwmac c9410000.ethernet eth0: No Safety Features support found [ 10.570081] meson8b-dwmac c9410000.ethernet eth0: PTP not supported by HW [ 10.578921] meson8b-dwmac c9410000.ethernet eth0: configuring for phy/rgmii link mode [ 10.730790] zram2: detected capacity change from 0 to 1980328 [ 10.843188] EXT4-fs (zram2): mounted filesystem without journal. Opts: discard. Quota mode: none. [ 10.886524] systemd[1]: Finished Armbian ZRAM config. [ 10.913557] systemd[1]: Starting Armbian memory supported logging... [ 10.958656] meson-gx-mmc d0070000.mmc: unaligned sg offset 3148, disabling descriptor DMA for transfer [ 10.998274] ath10k_sdio mmc1:0001:1: htt-ver 3.32 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1 [ 11.027527] EXT4-fs (zram1): mounted filesystem without journal. Opts: discard. Quota mode: none. [ 11.039519] ext4 filesystem being mounted at /var/log supports timestamps until 2038 (0x7fffffff) [ 11.067674] mmc1: queuing unknown CIS tuple 0x01 [d9 01 ff] (3 bytes) [ 11.081698] mmc1: queuing unknown CIS tuple 0x1a [01 01 00 02 07] (5 bytes) [ 11.090460] mmc1: queuing unknown CIS tuple 0x1b [c1 41 30 30 ff ff 32 00] (8 bytes) [ 11.096584] mmc1: queuing unknown CIS tuple 0x14 [] (0 bytes) [ 15.357004] systemd[1]: Finished Armbian memory supported logging. [ 15.391233] systemd[1]: Starting Journal Service... [ 15.641337] systemd[1]: Started Journal Service. [ 15.685624] systemd-journald[1055]: Received client request to flush runtime journal. [ 111.653577] NFSD: Using UMH upcall client tracking operations. [ 111.655508] NFSD: starting 90-second grace period (net f0000000)

Note the period of apparent inactivity near the end. This only happens on the first initial boot. Perhaps the file system is being expanded? Note the 90 second grace period after that. Use that grace period to copy the debug serial output if desired because at the end of the grace period all the debug terminal buffers will be erased. The Armbian login screen will be displayed on the screen but it will be immediately erased and the following simple message will be displayed. Again this is only done once.

Welcome to ARMBIAN! Documentation: https://docs.armbian.com | Community: https://forum.armbian.com Create root password:

If the setup is interrupted before the root password is set, then it may be necessary to login again as root in which case the default password will need to be entered. It is 1234.

Respond to screen prompts, providing a new root password and create a user account. As can be seen below, I did that using the debug serial connection so as to record what was happening, but all this can be done with the keyboard connected to the box.

Welcome to ARMBIAN! Documentation: https://docs.armbian.com | Community: https://forum.armbian.com Create root password: ******** Repeat root password: ******** Choose default system command shell: 1) bash 2) zsh 1 not echoed to screen Shell: BASH Creating a new user account. Press <Ctrl-C> to abort Please provide a username (eg. your first name): tucky Create user (tucky) password: ******** Repeat user (tucky) password: ******** Please provide your real name: Tucker Dear Tucker, your account tucky has been created and is sudo enabled. Please use this account for your daily work from now on. Internet connection was not detected. Connect via wireless? [Y/n] n not echoed to screen small delay while an attempt to detect the timezone is made Detected timezone: Set user language based on your location? [Y/n] n not echoed to screen At your location, more locales are possible: 1) aa_DJ.UTF-8 78) et_EE.UTF-8 2) af_ZA.UTF-8 79) et_EE.UTF-8 ... 76) es_UY.UTF-8 153) zu_ZA.UTF-8 77) es_VE.UTF-8 154) Skip generating locales Please enter your choice: 154 not echoed to screen

I do not bother setting up a locale on small Linux servers when these are run in "headless" fashion. At this point I could not resist and had a look at the network interfaces.

root@armbian:~# ip a ... 4: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000 link/ether 9e:61:11:aa:bb:cc brd ff:ff:ff:ff:ff:ff inet 169.254.9.182/16 brd 169.254.255.255 scope link eth0:avahi valid_lft forever preferred_lft forever 5: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000 link/ether f0:03:8c:11:22:33 brd ff:ff:ff:ff:ff:ff

That is encouraging, with the older attempt at installing Linux the wireless interface was not present. Checking the init system status, we see that it is degraded because two services failed to load.

From now on, when the TV box is powered up, the boot loader first attempts to load an operating system from the SD card. If there is no SD card or if it does not contain an operating system, then the boot loader tries to load an operating system from any connected USB block device. If that fails, then the boot loader tries to load an operating system from the on-board eMMC storage.

Basically, the TV box is now a dual boot device: Linux if it's contained on attached storage (SD card or USB drive) or Android. That first Linux boot took a relatively long time, but subsequent boots of the SD card showed that the login prompt was available within 30 seconds or so. That is fast enough to have a working system using an SD card much like on a Raspberry Pi and keeping Android as a fail-safe system on the eMMC storage.

Update and Initial State of Linux toc

Let's look at how things stand.

root@armbian:~# systemctl status ● armbian State: degraded Jobs: 0 queued Failed: 2 units ... root@armbian:~# systemctl | grep failed UNIT LOAD ACTIVE SUB DESCRIPTION ● haveged.service loaded failed failed Entropy daemon using the HAVEGE algorithm ● networking.service loaded failed failed Raise network interfaces

With the newer Jammy image, haveged loaded without problem. As for the networking service, it was removed when the first system upgrade was done.
August 5, 2022

Even if the networking service failed, the debug console showed that the wired network interface was brought up when the box was connected to the local network with an Ethernet cable.

[ 684.814151] meson8b-dwmac c9410000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 684.817313] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready root@armbian:~# ip -4 a ... 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 inet 192.168.1.135/24 brd 192.168.1.255 scope global dynamic eth0 valid_lft 49sec preferred_lft 49sec

As can be seen, it was possible to recover the assigned IP address of the interface.

root@armbian:~# sudo reboot ... [ 18.090079] systemd-journald[1046]: Received client request to flush runtime journal. [ 23.461207] NFSD: Using UMH upcall client tracking operations. [ 23.463248] NFSD: starting 90-second grace period (net f0000000) Armbian 22.08.0-trunk Focal ttyAML0 armbian login:

This time, instead of using the debug serial connection or the keyboard/monitor connected to the box, I used an SSH session over the local network using the newly created user account. The IP address was known, but it can probably be found in the list of connected devices maintained by the local network router. The host name of the box is armbian.

michel@hp:~$ ssh tucky@192.168.1.144 The authenticity of host '192.168.1.144 (192.168.1.144)' can't be established. ECDSA key fingerprint is SHA256:6lKzCQsh5oQ2QLU/4uPzbkRmm/7krW+S3tCn9UYLTsI. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.1.144' (ECDSA) to the list of known hosts. root@192.168.1.144's password: ********** _ _ ___ _ ____ / \ _ __ ___ | | ___ / _ \/ |___ \  / _ \ | '_ ` _ \| | / __| (_) | | __) | / ___ \| | | | | | | \__ \\__, | |/ __/ /_/ \_\_| |_| |_|_| |___/ /_/|_|_____| Welcome to Armbian 22.08.0-trunk Focal with Linux 5.15.52-flippy-74+o No end-user support: built from trunk System load: 10% Up time: 0 min Memory usage: 10% of 1.88G IP: 192.168.1.144 CPU temp: 51°C Usage of /: 53% of 2.6G [ General system configuration (beta): armbian-config ] To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details.

The same two services failed to load as before and the logs reveal that there are other problems. But before tackling any of this, it is best to upgrade the system.

tucky@armbian:~$ sudo apt update; sudo apt upgrade -y Hit:1 http://ports.ubuntu.com focal InRelease Get:2 http://ports.ubuntu.com focal-security InRelease [114 kB] Get:3 http://ports.ubuntu.com focal-updates InRelease [114 kB] Get:4 http://ports.ubuntu.com focal-backports InRelease [108 kB] Get:5 http://ports.ubuntu.com focal-security/main arm64 Packages [1,326 kB] Get:6 http://ports.ubuntu.com focal-security/universe armhf Packages [685 kB] Get:7 http://ports.ubuntu.com focal-security/main armhf Packages [979 kB] Get:8 http://ports.ubuntu.com focal-security/universe arm64 Packages [817 kB] Get:9 http://ports.ubuntu.com focal-updates/main armhf Packages [1,339 kB] Get:10 http://ports.ubuntu.com focal-updates/universe arm64 Packages [1,095 kB] Get:11 http://ports.ubuntu.com focal-updates/multiverse arm64 Packages [9,068 B] Get:12 http://ports.ubuntu.com focal-updates/multiverse armhf Packages [9,594 B] Get:13 http://ports.ubuntu.com focal-updates/universe armhf Packages [957 kB] Get:14 http://ports.ubuntu.com focal-updates/main arm64 Packages [1,705 kB] Get:15 http://ports.ubuntu.com focal-backports/universe armhf Packages [27.1 kB] Get:16 http://ports.ubuntu.com focal-backports/universe arm64 Packages [27.1 kB] Fetched 9,311 kB in 4s (2,523 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 17 packages can be upgraded. Run 'apt list --upgradable' to see them. Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: dirmngr gnupg gnupg-l10n gnupg-utils gnupg2 gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm gpgv isc-dhcp-client libssl-dev libssl1.1 openssl unattended-upgrades 17 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 5,896 kB of archives. After this operation, 12.3 kB of additional disk space will be used. Get:1 http://ports.ubuntu.com focal-security/main arm64 gpg-wks-client arm64 2.2.19-3ubuntu2.2 [89.4 kB] Get:2 http://ports.ubuntu.com focal-security/main arm64 dirmngr arm64 2.2.19-3ubuntu2.2 [311 kB] Get:3 http://ports.ubuntu.com focal-security/main arm64 gpg-wks-server arm64 2.2.19-3ubuntu2.2 [83.1 kB] Get:4 http://ports.ubuntu.com focal-security/main arm64 gnupg-utils arm64 2.2.19-3ubuntu2.2 [441 kB] Get:5 http://ports.ubuntu.com focal-security/main arm64 gpg-agent arm64 2.2.19-3ubuntu2.2 [216 kB] Get:6 http://ports.ubuntu.com focal-security/main arm64 gpg arm64 2.2.19-3ubuntu2.2 [442 kB] Get:7 http://ports.ubuntu.com focal-security/main arm64 gpgconf arm64 2.2.19-3ubuntu2.2 [117 kB] Get:8 http://ports.ubuntu.com focal-security/main arm64 gnupg-l10n all 2.2.19-3ubuntu2.2 [51.7 kB] Get:9 http://ports.ubuntu.com focal-security/main arm64 gnupg all 2.2.19-3ubuntu2.2 [259 kB] Get:10 http://ports.ubuntu.com focal-security/main arm64 gpgsm arm64 2.2.19-3ubuntu2.2 [198 kB] Get:11 http://ports.ubuntu.com focal-security/main arm64 gpgv arm64 2.2.19-3ubuntu2.2 [183 kB] Get:12 http://ports.ubuntu.com focal-updates/main arm64 isc-dhcp-client arm64 4.4.1-2.1ubuntu5.20.04.3 [233 kB] Get:13 http://ports.ubuntu.com focal-security/main arm64 libssl-dev arm64 1.1.1f-1ubuntu2.16 [1,462 kB] Get:14 http://ports.ubuntu.com focal-security/main arm64 libssl1.1 arm64 1.1.1f-1ubuntu2.16 [1,156 kB] Get:15 http://ports.ubuntu.com focal-security/main arm64 openssl arm64 1.1.1f-1ubuntu2.16 [600 kB] Get:16 http://ports.ubuntu.com focal-updates/main arm64 unattended-upgrades all 2.3ubuntu0.3 [48.5 kB] Get:17 http://ports.ubuntu.com focal-security/universe arm64 gnupg2 all 2.2.19-3ubuntu2.2 [5,316 B] Fetched 5,896 kB in 2s (3,161 kB/s) Preconfiguring packages ... (Reading database ... 34930 files and directories currently installed.) Preparing to unpack .../00-gpg-wks-client_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking gpg-wks-client (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../01-dirmngr_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking dirmngr (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../02-gpg-wks-server_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking gpg-wks-server (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../03-gnupg-utils_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking gnupg-utils (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../04-gpg-agent_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking gpg-agent (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../05-gpg_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking gpg (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../06-gpgconf_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking gpgconf (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../07-gnupg-l10n_2.2.19-3ubuntu2.2_all.deb ... Unpacking gnupg-l10n (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../08-gnupg_2.2.19-3ubuntu2.2_all.deb ... Unpacking gnupg (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../09-gpgsm_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking gpgsm (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Preparing to unpack .../10-gpgv_2.2.19-3ubuntu2.2_arm64.deb ... Unpacking gpgv (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Setting up gpgv (2.2.19-3ubuntu2.2) ... (Reading database ... 34930 files and directories currently installed.) Preparing to unpack .../0-isc-dhcp-client_4.4.1-2.1ubuntu5.20.04.3_arm64.deb ... Unpacking isc-dhcp-client (4.4.1-2.1ubuntu5.20.04.3) over (4.4.1-2.1ubuntu5.20.04.2) ... Preparing to unpack .../1-libssl-dev_1.1.1f-1ubuntu2.16_arm64.deb ... Unpacking libssl-dev:arm64 (1.1.1f-1ubuntu2.16) over (1.1.1f-1ubuntu2.15) ... Preparing to unpack .../2-libssl1.1_1.1.1f-1ubuntu2.16_arm64.deb ... Unpacking libssl1.1:arm64 (1.1.1f-1ubuntu2.16) over (1.1.1f-1ubuntu2.15) ... Preparing to unpack .../3-openssl_1.1.1f-1ubuntu2.16_arm64.deb ... Unpacking openssl (1.1.1f-1ubuntu2.16) over (1.1.1f-1ubuntu2.15) ... Preparing to unpack .../4-unattended-upgrades_2.3ubuntu0.3_all.deb ... Unpacking unattended-upgrades (2.3ubuntu0.3) over (2.3ubuntu0.1) ... Preparing to unpack .../5-gnupg2_2.2.19-3ubuntu2.2_all.deb ... Unpacking gnupg2 (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2.1) ... Setting up libssl1.1:arm64 (1.1.1f-1ubuntu2.16) ... Setting up isc-dhcp-client (4.4.1-2.1ubuntu5.20.04.3) ... Installing new version of config file /etc/apparmor.d/sbin.dhclient ... Setting up unattended-upgrades (2.3ubuntu0.3) ... Installing new version of config file /etc/kernel/postinst.d/unattended-upgrades ... Setting up gnupg-l10n (2.2.19-3ubuntu2.2) ... Setting up libssl-dev:arm64 (1.1.1f-1ubuntu2.16) ... Setting up gpgconf (2.2.19-3ubuntu2.2) ... Setting up openssl (1.1.1f-1ubuntu2.16) ... Setting up gpg (2.2.19-3ubuntu2.2) ... Setting up gnupg-utils (2.2.19-3ubuntu2.2) ... Setting up gpg-agent (2.2.19-3ubuntu2.2) ... Setting up gpgsm (2.2.19-3ubuntu2.2) ... Setting up dirmngr (2.2.19-3ubuntu2.2) ... Setting up gpg-wks-server (2.2.19-3ubuntu2.2) ... Setting up gpg-wks-client (2.2.19-3ubuntu2.2) ... Setting up gnupg (2.2.19-3ubuntu2.2) ... Setting up gnupg2 (2.2.19-3ubuntu2.2) ... Processing triggers for systemd (245.4-4ubuntu3.17) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for libc-bin (2.31-0ubuntu9.9) ... tucky@armbian:~$

Let's take stock after this upgrade.

tucky@armbian:~$ uname -a Linux armbian 5.15.52-flippy-74+o #138 SMP PREEMPT Sat Jul 2 23:56:29 CST 2022 aarch64 aarch64 aarch64 GNU/Linux tucky@armbian:~$ cat /etc/debian_version bullseye/sid tucky@armbian:~$ cat /etc/armbian-image-release # PLEASE DO NOT EDIT THIS FILE BOARD=odroidn2 BOARD_NAME="Odroid N2" BOARDFAMILY=meson-g12b BUILD_REPOSITORY_URL=https://github.com/armbian/build.git BUILD_REPOSITORY_COMMIT=eef3b33 VERSION=22.08.0-trunk LINUXFAMILY=meson64 ARCH=arm64 IMAGE_TYPE=user-built BOARD_TYPE=conf INITRD_ARCH=arm64 KERNEL_IMAGE_TYPE=Image IMAGE_UUID=8945c6a7-0b17-47f4-8b57-2ade7e16bfdc tucky@armbian:~$ cat /etc/armbian-release # PLEASE DO NOT EDIT THIS FILE BOARD=odroidn2 BOARD_NAME="Aml s912" BOARDFAMILY=meson-g12b BUILD_REPOSITORY_URL=https://github.com/armbian/build.git BUILD_REPOSITORY_COMMIT=eef3b33 VERSION=22.08.0-trunk LINUXFAMILY=meson64 ARCH=arm64 IMAGE_TYPE=user-built BOARD_TYPE=conf INITRD_ARCH=arm64 KERNEL_IMAGE_TYPE=Image BRANCH=current tucky@armbian:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS" tucky@armbian:~$ cat /etc/ophub-release VERSION_CODEID='ubuntu' VERSION_CODENAME='focal' FDTFILE='meson-gxm-octopus-planet.dtb' UBOOT_OVERLOAD='u-boot-zyxq.bin' MAINLINE_UBOOT='/usr/lib/u-boot/' ANDROID_UBOOT='/usr/lib/u-boot/' KERNEL_VERSION='5.15.52' SOC='s912' K510='0' PACKAGED_DATE='2022-07-03' tucky@armbian:~$ cat /etc/os-release NAME="Ubuntu" VERSION="20.04.4 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Armbian 22.08.0-trunk Focal" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal

Clearly the FTD and UBOOT_OVERLOAD values in ophub-release are inaccurate and correspond to the default values which had to be modified to install the OS on the Alfawise S92 / Beelink GT1 TV box. The board is incorrectly identified in the /etc/amrbian-image-release. These are nit-picking cosmetic errors that have no bearing on the functioning of the system.

The htop utility shows that at idle the board is coasting with plenty of available memory and cpu capacity.

tucky@armbian:~$ free -h total used free shared buff/cache available Mem: 1.9Gi 179Mi 1.5Gi 3.0Mi 189Mi 1.6Gi Swap: 966Mi 0B 966Mi tucky@armbian:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT mmcblk0 179:0 0 14.9G 0 disk ├─mmcblk0p1 179:1 0 255M 0 part /boot └─mmcblk0p2 179:2 0 2.7G 0 part / mmcblk2 179:32 0 14.5G 0 disk mmcblk2boot0 179:64 0 4M 1 disk mmcblk2boot1 179:96 0 4M 1 disk zram0 254:0 0 965.3M 0 disk [SWAP] zram1 254:1 0 50M 0 disk /var/log zram2 254:2 0 965.3M 0 disk /var/tmp

The mmcblk0 device is the 16GByte SD card containing the Linux image. The mmcblk2 device is the internal 16GByte eMMC flash storage which is not mounted in the Linux file system, but on which Android is currently residing.

Here is a quick look at the typical Armbian storage configuration.

tucky@armbian:~$ df -h Filesystem Size Used Avail Use% Mounted on udev 833M 0 833M 0% /dev tmpfs 194M 3.3M 190M 2% /run /dev/mmcblk0p2 2.6G 1.4G 1.3G 53% / tmpfs 966M 0 966M 0% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 966M 0 966M 0% /sys/fs/cgroup /dev/zram2 948M 112K 884M 1% /var/tmp /dev/mmcblk0p1 255M 100M 156M 40% /boot /dev/zram1 49M 1.7M 44M 4% /var/log tmpfs 194M 0 194M 0% /run/user/1000

Note how /var/tmp and /var/log are mounted in "compressed" RAM which removes an important source of wear on the SD card. The /run directory is also memory mapped, but that is a typical situation. Unfortunately, the update did not resolve the degraded status of the init system.

tucky@armbian:~$ systemctl | grep failed UNIT LOAD ACTIVE SUB DESCRIPTION ● haveged.service loaded failed failed Entropy daemon using the HAVEGE algorithm ● networking.service loaded failed failed Raise network interfaces tucky@armbian:~$ sudo systemctl status haveged networking ● haveged.service - Entropy daemon using the HAVEGE algorithm Loaded: loaded (/lib/systemd/system/haveged.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2022-07-07 23:49:44 CST; 5min ago Docs: man:haveged(8) http://www.issihosts.com/haveged/ Process: 889 ExecStart=/usr/sbin/haveged --Foreground --verbose=1 $DAEMON_ARGS (code=exited, status=1/FAILURE) Main PID: 889 (code=exited, status=1/FAILURE) Jul 07 23:49:44 armbian systemd[1]: Started Entropy daemon using the HAVEGE algorithm. Jul 07 23:49:44 armbian haveged[889]: haveged starting up Jul 07 23:49:44 armbian haveged[889]: haveged: Couldn't initialize HAVEGE rng 5 Jul 07 23:49:44 armbian systemd[1]: haveged.service: Main process exited, code=exited, status=1/FAILURE Jul 07 23:49:44 armbian systemd[1]: haveged.service: Failed with result 'exit-code'. ● networking.service - Raise network interfaces Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled) Active: failed (Result: timeout) since Thu 2022-07-07 23:49:48 CST; 5min ago Docs: man:interfaces(5) Process: 686 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE) Main PID: 686 (code=exited, status=1/FAILURE) Jul 07 23:49:44 armbian ifup[686]: ifup: waiting for lock on /run/network/ifstate.eth0 Jul 07 23:49:48 armbian systemd[1]: networking.service: start operation timed out. Terminating. Jul 07 23:49:48 armbian ifup[686]: Got signal Terminated, terminating... Jul 07 23:49:48 armbian ifup[686]: ifup: post-up script failed Jul 07 23:49:48 armbian systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE Jul 07 23:49:48 armbian systemd[1]: networking.service: Failed with result 'timeout'. Jul 07 23:49:48 armbian systemd[1]: Failed to start Raise network interfaces. Warning: journal has been rotated since unit was started, output may be incomplete.

I tried ignoring these failures, but that caused all sorts of problems when trying to enable the wireless interface and edit the wired connection. So the next step is to get rid of these problems and a third related to the cron service that I encountered later.

Basic Fixes toc


With the newer Jammy image, there was no need to fix the two degraded service. Only the problem with crontab remained.
August 5, 2022

The haveged service generates entropy, meaning it generates a pool of random bits used by the random devices (/dev/random and /dev/urandom). Apparently too little entropy may slow down the connection to a Wi-Fi network. The reported error is a cache size problem according to the Ubuntu man page.

Couldn't initialize HAVEGE rng Invalid data or instruction cache size.

According to that same source the default size of the data cache is 16 KB. Surprisingly, explicitly setting the size at that level in the default configuration file /etc/default/haveged fixes the problem.

# Configuration file for haveged # Options to pass to haveged: # -w sets low entropy watermark (in bits) DAEMON_ARGS="-d 16 -w 1024"

Restart the service to see the effect.

tucky@armbian:~$ sudo systemctl restart haveged.service tucky@armbian:~$ sudo systemctl status haveged.service ● haveged.service - Entropy daemon using the HAVEGE algorithm Loaded: loaded (/lib/systemd/system/haveged.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2022-07-09 20:11:22 ADT; 5s ago Docs: man:haveged(8) http://www.issihosts.com/haveged/ Main PID: 2467 (haveged) Tasks: 1 (limit: 2001) Memory: 3.2M CGroup: /system.slice/haveged.service └─2467 /usr/sbin/haveged --Foreground --verbose=1 -d 16 -w 1024 Jul 09 20:11:22 armbian systemd[1]: Started Entropy daemon using the HAVEGE algorithm. Jul 09 20:11:22 armbian haveged[2467]: haveged starting up Jul 09 20:11:22 armbian haveged[2467]: haveged: ver: 1.9.1; arch: generic; vend: ; build: (gcc 8.3.0 CTV); collect: 128K Jul 09 20:11:22 armbian haveged[2467]: haveged: cpu: (VC); data: 16K (D P); inst: -1K (V); idx: 39/40; sz: 64688/64688 Jul 09 20:11:22 armbian haveged[2467]: haveged: tot tests(BA8): A:1/1 B:1/1 continuous tests(B): last entropy estimate 8.00435 Jul 09 20:11:22 armbian haveged[2467]: haveged: fills: 0, generated: 0

Truthfully, I am not sure this is a valid situation. The Arch Linux Haveged page recommends installing the service only if entropy is below 1000 and to use rng-tools otherwise. Elsewhere the low entropy mark was said to be 100. The problem is discussed at length in the Armbian Forums. The latest post I could find, seems to agree with the Arch Linux point of view, recommending rng-tools5 instead.

I tried rng-tools, rng-tools5, haveged and nothing and in all cases, the measure of entropy was the same.

tucky@armbian:~$ sudo cat /proc/sys/kernel/random/entropy_avail 256

In the end I just decided to put the problem aside and just disable the service altogether.

tucky@armbian:~$ sudo systemctl disable haveged.service Synchronizing state of haveged.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install disable haveged Removed /etc/systemd/system/default.target.wants/haveged.service.

I will not go into too much detail about the other failed service. It turns out that management of the network interfaces is split between Network manager and the systemd network service. I decided to remove the latter altogether because of the positive experience had with managing both the Ethernet and Wi-Fi interfaces with Network Manager in the Ubuntu Focal system installed on a Rock Pi S just a little while ago: 7. Configure the Network in OctoPrint on a Rock Pi S D4W. I found disabling networking.service was not sufficient. I removed the /etc/network/intefaces configuration file and the /etc/network/interfaces.d configuration directory - actually I "hid" them.

tucky@armbian:~$ sudo systemctl disable networking.service Synchronizing state of networking.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install disable networking Removed /etc/systemd/system/network-online.target.wants/networking.service. Removed /etc/systemd/system/multi-user.target.wants/networking.service. tucky@armbian:~$ cd /etc/network tucky@armbian:/etc/network$ ls if-down.d if-pre-up.d interfaces interfaces.default if-post-down.d if-up.d interfaces.d tucky@armbian:/etc/network$ sudo mv interfaces interfaces.delete-me tucky@armbian:/etc/network$ sudo mv interfaces.d interfaces.d.delete-me

There's probably a cleaner way of doing this, but it works. On rebooting, systemd had a clean status.

tucky@armbian:~$ sudo systemctl status ● armbian State: running Jobs: 0 queued Failed: 0 units

Finally, there seems to be an unusual number of interfaces.

tucky@armbian:~$ ip a 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: sit0@NONE: mtu 1480 qdisc noop state DOWN group default qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0 3: ip6tnl0@NONE: mtu 1452 qdisc noop state DOWN group default qlen 1000 link/tunnel6 :: brd :: 4: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 9e:61:69:00:11:22 brd ff:ff:ff:ff:ff:ff inet 192.168.1.144/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0 valid_lft 1532sec preferred_lft 1532sec inet6 fd00:fc:8d4f:71b2:2ad:1234:4567:89ab/64 scope global temporary dynamic valid_lft 535418sec preferred_lft 85839sec inet6 fd00:fc:8d4f:71b2:2ad:4321:7654:ba98/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 535418sec preferred_lft 401561sec inet6 fe80::ee6d:849:dddd:897/64 scope link noprefixroute valid_lft forever preferred_lft forever 5: wlan0: mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether f0:03:8c:11:22:33 brd ff:ff:ff:ff:ff:ff

A couple of these (sit0 and ip6nl0) that will probably never be used. They are part of the sit kernel module that can tunnel IPv6 datagrams in IPv4 packets and inversely tunnel IPv4 over IPv6 (see An introduction to Linux virtual interfaces: Tunnels for more details). Unfortunately, the sit module cannot be removed nor blacklisted because it is built into the kernel. I think that means that short of compiling a custom kernel image, those two extra interfaces will remain.

I ran into another problem later on when trying to set up a cron job.

tucky@armbian:~$ crontab -e crontabs/tucky/: fdopen: Permission denied

The default user is not a member of the crontab group, so fixing that seemed like it should solve the problem.

tucky@armbian:~$ sudo adduser tucky crontab Adding user `tucky' to group `crontab' ... Adding user tucky to group crontab Done. tucky@armbian:~$ exit logout

After opening a new session, it remained impossible to run crontab for the same reason as before. Here is a solution by Stéphane Millien that worked.

tucky@armbian:~$ sudo chmod 1730 /var/spool/cron/crontabs tucky@armbian:~$ sudo chown root:crontab /var/spool/cron/crontabs tucky@armbian:~$ crontab -e no crontab for tucky - using an empty one Select an editor. To change later, run 'select-editor'. 1. /bin/nano <---- easiest 2. /usr/bin/vim.basic 3. /usr/bin/mcedit Choose 1-3 [1]: 1

Basic Configuration toc

This section contains additional configuration that I find useful.

Less Password Prompting toc

To reduce the number of times that the password has to be entered add a sudoer file.

tucky@armbian:~$ echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee "/etc/sudoers.d/$USER-no-password" [sudo] password for tucky: tucky ALL=(ALL:ALL) NOPASSWD: ALL tucky@armbian:~$ sudo chmod 440 /etc/sudoers.d/$USER-no-password tucky@armbian:~$

There's an obvious reduction in security for this slight improvement in ease of operation. Consider removing this once the system is operating correctly.

Set the Time Zone toc

While I do not care to set the locale of a headless server, I prefer that the correct local time zone be set, especially since it is set to almost half way around the world be default.

tucky@armbian:~$ timedatectl Local time: Wed 2022-07-06 04:33:06 CST Universal time: Wed 2022-07-06 04:33:06 UTC RTC time: n/a Time zone: Asia/Shanghai (CST, +0800) System clock synchronized: yes NTP service: active RTC in local TZ: no tucky@armbian:~$ timedatectl list-timezones | grep Halifax America/Halifax tucky@armbian:~$ sudo timedatectl set-timezone America/Halifax tucky@armbian:~$ timedatectl Local time: Wed 2022-07-06 01:33:06 ADT Universal time: Wed 2022-07-06 04:33:06 UTC RTC time: n/a Time zone: America/Halifax (ADT, -0300) System clock synchronized: yes NTP service: active RTC in local TZ: no

Enable mDns Advertising toc

When playing with static IP addresses and Wi-Fi configuration, I prefer to install the avahi-daemon to make it easier to "find" the board on the local network.

tucky@armbian:~$ apt-cache policy avahi-daemon avahi-daemon: Installed: (none) Candidate: 0.7-4ubuntu7.1 Version table: 0.7-4ubuntu7.1 500 500 http://ports.ubuntu.com focal-security/main arm64 Packages 500 http://ports.ubuntu.com focal-updates/main arm64 Packages 0.7-4ubuntu7 500 500 http://ports.ubuntu.com focal/main arm64 Packages tucky@armbian:~$ sudo apt install avahi-daemon -y Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libavahi-common-data libavahi-common3 libavahi-core7 Recommended packages: libnss-mdns The following NEW packages will be installed: avahi-daemon libavahi-common-data libavahi-common3 libavahi-core7 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 173 kB of archives. After this operation, 779 kB of additional disk space will be used. Get:1 http://ports.ubuntu.com focal-security/main arm64 libavahi-common-data arm64 0.7-4ubuntu7.1 [21.4 kB] Get:2 http://ports.ubuntu.com focal-security/main arm64 libavahi-common3 arm64 0.7-4ubuntu7.1 [20.4 kB] Get:3 http://ports.ubuntu.com focal-security/main arm64 libavahi-core7 arm64 0.7-4ubuntu7.1 [73.2 kB] Get:4 http://ports.ubuntu.com focal-security/main arm64 avahi-daemon arm64 0.7-4ubuntu7.1 [58.0 kB] Fetched 173 kB in 1s (150 kB/s) Selecting previously unselected package libavahi-common-data:arm64. (Reading database ... 34930 files and directories currently installed.) Preparing to unpack .../libavahi-common-data_0.7-4ubuntu7.1_arm64.deb ... Unpacking libavahi-common-data:arm64 (0.7-4ubuntu7.1) ... Selecting previously unselected package libavahi-common3:arm64. Preparing to unpack .../libavahi-common3_0.7-4ubuntu7.1_arm64.deb ... Unpacking libavahi-common3:arm64 (0.7-4ubuntu7.1) ... Selecting previously unselected package libavahi-core7:arm64. Preparing to unpack .../libavahi-core7_0.7-4ubuntu7.1_arm64.deb ... Unpacking libavahi-core7:arm64 (0.7-4ubuntu7.1) ... Selecting previously unselected package avahi-daemon. Preparing to unpack .../avahi-daemon_0.7-4ubuntu7.1_arm64.deb ... Unpacking avahi-daemon (0.7-4ubuntu7.1) ... Setting up libavahi-common-data:arm64 (0.7-4ubuntu7.1) ... Setting up libavahi-common3:arm64 (0.7-4ubuntu7.1) ... Setting up libavahi-core7:arm64 (0.7-4ubuntu7.1) ... Setting up avahi-daemon (0.7-4ubuntu7.1) ... Created symlink /etc/systemd/system/dbus-org.freedesktop.Avahi.service → /lib/systemd/system/avahi-daemon.service. Created symlink /etc/systemd/system/multi-user.target.wants/avahi-daemon.service → /lib/systemd/system/avahi-daemon.service. Created symlink /etc/systemd/system/sockets.target.wants/avahi-daemon.socket → /lib/systemd/system/avahi-daemon.socket. Processing triggers for systemd (245.4-4ubuntu3.17) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for dbus (1.12.16-2ubuntu2.2) ... Processing triggers for libc-bin (2.31-0ubuntu9.9) ... tucky@armbian:~$ sudo nano -B /etc/avahi/avahi-daemon.conf

Start an avahi browser on the desktop and restart the service on the S92.

tucky@armbian:~$ sudo systemctl restart avahi-daemon

Almost immediately, the board will advertise itself.

michel@hp:~$ avahi-browse --all ... + enp4s0 IPv4 raspbian [9e:61:11:aa:bb:cc] Workstation local ... ^C

Change the Host Name toc

It is not a good idea to keep the default host name. When the avahi-deamon is installed this is a particularly bad idea should there be more than one computer with Armbian on the local network as their mDNS host name would be automatically differentiated by appended numbers assigned more or less randomly as in armbian-1.local, armbian-2.local, etc..

tucky@armbian:~$ sudo hostnamectl set-hostname crouton tucky@armbian:~$ cat /etc/hostname crouton tucky@armbian:~$ sudo nano -B /etc/hosts tucky@armbian:~$ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 crouton ::1 localhost armbian ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters

From now on, it is possible to open a session with the mDns hostname instead of the IP address.

michel@hp:~$ ssh tucky@crouton

Given the intended use of the TV box as a server hosting the home automation system, it makes more sense to set up a static IP address instead of relying on mDNS to find the machine. At first, I will want a static Wi-Fi connection to the LAN, but eventually the box may be moved and a wired connection will be used.

I doubt anyone would want to use the account and host names that are used here, so to make things easier for the reader, I will not use the crouton host name in what follows.

Disable IR Remote Control toc

The TV box came with an infrared (IR) remote control. It has a power button which can be used to turn the box on or off. Actually when the box is turned off with the remote, it is only partially powered down and can be rebooted with the remote. It might not be suitable to have a server that should be on at all times subject to be powered down by a stray remote signal. So until full control of this feature is enabled, I think it is best to disable the IR receiver module entirely.

tucky@armbian:~$ echo "blacklist meson_ir" | sudo tee "/etc/modprobe.d/blacklist-ir.conf"

Thanks to danboid for raising this issue which is also covered in How to build and use Armbian section entitled 12.5 Disable infrared receiver.

There is a surprising twist to this.

tucky@armbian:~$ sudo shutdown now ... [ 1370.452050] systemd-shutdown[1]: All DM devices detached. [ 1370.456995] systemd-shutdown[1]: All filesystems, swaps, loop devices and DM devices detached. [ 1370.485227] systemd-shutdown[1]: Syncing filesystems and block devices. [ 1370.489458] systemd-shutdown[1]: Powering off. [ 1370.493685] kvm: exiting hardware virtualization [ 1370.498263] hci_uart_bcm serial0-0: Cutting power to bluetooth module [ 1371.633380] pwrseq_simple sdio-pwrseq: Turning off mmc [ 1371.661275] reboot: Power down bl31 reboot reason: 0x8 bl31 reboot reason: 0x8 system cmd 0. bl30 get wakeup sources! process command 00000006 bl30 enter suspend! cpu clk suspend rate 1416000000 suspend_counter: 1 Enter ddr suspend first time suspend ddr suspend time: 1886us store restore gp0 pll process command 00000001 CEC cfg:0x0000 set vddee to 0x035cmv

It seems that the TV box is put into a standby mode in accordance with CEC (Consumer Electronics Control) standard designed to control HDMI connected devices such as televisions. Indeed pressing the power button on the infrared remote control restarted the box.

08915c0000000000exit_reason:0x02 set vddee to 0x03e8mv set vdd_cpu a to 0x0460mv set vdd_cpu a to 0x041amv store restore gp0 pll gp0 pll can't lock read gp0_ctrl 40000000 read gp0_ctrl2 b75020be read gp0_ctrl3 a59a288 read gp0_ctrl4 c000004d Enter ddr resume ddr resume time: 345us ...

The shutdown sequence is different when the system is halted.

tucky@armbian:~$ sudo halt ... [ 72.593939] systemd-shutdown[1]: All DM devices detached. [ 72.598973] systemd-shutdown[1]: All filesystems, swaps, loop devices and DM devices detached. [ 72.621341] systemd-shutdown[1]: Syncing filesystems and block devices. [ 72.624925] systemd-shutdown[1]: Halting system. [ 72.629222] kvm: exiting hardware virtualization [ 72.633841] hci_uart_bcm serial0-0: Cutting power to bluetooth module [ 73.770442] pwrseq_simple sdio-pwrseq: Turning off mmc [ 73.802966] reboot: System halted

In this state, the IR remote could not be used to reboot the box. In light of this information, it could be wise to overwrite the shutdown symbolic link with a short bash script that actually invokes the halt command.

tucky@domo:~$ sudo mv /usr/sbin/shutdown /usr/sbin/shutdown.org tucky@domo:~$ printf '#!/bin/bash\nhalt\n' | sudo tee /usr/sbin/shutdown tucky@domo:~$ sudo chmod +x /usr/sbin/shutdown

No matter if the original shutdown or halt command is used, the blue power LED on the TV box remains lit as long as the power supply is connected. Also 3.3 volts can be measured on the serial debug header. In other words, off doesn't mean off.

Network Configuration toc

Given my intent to use the TV box as a Linux headless server hosting a home automation system, it makes more sense to set up a static IP address instead of relying on mDNS to find the machine. Initially the box will replace a Raspberry Pi 3B that is connected to the local network with a wireless static IP address, so I will do the same here. Eventually, the server may be moved to another location with a wired connection to the LAN.

Enable Wi-Fi toc

The nmtui utility can be used to activate wireless network interface.

tucky@armbian:~$ sudo nmtui

Activating Wi-Fi in nmtui

Enter the wireless network password in the pop up window and click on the OK button

Password

Exit the utility and check the network interfaces, both will be activated.

tucky@armbian:~$ ip -4 a ... 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 inet 192.168.3.144/24 brd 192.168.3.255 scope global noprefixroute eth0 valid_lft 1500sec preferred_lft 1500sec 5: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 inet 192.168.3.145/24 brd 192.168.3.255 scope global dynamic noprefixroute wlan0 valid_lft 1765sec preferred_lft 1765sec

Reboot and check that this remains true. It should.

Static IP for a Network Interface toc

On my LAN, 192.168.3.xx where xx < 100 are in the pool of static IP addresses while 192.168.3.144 and 192.168.3.145 are in the pool of dynamic addresses assigned by the DHCP server. It is almost mandatory to set a static IP address when a system is a server. My prefered way of setting up the IP addresses of the two network interfaces is to set a fixed IP address for the interface that is most often used and to let the other interface obtain its IP address from the DHCP server on the local network. Since this appliance will in all likelihood be hardwired to the the LAN with an Ethernet cable, I edited the wired connection with nmtui, but I could just as easily modified the wireless connection as shown below.

As before, start the utility.

tucky@armbian:~$ sudo nmtui

In the main mntui menu chose the Edit a connection option and then select the Wi-Fi connection to edit.

Password

Set the IPv4 CONFIGURATION to <Manual> and enter the static IP address and the IP addresses of the gateway and DNS servers.

Password

Note that I have disabled IPv6. Here are the resulting IP addresses of the two interfaces.

tucky@armbian:~$ ip -4 a ... 5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 inet 192.168.3.144/24 brd 192.168.3.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever 5: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 inet 192.168.3.24/24 brd 192.168.3.255 scope global dynamic noprefixroute wlan0 valid_lft 1412sec preferred_lft 1412sec

Basically that means that should there be a major change to my LAN such a modification of the subnet used, I should be able to log into the Armbian using a Wi-Fi connection as long as the Wi-Fi network name and password were not changed. The "safest" setup would be a static IP address for the Wi-Fi interface and an automatic (DHCP assigned) IP address for the wired connection. That way it should be possible to connect to the system even if it is moded to another LAN.

While it is entirely possible to set a static IP address for both the wired and wireless interface, the static IP address given to the Wi-Fi connection must be different from the static IP address of the wired interface or any other device on the LAN for that matter.

Cleaning Up the Network Configuration toc

Looking at the network configuration after a reboot

tucky@armbian:~$ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0 3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1000 link/tunnel6 :: brd :: 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 66:77:88:4f:8e:f4 brd ff:ff:ff:ff:ff:ff inet 192.168.3.23/24 brd 192.168.3.255 scope global dynamic noprefixroute eth0 valid_lft 1783sec preferred_lft 1783sec inet6 fd00:fc:8d4f:71b2:abf5:a434:8dc5:72a1/64 scope global temporary dynamic valid_lft 535413sec preferred_lft 85938sec inet6 fd00:fc:8d4f:71b2:224c:ee3b:354:349c/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 535413sec preferred_lft 401556sec inet6 fe80::9ada:ade1:e6d3:15a5/64 scope link noprefixroute valid_lft forever preferred_lft forever 5: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether f0:03:8c:11:22:33 brd ff:ff:ff:ff:ff:ff inet 192.168.3.145/24 brd 192.168.3.255 scope global noprefixroute wlan0 valid_lft forever preferred_lft forever

IPv6 is still being set up, albeit not for the interfaces where it was disabled explicitly with nmtui. The usual way to disable IPv6 in Ubuntu is to modify the /etc/sysctl.conf configuration file. Instead of doing that directly, a supplementary configuration file can be added in the system control configuration directory.

tucky@armbian:~$ echo "net.ipv6.conf.all.disable_ipv6=1" | sudo tee "/etc/sysctl.d/local.conf"

It was assumed that local.conf did not exist, if it did a different file name could be used or the -a (append) flag could be used with the tee command.

Apparently, IPv6 can reappear. In that case, add ipv6.disable=1 to the APPEND value in /boot/uEnv.txt and to the append value in /boot/extlinux/extlinux.conf. Don't forget that the file belong to root.

I have had problems with Wi-Fi latency with other boards. Some attribute the problem to a Wi-Fi power-saving mode. Looking at the NetworkManager configuration files, it is not clear to me if the power-saving mode is enabled or not.

tucky@armbian:/etc/NetworkManager/conf.d$ cat 20-override-wifi-powersave-disable.conf [connection] wifi.powersave = 2 tucky@armbian:/etc/NetworkManager/conf.d$ cat default-wifi-powersave-on.conf [connection] wifi.powersave = 3

Which has precedence? I "solved" the problem by replacing both files with a single configuration file, /etc/NetworkManager/conf.d/20-wifi-powersave.conf that unambiguously disables the power saving mode.

[connection] # Values are 0 (use default), 1 (ignore/don't touch), 2 (disable) or 3 (enable). wifi.powersave = 2

Of course, if Wi-Fi is just a "backup" interface, then it would make more sens to enable the power saving feature. It is not entirely for stylistic considerations that solved was put in quotation marks above. I don't know if the Wi-Fi chip supports power management.

Move the OS to eMMC Storage toc

Quoting SteeMan in Installation Instructions for TV Boxes with Amlogic CPUs in the TV boxes FAQ:

After you are satisfied that your box is working correctly for your needs you can optionally copy the installation from the SD card to internal emmc storage (assuming your box has emmc). (Note: Installing to emmc has some risks of bricking your box. Don't do this unless you feel you understand how to reinstall the boxes android firmware) install armbian to emmc by running the appropriate shell script in /root, which is either /root/install-aml-s905-emmc.sh for s905 cpus or /root/install-aml.sh for all others: s905[x,w,l,x2,x3],s912,s922. Note that it is recommended that you make a backup of emmc first (use the ddbr tool that should be installed on your sd card). Also be prepared if anything goes horribly wrong with your emmc install to reinstall the android firmware using the Amlogic USB Burning Tool to unbrick your device. It is generally easy to find original android firmwares on the internet and you can generally (but not always) recover a bricked box using the Amlogic tool and an original firmware file.
Strike through added for reasons explained later

My experience only confirms the importance of this warning. Twice I had to reinstall Android on the box in the course of converting the TV box into a Linux machine.

Back Up the Configured Armbian Image toc

Still want to move the OS from the SD card to eMMC? Before copying the Armbian image on the SD card to eMMC storage, heed SteeMan's advice and back up the eMMC flash memory before overwriting it. Wish I had done that back in December 2019. Before that, let's make a back up of the SD card with the spanking new fixed up Armbian on it. There is a good reason for that as will be seen in the next section. Let's first determine the exact size of the image on the SD card.

tucky@domo:~$ sudo fdisk -l Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/mmcblk0: 14.95 GiB, 16025387008 bytes, 31299584 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xa2ff7aa3 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 139264 661503 522240 255M c W95 FAT32 (LBA) /dev/mmcblk0p2 663552 6291455 5627904 2.7G 83 Linux Disk /dev/mmcblk2: 14.46 GiB, 15518924800 bytes, 30310400 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/zram0: 966.98 MiB, 1013927936 bytes, 247541 sectors Units: sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/zram1: 50 MiB, 52428800 bytes, 12800 sectors Units: sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/zram2: 966.98 MiB, 1013927936 bytes, 247541 sectors Units: sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes

That is quite a few disks, but the relevant one at this point is mmcblk0.

Disk /dev/mmcblk0: 14.95 GiB, 16025387008 bytes, 31299584 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xa2ff7aa3 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 139264 661503 522240 255M c W95 FAT32 (LBA) /dev/mmcblk0p2 663552 6291455 5627904 2.7G 83 Linux

The two partitions on the SD card are contained in its first 6291455+1 sectors. The remaining 25008128 sectors (= 12.211 GB) are unallocated so they do not need to be backed up. Halt the TV box and transfer its SD card to an SD card reader on the desktop.

Got a warning about the incapacity to mount the ROOTFS.

ROOTFS not mountable

I decided to ignore this problem at this juncture. Instead, a byte for byte copy of the image is made with dd.

michel@hp:~/Téléchargements/OS/Armbian/Amlogic$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931,5G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi └─sda2 8:2 0 931G 0 part / sdb 8:16 0 447,1G 0 disk ├─sdb1 8:17 0 322,1G 0 part /home/michel/Téléchargements └─sdb2 8:18 0 125G 0 part /home/michel/Versions sdc 8:32 0 7,3T 0 disk ├─sdc1 8:33 0 2,4T 0 part /media/michel/photos ├─sdc2 8:34 0 2,4T 0 part /media/michel/data └─sdc3 8:35 0 2,4T 0 part /run/timeshift/backup sde 8:64 1 14,9G 0 disk ├─sde1 8:65 1 255M 0 part /media/michel/BOOT └─sde2 8:66 1 2,7G 0 part sr0 11:0 1 1024M 0 rom michel@hp:~/Téléchargements/OS/Armbian/Amlogic$ sudo umount /dev/sde1 michel@hp:~/Téléchargements/OS/Armbian/Amlogic$ sudo dd if=/dev/sde of=armbian_22.08_backup3.img bs=512 count=6291456 status=progress 3204694528 octets (3,2 GB, 3,0 GiB) copiés, 148 s, 21,7 MB/s ... 6291456+0 enregistrements lus 6291456+0 enregistrements écrits 3221225472 octets (3,2 GB, 3,0 GiB) copiés, 146,208 s, 22,0 MB/s

Be patient, that takes almost 3 minutes to complete.

michel@hp:~/Téléchargements/OS/Armbian/Amlogic$ sudo chown michel: armbian_22.08_backup3.img michel@hp:~/Téléchargements/OS/Armbian/Amlogic$ ls -l ... -rw-rw-r-- 1 michel michel 541997511 jui 6 21:23 Armbian_22.08.0_Aml_s912_focal_5.15.52_server_2022.07.03.img.gz -rw-r--r-- 1 michel michel 3221225472 jui 3 11:54 Armbian_22.08.0_Aml_s912_focal_5.15.52_server_2022.07.03.img -rw-r--r-- 1 michel michel 3221225472 jui 15 12:58 armbian_22.08_backup3.img

So the backup is the exact same size as the original image which is good.

Back Up the eMMC Storage toc

I didn't want to copy the old content of the eMMC storage onto the SD card containing the Armbian OS. Instead, I copied that image to a 32 GB USB stick with Balena etcher. After that its sole ext4 partition (ROOTFS) was expanded with gparted. That way there will be enough room on the partition to copy the current content of the eMMC.

It is possible to avoid using gparted on the desktop to expand the ROOTFS partition the USB stick. Boot from the USB stick as explained next and allocate the free space on the USB stick as per Use Armbian in TF/SD/USB.
tucky@domo:~$ sudo armbian-tf [ STEPS ] Welcome to use TF/SD/USB partition management tool. [ OPTIONS ] Do you want to expand or create partitions? Expand=(e) Create=(c): e [ STEPS ] Start to expand the current partition ... [ STEPS ] Install growpart or xfsprogs expansion and formatting tool ... Hit:1 http://ports.ubuntu.com focal InRelease Get:2 http://ports.ubuntu.com focal-security InRelease [114 kB] Get:3 http://ports.ubuntu.com focal-updates InRelease [114 kB] Get:4 http://ports.ubuntu.com focal-backports InRelease [108 kB] Get:5 http://ports.ubuntu.com focal-security/main armhf Packages [992 kB] Get:6 http://ports.ubuntu.com focal-security/universe armhf Packages [685 kB] Get:7 http://ports.ubuntu.com focal-security/universe arm64 Packages [817 kB] Get:8 http://ports.ubuntu.com focal-security/main arm64 Packages [1,362 kB] Get:9 http://ports.ubuntu.com focal-updates/main armhf Packages [1,353 kB] Get:10 http://ports.ubuntu.com focal-updates/main arm64 Packages [1,741 kB] Get:11 http://ports.ubuntu.com focal-updates/universe armhf Packages [958 kB] Get:12 http://ports.ubuntu.com focal-updates/universe arm64 Packages [1,096 kB] Fetched 9,339 kB in 2min 6s (73.9 kB/s) Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libreadline5 Suggested packages: xfsdump acl attr quota The following NEW packages will be installed: cloud-guest-utils libreadline5 xfsprogs 0 upgraded, 3 newly installed, 0 to remove and 10 not upgraded. Need to get 834 kB of archives. After this operation, 3,011 kB of additional disk space will be used. Get:1 http://ports.ubuntu.com focal/main arm64 libreadline5 arm64 5.2+dfsg-3build3 [94.6 kB] Get:2 http://ports.ubuntu.com focal/main arm64 xfsprogs arm64 5.3.0-1ubuntu2 [723 kB] Get:3 http://ports.ubuntu.com focal/main arm64 cloud-guest-utils all 0.31-7-gd99b2d76-0ubuntu1 [16.2 kB] Fetched 834 kB in 9s (97.3 kB/s) Selecting previously unselected package libreadline5:arm64. (Reading database ... 36224 files and directories currently installed.) Preparing to unpack .../libreadline5_5.2+dfsg-3build3_arm64.deb ... Unpacking libreadline5:arm64 (5.2+dfsg-3build3) ... Selecting previously unselected package xfsprogs. Preparing to unpack .../xfsprogs_5.3.0-1ubuntu2_arm64.deb ... Unpacking xfsprogs (5.3.0-1ubuntu2) ... Selecting previously unselected package cloud-guest-utils. Preparing to unpack .../cloud-guest-utils_0.31-7-gd99b2d76-0ubuntu1_all.deb ... Unpacking cloud-guest-utils (0.31-7-gd99b2d76-0ubuntu1) ... Setting up libreadline5:arm64 (5.2+dfsg-3build3) ... Setting up xfsprogs (5.3.0-1ubuntu2) ... update-initramfs: deferring update (trigger activated) Setting up cloud-guest-utils (0.31-7-gd99b2d76-0ubuntu1) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for libc-bin (2.31-0ubuntu9.9) ... Processing triggers for initramfs-tools (0.136ubuntu6.7) ... ln: failed to create hard link '/boot/initrd.img-5.15.52-flippy-74+o.dpkg-bak' => '/boot/initrd.img-5.15.52-flippy-74+o': Operation not permitted update-initramfs: Generating /boot/initrd.img-5.15.52-flippy-74+o [ STEPS ] Expansion Partition ... CHANGED: partition=2 start=663552 old: size=5627904 end=6291456 new: size=59842527 end=60506079 [ STEPS ] Expansion file system ... resize2fs 1.45.5 (07-Jan-2020) Filesystem at /dev/sda2 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 4 The file system on /dev/sda2 is now 7480315 (4k) blocks long. [ INFO ] Current partition information: Filesystem Type Size Used Avail Use% Mounted on /dev/sda2 ext4 29G 1.7G 27G 6% / [ SUCCESS ] The current partition expansion is successful.

To make a backup copy of the content of the eMMC using Armbian on the USB flash memory, shut down the TV box if it is not already done and make sure that there is no SD card in the card reader. Insert the USB flash memory into either USB connector and power up the box. The box will boot from the OS on the USB stick. The boot process is considerably slower than with the SD card, at least four times slower. Is this a problem with the chosen USB stick? In any case, there is plenty of room on the stick for a compressed copy of the eMMC storage.

tucky@domo:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 1 28.9G 0 disk ├─sda1 8:1 1 255M 0 part /boot └─sda2 8:2 1 28.5G 0 part / mmcblk2 179:0 0 14.5G 0 disk mmcblk2boot0 179:32 0 4M 1 disk mmcblk2boot1 179:64 0 4M 1 disk zram0 254:0 0 967M 0 disk [SWAP] zram1 254:1 0 50M 0 disk /var/log zram2 254:2 0 967M 0 disk /var/tmp estor@armbian:~$ df -h Filesystem Size Used Avail Use% Mounted on udev 835M 0 835M 0% /dev tmpfs 194M 3.2M 191M 2% /run /dev/sda2 13G 1.4G 27.1G 0.5% / tmpfs 967M 0 967M 0% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 967M 0 967M 0% /sys/fs/cgroup /dev/zram2 950M 112K 885M 1% /var/tmp /dev/sda1 255M 100M 156M 40% /boot /dev/zram1 49M 2.3M 43M 6% /var/log tmpfs 194M 0 194M 0% /run/user/1000

The backup utility is ddrb or is it armbian-ddbr as specified by ophub in Backup/restore the original EMMC system? Actually they are the same thing.

tucky@armbian:~$ ls -l /usr/sbin/*ddbr -rwxr-xr-x 1 root root 4542 Jul 3 11:54 /usr/sbin/armbian-ddbr lrwxrwxrwx 1 root root 22 Jul 3 11:54 /usr/sbin/ddbr -> /usr/sbin/armbian-ddbr

Using that utility is very simple.

tucky@armbian:~$ sudo ddbr [ STEPS ] Welcome to use the EMMC system backup/restore service. [ INFO ] The device name: [ Beelink GT1 ] [ INFO ] The device EMMC name: [ /dev/mmcblk2 ] [ INFO ] The device EMMC size: [ 14GB ] [ INFO ] The ddbr file path: [ /ddbr/BACKUP-arm-64-emmc.img.gz ] [ OPTIONS ] Do you want to backup or restore? Backup=(b) Restore=(r): b [ STEPS ] Start to backup the system in emmc. [ INFO ] Saving and Compressing [ /dev/mmcblk2 ] to [ /ddbr/BACKUP-arm-64-emmc.img.gz ], Please wait... 1.33GiB 0:04:06 [3.46MiB/s] [==> ] 9% ETA 0:40:27 ... 14.5GiB 0:33:31 [7.36MiB/s] [================================>] 100% 30310400+0 records in 30310400+0 records out 15518924800 bytes (16 GB, 14 GiB) copied, 2011.22 s, 7.7 MB/s [ SUCCESS ] Backup is complete. tucky@armbian:~$ ls -l /ddbr total 2411952 -rw-r--r-- 1 root root 2469830912 Jul 10 21:27 BACKUP-arm-64-emmc.img.gz

Note that 2469830912 bytes = 2411944,25 KiB = 2355,41 MiB = 2,30 GiB, so that it should be possible to make other backups of the content of the eMMC storage with the same USB drive. Be careful though, I do not know if the utility overwrites the BACKUP-arm-64-emmc.img. without warning. To avoid any possible error on that count, I renamed the backup file immediately.

Copy the OS on the SD Card to the eMMC Storage toc

The image obtained from ophub contains a utility to transfer the OS to the eMMC flash memory called armbian-install. Do not try to use armbian-config or an install.aml.sh script as suggested elsewhere. I had to go back to the Android firmware when I made that mistake.

The procedure is a little bit more complex than 8. Install Armbian to EMMC leads one to believe because the Amlogic S92 or the Beelink GT1 have not yet been added to the list of supported models (perhaps this is already fixed in the newer releases from ophub). I could not find much information on a custom installation with the utility, so here is what worked for me without any pretention that this is the correct way to go about it.

tucky@domo:~$ sudo armbian-install [ STEPS ] Start install armbian to emmc... [ STEPS ] Start initializing the environment... [ INFO ] DEV_EMMC: [ /dev/mmcblk2 ] [ STEPS ] Start selecting device... -------------------------------------------------------------------------------------- ID SOC MODEL DTB -------------------------------------------------------------------------------------- 101 s905d Phicomm-N1 meson-gxl-s905d-phicomm-n1.dtb 102 s905d Phicomm-N1-(DMA-thresh) meson-gxl-s905d-phicomm-n1-thresh.dtb 103 s905x HG680P-&-TBee meson-gxl-s905x-p212.dtb 104 s905w X96-Mini-&-TX3-Mini meson-gxl-s905w-tx3-mini.dtb 520 s905x3 A95XF3-Air-100Mb meson-sm1-a95xf3-air.dtb 0 Other Customize Enter-custom-dtb-name -------------------------------------------------------------------------------------- [ OPTIONS ] Please Input ID: 0 Please Input SoC Name: s912 Please Input DTB Name: meson-gxm-beelink-gt1.dtb Please Input UBOOT_OVERLOAD Name: u-boot-zyxq.bin Please Input MAINLINE_UBOOT Name: Enter - hoping there's a valid default value Please Input ANDROID_UBOOT Name: Enter - hoping there's a valid default value [ INFO ] Input Box ID: [ 0 ] [ INFO ] FDTFILE: [ meson-gxm-beelink-gt1.dtb ] [ INFO ] UBOOT_OVERLOAD: [ u-boot-zyxq.bin ] [ INFO ] K510: [ 0 ] [ STEPS ] Start selecting file system type... ----------------------------------------------- ID TYPE ----------------------------------------------- 1 ext4 2 btrfs ----------------------------------------------- [ OPTIONS ] Please Input ID: 1 [ INFO ] Input Type ID: [ 1 ] [ INFO ] The type of file system: [ ext4 ] [ STEPS ] Start creating eMMC partition... [ INFO ] Start backup default bootloader. 4+0 records in 4+0 records out 4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.290511 s, 14.4 MB/s 1+0 records in 1+0 records out 512 bytes copied, 0.00176237 s, 291 kB/s [ INFO ] Start create MBR and partittion. [ INFO ] Restore the mybox bootloader: [ /usr/lib/u-boot/mybox-bootloader.img ] 444+0 records in 444+0 records out 444 bytes copied, 0.0037894 s, 117 kB/s 8191+0 records in 8191+0 records out 4193792 bytes (4.2 MB, 4.0 MiB) copied, 0.45052 s, 9.3 MB/s [ STEPS ] Start processing the bootfs partition... [ INFO ] Formatting BOOTFS partition. mkfs.fat 4.1 (2017-01-24) [ INFO ] Start copy BOOTFS partition data. [ INFO ] Generate the new uEnv.txt file. [ INFO ] Generate the new extlinux.conf file. [ STEPS ] Start processing the rootfs partition... [ INFO ] Formatting ROOTFS partition. [ INFO ] Start copy ROOTFS partition data. [ INFO ] Copy the [ etc ] directory. [ INFO ] Copy the [ home ] directory. [ INFO ] Copy the [ lib64 ] directory. [ INFO ] Copy the [ opt ] directory. [ INFO ] Copy the [ root ] directory. [ INFO ] Copy the [ selinux ] directory. [ INFO ] Copy the [ srv ] directory. [ INFO ] Copy the [ usr ] directory. [ INFO ] Copy the [ var ] directory. [ INFO ] Generate the new fstab file. [ INFO ] Update the relevant parameters. [ SUCCESS ] Successful installed, please unplug the USB, re-insert the power supply to start the armbian.

Before removing the SD card and rebooting, I had a superficial look at what the armbian-install utility had done. For the curious here are the results. Don't forget, the TV box is running the Armbian image on the SD card. Just to help identify the OS images, an empty file was added in the /boot directory of the SD card. Then the two partitions on the eMMC storage were mounted into the running file system.

tucky@domo:~$ sudo touch /boot/armbian_sd_img.txt tucky@domo:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT mmcblk0 179:0 0 14.9G 0 disk ├─mmcblk0p1 179:1 0 255M 0 part /boot └─mmcblk0p2 179:2 0 2.7G 0 part / mmcblk2 179:32 0 14.5G 0 disk ├─mmcblk2p1 179:33 0 511M 0 part └─mmcblk2p2 179:34 0 13.7G 0 part mmcblk2boot0 179:64 0 4M 1 disk mmcblk2boot1 179:96 0 4M 1 disk zram0 254:0 0 965.3M 0 disk [SWAP] zram1 254:1 0 50M 0 disk /var/log zram2 254:2 0 965.3M 0 disk /var/tmp tucky@domo:~$ ls -l /mnt total 4 drwx------ 4 root root 4096 Jul 16 01:57 nand-sata-install.5zTdEC tucky@domo:~$ sudo mkdir /mnt/emmc0 tucky@domo:~$ sudo mount /dev/mmcblk2p1 /mnt/emmc0 tucky@domo:~$ ls -l /mnt/emmc0 total 95824 -rwxr-xr-x 1 root root 1536 Jul 16 22:02 armbian_first_run.txt.template -rwxr-xr-x 1 root root 38518 Jul 16 22:02 boot.bmp -rwxr-xr-x 1 root root 953 Jul 16 22:02 boot.cmd -rwxr-xr-x 1 root root 571 Jul 16 22:02 boot.ini -rwxr-xr-x 1 root root 1025 Jul 16 22:02 boot.scr -rwxr-xr-x 1 root root 208410 Jul 16 22:02 config-5.15.52-flippy-74+o drwxr-xr-x 3 root root 8192 Jul 16 22:02 dtb -rwxr-xr-x 1 root root 831 Jul 16 22:02 emmc_autoscript -rwxr-xr-x 1 root root 759 Jul 16 22:02 emmc_autoscript.cmd drwxr-xr-x 2 root root 8192 Jul 16 22:02 extlinux -rwxr-xr-x 1 root root 8069550 Jul 16 22:02 initrd.img-5.15.52-flippy-74+o -rwxr-xr-x 1 root root 5575080 Jul 16 22:02 System.map-5.15.52-flippy-74+o -rwxr-xr-x 1 root root 704408 Jul 16 22:02 u-boot-e900v22c.bin -rwxr-xr-x 1 root root 703444 Jul 16 22:02 u-boot.ext -rwxr-xr-x 1 root root 757153 Jul 16 22:02 u-boot-gtking.bin -rwxr-xr-x 1 root root 757080 Jul 16 22:02 u-boot-gtkingpro.bin -rwxr-xr-x 1 root root 735459 Jul 16 22:02 u-boot-gtkingpro-rev-a.bin -rwxr-xr-x 1 root root 702771 Jul 16 22:02 u-boot-n1.bin -rwxr-xr-x 1 root root 761012 Jul 16 22:02 u-boot-odroid-n2.bin -rwxr-xr-x 1 root root 553489 Jul 16 22:02 u-boot-p201.bin -rwxr-xr-x 1 root root 606670 Jul 16 22:02 u-boot-p212.bin -rwxr-xr-x 1 root root 609247 Jul 16 22:02 u-boot-s905.bin -rwxr-xr-x 1 root root 740080 Jul 16 22:02 u-boot-s905x2-s922.bin -rwxr-xr-x 1 root root 650183 Jul 16 22:02 u-boot-s905x-s912.bin -rwxr-xr-x 1 root root 709768 Jul 16 22:02 u-boot.sd -rwxr-xr-x 1 root root 754378 Jul 16 22:02 u-boot-sei510.bin -rwxr-xr-x 1 root root 754384 Jul 16 22:02 u-boot-sei610.bin -rwxr-xr-x 1 root root 758664 Jul 16 22:02 u-boot-tx3-bz.bin -rwxr-xr-x 1 root root 759112 Jul 16 22:02 u-boot-tx3-qz.bin -rwxr-xr-x 1 root root 694755 Jul 16 22:02 u-boot-u200.bin -rwxr-xr-x 1 root root 775483 Jul 16 22:02 u-boot-ugoos-x3.bin -rwxr-xr-x 1 root root 709768 Jul 16 22:02 u-boot.usb -rwxr-xr-x 1 root root 748175 Jul 16 22:02 u-boot-x96max.bin -rwxr-xr-x 1 root root 746678 Jul 16 22:02 u-boot-x96maxplus.bin -rwxr-xr-x 1 root root 703444 Jul 16 22:02 u-boot-zyxq.bin -rwxr-xr-x 1 root root 358 Jul 16 22:02 uEnv.txt -rwxr-xr-x 1 root root 373 Jul 16 22:02 uEnv.txt.noIPv6 -rwxr-xr-x 1 root root 8069614 Jul 16 22:02 uInitrd -rwxr-xr-x 1 root root 8069614 Jul 16 22:02 uInitrd-5.15.52-flippy-74+o -rwxr-xr-x 1 root root 25739776 Jul 16 22:02 vmlinuz-5.15.52-flippy-74+o -rwxr-xr-x 1 root root 25739776 Jul 16 22:02 zImage tucky@domo:~$ cat /mnt/emmc0/uEnv.txt LINUX=/zImage INITRD=/uInitrd FDT=/dtb/amlogic/meson-gxm-beelink-gt1.dtb APPEND=root=UUID=0bc0ab30-965e-4d98-b8fc-ac63d2dc085a rootflags=data=writeback rw rootfstype=ext4 console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 tucky@domo:~$ cat /mnt/emmc0/extlinux/extlinux.conf label Armbian kernel /zImage initrd /uInitrd fdt /dtb/amlogic/meson-gxm-beelink-gt1.dtb append root=UUID=0bc0ab30-965e-4d98-b8fc-ac63d2dc085a rootflags=data=writeback rw rootfstype=ext4 console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 loglevel=1 voutmode=hdmi disablehpd=false overscan=100 sdrmode=auto

These last two files are the same as those found on the SD card, except for the root UUID which corresponds to the unique identifier attributed to the ext4 partition on the eMMC.

tucky@domo:~$ cat /etc/fstab UUID=0bc0ab30-965e-4d98-b8fc-ac63d2dc085a / ext4 defaults,noatime,errors=remount-ro 0 1 LABEL=BOOT_EMMC /boot vfat defaults 0 2 tmpfs /tmp tmpfs defaults,nosuid 0 0

I did something similar with the / directory.

tucky@domo:~$ sudo mkdir /mnt/emmc1 tucky@domo:~$ sudo mount /dev/mmcblk2p2 /mnt/emmc1 tucky@domo:~$ ls /mnt/emmc1 bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin selinux srv sys tmp usr var tucky@domo:~$ ls -la /mnt/emmc1/home/tucky total 120 drwxr-xr-x 11 tucky tucky 4096 Jul 16 22:32 . drwxr-xr-x 3 root root 4096 Jul 2 04:08 .. -rw------- 1 tucky tucky 15163 Jul 17 00:24 .bash_history -rw-r--r-- 1 tucky tucky 220 Jul 2 04:08 .bash_logout -rw-r--r-- 1 tucky tucky 3857 Jul 11 01:48 .bashrc drwx------ 3 tucky tucky 4096 Jul 11 01:50 .cache drwxr-xr-x 3 tucky tucky 4096 Jul 2 04:08 .config drwxrwxr-x 6 tucky tucky 4096 Jul 13 16:33 .domopy drwxr-xr-x 7 tucky tucky 4096 Jul 17 00:25 domoticz drwxrwxr-x 3 root root 4096 Jul 16 22:22 ha-bridge drwxrwxr-x 4 tucky tucky 4096 Jul 11 01:44 .local drwxr-xr-x 3 tucky tucky 4096 Jul 2 04:08 .oh-my-zsh -rw-r--r-- 1 tucky tucky 807 Jul 2 04:08 .profile -rw-rw-r-- 1 tucky tucky 66 Jul 13 20:08 .selected_editor -rw-r--r-- 1 tucky tucky 0 Jul 2 06:05 .sudo_as_admin_successful drwxrwxr-x 6 tucky tucky 4096 Jul 11 01:49 tempy -rw-rw-r-- 1 tucky tucky 165 Jul 12 12:43 .wget-hsts -rw-r--r-- 1 tucky tucky 0 Jul 2 04:08 .Xauthority -rw-r--r-- 1 tucky tucky 3948 Jul 2 04:08 .zshrc tucky@domo:~$ sudo shutdown now

As can be seen, the user home directory is not bare. That's because I had installed the home automation system which includes Domoticz, HA Bridge and so on. Time to shut down the TV box cum Linux appliance to test the installation to eMMC.

I am happy to report that booting from the internal eMMC storage worked and the S92 TV Box running Armbian - Ubuntu 20.04.4 LTS (Focal) with a 5.15.52 Linux kernel is hosting the home automation system.

The End? toc

The system has been in operation, sometimes off, but mostly on for the last three weeks or so. For the most part everything works. The major exception is HA Bridge which was not unexpected. For some reason getting devices recognized by Alexa has failed up until now. I have not yet given up on that, so there may yet be good news on that front. Wireguard was built into the Armbian Linux image. Apparently nftables have not replaced iptables in this version of Linux, so copying the wg0.conf configuration file from the Raspberry Pi Buster installation of Wireguard and ensuring that IP forwarding was enabled was all that was needed to gain to the IoT devices from the Web. A test over a short holiday proved that the VPN server works just as before. There may be a follow-up post about installing Domoticz on this repurposed server in the next weeks if there's anything interesting to report.

This has been quite a journey which would not have been possible except for the much appreciated work of the many individuals engaged in the various Amlogic Linux communities. Again let me express my thanks for their contribution. It is very satisfying to give a new life to a piece of equipment that, as so often happens, had been abandoned by the manufacturer almost as soon as released.