/boot/dietpi/func/dietpi-banner: line 68: ((: == 20 : syntax error: operand expected (error token is "== 20 ")

I having some issues when my login promt loads the start up scripts.
The only debug interface I have is the UART.

What’s happening is that once I login, I get an error message and I cannot proceed.
It’s nothing wrong with the DIetPi distro, nor my custom board. The issue lies that I need to configure the start up scripts so they will work with my hardware.

I this case, I’m using my own boot loader, device tree and own kernel in my bootfs file system. My rootfs device is only loaded with the rootfs from DietPi.

Steps to reproduce

  1. Download DietPi_RPi-ARMv7-Bookworm.img.xz
  2. Extract DietPi_RPi-ARMv7-Bookworm.img.xz and you will get two img files.
  3. Place the dietpi folder from the small img (bootfs) file, into the boot folder of the larger img file (rootfs).
  4. chmod -R 777 . on all start up scripts inside /boot
  5. Rename all eth0 to end0 because my ethernet is named like that. I don’t know why.

Then flash the rootfs file to the eMMC and boot.

Expected behaviour

  1. I login
  2. Ethernet starts
  3. SSH will work

Actual behaviour

When I login with dietpi password, then this occurs.

[e[0;32m  OK  e[0m] Finished e[0;1;39msystemd-tmpfiles-…te Volatile Files and Directories.

         Starting e[0;1;39msystemd-timesyncd… - Network Time Synchronization...

         Starting e[0;1;39msystemd-update-ut…rd System Boot/Shutdown in UTMP...

[e[0;32m  OK  e[0m] Finished e[0;1;39msystemd-update-ut…cord System Boot/Shutdown in UTMP.

         Starting e[0;1;39msystemd-update-ut… Record Runlevel Change in UTMP...

[e[0;32m  OK  e[0m] Finished e[0;1;39mnetworking.servicee[0m - Raise network interfaces.

[e[0;32m  OK  e[0m] Reached target e[0;1;39mnetwork.targete[0m - Network.

[e[0;32m  OK  e[0m] Reached target e[0;1;39mnetwork-online.targete[0m - Network is Online.

[e[0;32m  OK  e[0m] Finished e[0;1;39msystemd-update-ut… - Record Runlevel Change in UTMP.

[e[0;32m  OK  e[0m] Started e[0;1;39msystemd-timesyncd.…0m - Network Time Synchronization.

[e[0;32m  OK  e[0m] Reached target e[0;1;39mtime-set.targete[0m - System Time Set.

You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or "exit"
to boot into default mode.
Give root password for maintenance
(or press Control-D to continue): 

/boot/dietpi/func/dietpi-banner: line 68: ((: == 20 : syntax error: operand expected (error token is "== 20 ")
 e[38;5;154m─────────────────────────────────────────────────────e[0m
 e[1mDietPi v9.7.1e[0m e[38;5;154m:e[0m e[91mReboot requirede[0m
 e[38;5;154m─────────────────────────────────────────────────────e[0m
 e[38;5;154m-e[0m e[1mLAN IP e[38;5;154m:e[0m Use dietpi-config to setup a connection (end0)
e[0m
e[Je[90m[e[0me[32m  OK  e[90m]e[0m e[90mDietPi-Login |e[0m Desired setting in e[33m/boot/dietpi.txte[0m was already set: e[33mAUTO_SETUP_AUTOMATED=0e[0m
e[0me[1;24re[4le(Be)0e[me[1;24re[He[Je[1;1H


┌───────────────────────────────┤ DietPi-Login ├───────────────────────────────┐e[5;1H│e[78C│e[6;1H│ [FAILED] Unknown install state/First run setup failede[24C│e[7;1H│e[78C│e[8;1H│ An error has occurred either during first run update or installs.e[12C│e[9;1H│e[78C│e[10;1H│ First run setup will now attempt to re-apply the last step, forced ase[8C│e[11;1H│ interactive run.e[61C│e[12;1H│ If this repeatedly fails, please collect all terminal output and the content │e[13;1H│ of /var/tmp/dietpi/logs/dietpi-firstrun-setup.log if available and report    │e[14;1H│ this issue to: https://github.com/MichaIng/DietPi/issuese[21C│e[15;1H│e[78C│e[16;1H│ Would you like to restart the first run setup and installation?e[14C│e[17;1H│e[78C│e[18;1H│e[21Ce[7m<Ok>e[25Ce[m<Cancel>e[20C│e[19;1H│e[78C│e[20;1H└──────────────────────────────────────────────────────────────────────────────┘e[18;24H

Extra details

I’m building a custom board. It’s not a Raspberry Pi. Hence, it’s still an Armhf architecture.

The DietPi will boot without the start up scripts, even if it will complain that one script is missing.
The ethernet is working when I run this

ip link set end0 up
udhcpc -i end0

Dropbear will not start at all!

You are in emergency mode. Did you try what the message suggested?

You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or "exit"
to boot into default mode.

can you share this file?

Does all partitions have been mounted correctly?
All files you copied have been transferred correctly and they are not corrupted?