Post

ENG | Zimaboard & Debian (notes only)

These are low quality random, personal notes about first things to do on Debian 12 Bookworm when installed on IceWhale ZimaBoard 216. It does not include installing CasaOS on top of that.

ENG | Zimaboard & Debian (notes only)

Intro

These are trash quality notes about first things to do on Debian 12 Bookworm when installed on IceWhale ZimaBoard 216. It does not include installing CasaOS on top of that. It was installed on SSD drive, not integrated MMC storage.

Note that Zimaboard, for some reason, needs about 25s for boot using GRUB and it seems completely dead in that time. EFI boot is without issues.

In case boot loader on MMC storage gets broken, end of this article deals with recovery.

Many parts are not specific to Debian or Zimaboard.

Check-list

  • USB Drive
  • USB Keyboard
  • MiniDP->DP or MiniDP->HDMI cable
  • Network connection
  • SATA SSD

Prepare bootable USB

Tip: use Ventoy

TODO: article about ventoy

BIOS settings

To enter BIOS on Icewhale Zimaboard press Delete while bootin up many times. Then configure settings to boot from USB drive.

Later I discovered that boot device can be selected by pressing F11 during boot repeatedly.

Zimaboard ports. enp2s0 on the left, enp3s0 right. Needs keyboard and USB drive for install.

Debian 12 install

Select your country and mirror properly

If you chose wrong country (and timezone) fix it by ln -sf /usr/share/zoneinfo/Europe/Prague /etc/localtime

Check

  • SSH
  • Base

You may want to repartition disk differently, e.g. use more swap space

Partitioning tool is a bit clunky. It installs boot loader to eMMC drive without asking 😬

First things after install (fixing stuff)

Debian install somehow broke boot loader, so type reboot in grub menu and select select Windows Boot Loader in BIOS and reboot again.

Available text editor is nano and there’s no sudo command. su must be run as su - to setup up environment propertly, to get access to /usr/sbin for poweroff commands and so on. This is quite confusing and different from Ubuntu, Fedora or openSUSE.

Comment or delete DVD source from package repositories

NOTE: use nano preferably, vi(m) seems somewhat broken and not handling backspace correctly

1
nano /etc/apt/sources.list

It will look like this

1
2
3
4
5
6
deb http://mirror.dkm.cz/debian/ bookworm main non-free-firmware
deb-src http://mirror.dkm.cz/debian/ bookworm main non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb http://mirror.dkm.cz/debian/ bookworm-updates main non-free-firmware
deb-src http://mirror.dkm.cz/debian/ bookworm-updates main non-free-firmware

Upgrade packages

1
2
apt update
apt upgrade

Install useful packages

PackageDescription
curlFor curl wttr.in/Brno. Or as wget alternative
mcMidnight Commander / Classic File Manager
ncdunicer disk usage
net-toolsFor netstat, arp and obsolete ifconfig, route
whoisClient for the whois directory service
batA bat is much more cool animal than a cat
smartmontoolsTools for harddrive health checks
1
apt install curl mc ncdu net-tools whois bat smartmontools

Set larger, UTF-8 console font

See Chris Titus Tech -=- Setting Console Font, first two minutes are about Debian.

In short

1
dpkg-reconfigure console-setup

UTF-8, Latin2, TerminusBold, 10x18

Fonts are stored in /usr/share/consolefonts/ or in /etc/console-setup ?

Set some shell variables

Edit .bashrc and append this to the end.

1
2
3
4
5
# PavelP
export HISTFILESIZE=99999
export HISTSIZE=99999
export HISTTIMEFORMAT='%F %H:%M:%S '
shopt -s histappend

Do not use swap on MMC storage

Comment line below “# swap was on /dev/mmcblk0p3

1
nano /etc/fstab

Create EFI on correct disk

From Reddit Note: sda is SATA SSD here

1
2
3
4
5
6
7
8
9
10
11
12
root@stoat:~# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda            8:0    0 232.9G  0 disk
├─sda1         8:1    0   487M  0 part 
├─sda2         8:2    0   230G  0 part /
└─sda3         8:3    0   2.4G  0 part [SWAP]
mmcblk0      179:0    0  14.7G  0 disk
├─mmcblk0p1  179:1    0   512M  0 part /boot/efi
├─mmcblk0p2  179:2    0  13.2G  0 part 
└─mmcblk0p3  179:3    0 984.7M  0 part
mmcblk0boot0 179:256  0     4M  1 disk
mmcblk0boot1 179:512  0     4M  1 disk
1
2
3
4
5
apt-get install grub-efi
umount /boot/efi
mount /dev/sda1 /boot/efi
grub-install /dev/sda
update-grub

and fix /boot/efi in /etc/fstab

1
2
root@stoat:~# blkid /dev/sda1
/dev/sda1: UUID="D672-097A" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="b821977b-560b-435d-be0e-3e72824ea85c"

write down the first UUID (D672-097A)

Edit /etc/fstab accordingly.

1
2
3
4
5
6
7
8
9
10
# / was on /dev/sda2 during installation
UUID=8e0eedbf-1268-4133-b1a5-7db0fb5a3d09 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/mmcblk0p1 during installation 
# PavelP: and was fixed to /dev/sda1 later
UUID=D672-097A  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/mmcblk0p3 during installation
# PavelP: and was disabled later
# UUID=fbb20a51-8209-4cd5-858a-16281ff45dcf none            swap    sw              0       0
# swap was on /dev/sda3 during installation
UUID=efed6bab-b0d6-4673-aba0-16317bff6f26 none            swap    sw              0       0

Reboot

Make sure that proper disk is selected in Boot priorities, eg.

1
2
3
4
5
6
----------- Boot Option #1 -----------
debian (P1: Samsung SSD 850 EVO 250GB)
Window Boot Manager
debian (MMC- DA2016)
Disabled
--------------------------------------

Note: at this point we should fix Debian on MMC drive too.

Copy SSH keys from MMC drive (actually, do it vice versa)

Motivation for this step is not to break SSH when system is booted into Debian11/CasaOS on MMC drive.

1
2
3
mkdir /mnt/casaos
mount /dev/mmcblk0p2 /mnt/casaos
ls -la /mnt/casaos/etc/ssh/

Hell. You know what? These keys are not unique. Do it other way.

1
2
cd /etc/ssh
copy ssh_host_* /mnt/casaos/etc/ssh/

Now we have unique SSH keys on old Debian 11 and we may need delete matching lines from our .ssh/authorized_keys an all computers from which we connected to casaos. Otherwise you will see this message:

Keep these keys backed up for your computer. Reuse them when distribution is reinstalled.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
PS C:\Users\pavel> ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:CIBqB4NI2d4KpMnKlLAIgQTQtfbGl92CWaST4e9b6uc.
Please contact your system administrator.
Add correct host key in C:\\Users\\pavel/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\pavel/.ssh/known_hosts:7
ECDSA host key for 192.168.0.199 has changed and you have requested strict checking.
Host key verification failed.

After removing the key it’s ok:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PS C:\Users\pavel> ssh [email protected]
The authenticity of host '192.168.0.199 (192.168.0.199)' can't be established.
ECDSA key fingerprint is SHA256:CIBqB4NI2d4KpMnKlLAIgQTQtfbGl92CWaST4e9b6uc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.0.199' (ECDSA) to the list of known hosts.
[email protected]'s password:
Linux stoat 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
pavel@stoat:~$

Further things after install

Install AVAHI daemon

1
root@stoat:~# apt install avahi-daemon

and check it’s functionality

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
root@stoat:~# systemctl status avahi-daemon.service
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-07-11 21:22:38 CEST; 1min 5s ago

root@stoat:~# ping stoat.local
PING stoat.local (192.168.0.199) 56(84) bytes of data.
64 bytes from 192.168.0.199 (192.168.0.199): icmp_seq=1 ttl=64 time=0.064 ms
64 bytes from 192.168.0.199 (192.168.0.199): icmp_seq=2 ttl=64 time=0.116 ms
^C
--- stoat.local ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.064/0.090/0.116/0.026 ms

root@stoat:~# ping marten.local
PING marten.local (192.168.0.143) 56(84) bytes of data.
64 bytes from 192.168.0.143 (192.168.0.143): icmp_seq=1 ttl=64 time=0.445 ms
^C
--- marten.local ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.445/0.445/0.445/0.000 ms

Install uncessary stuff

1
2
3
apt install inxi neofetch 
apt install openbox tint2 xrdp
apt intall thunar xfce4-terminal

Setup remote access

Give some permission to user

  • loginctl enable-linger pavel to allow user session at boot
  • allow sudo
    • add user to sudo group
      1
      2
      
      su -
      usermod -aG sudo pavel
      
    • exit root session
    • logout
    • login
    • verify (sudo group has id 27)
      1
      2
      
      id
      sudo bash
      

Recover default boot (for Debian 11 on MMC)

Note: skip to option B, option A failed, I forgot something

Option A (using recovery distro, incomplete)

  • Prepare Debian live CD (e.g. debian-live-12.0.0-amd64-xfce.iso) on USB drive using Ventoy
  • Boot and press F11 repeatedly to enter BIOS Boot Menu and select USB drive
  • Once it boots (takes about three minutes to XFCE desktop) press Alt-F1 for console
1
2
3
4
5
6
7
8
9
10
11
sudo bash
mount /dev/mmcblk0p2 /mnt
mount --bind /dev  /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys  /mnt/sys
chroot /mnt
update-grub
# Here it's likely grub-install
exit
umount /mnt/sys /mnt/proc /mnt/dev /mnt
reboot

Option B (using grub)

  • Boot and press F11 repeatedly to enter BIOS Boot Menu and select MMC drive
  • Boot using grub manually (transcript from mobile screenshot follows, tab works for autocompletion)
1
2
3
4
5
6
grub> ls
(proc) (memdisk) (hd0) (hd0,msdos2) (hd0, msdos1) (hd1) (hd1,gpt3) (hd1,gpt2) (hd2,gpt1)
grub> set root=(hd1,gpt2)
grub> linux /boot/vmlinuz-5.10.0-23-amd64 root=/dev/mmcblk0p2
grub> initrd /boot/initrd.img-5.10.0-23-amd64
grub> boot
  • wait about 25s while seeing black screen
  • wait about 30s while linux tries to find swap partition where system might be hibernated (about 10 attempts)
  • wait about 1m30s for filesystem check
  • once it hopefully boots login as root/casaos
  • try to reinstall grub
    1
    2
    
    grub-install
    update-grub
    
  • reboot

Fix swap in fstab

For some reason fstab had wrong swap file. So I had to do something like

1
2
3
4
5
lslbk -o LABEL,UUID
lslbk -o LABEL,UUID | grep ffb >> /etc/fstab
vi /etc/fstab
grub-install
update-grub

Basically get correct uuid into fstab, launch vi, copy it into clipboard, paste it instead of bad one. This fixed unsuccessful attempts to find swap partition during boot.

Upgrade packages and do cleanup

Now it might be good time to upgrade packages and remove old kernel(s)

1
2
3
apt update
apt upgrade
apt remove linux-image-5.10.0-9-amd64

For some reason I noticed mysterious messages 🤯

1
2
3
[38.057029] EDAC pnd2: Unsupported DIMM in channel 0
[38.057030] EDAC pnd2: Unsupported DIMM in channel 1
[38.057031] EDAC pnd2: Failed to register device with error -22.

I have no clue how to fix them, they seem present at least since May2023 to Nov23 (now).

Summary

At this moment ZimaBoard is basically ready to be sold 😀 Congratulations!

(unless there are some private data inside docker containers or user directories)

This post is licensed under CC BY 4.0 by the author.