OrangePi Zero conversion

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=10
G_DIETPI_VERSION_SUB=5
G_DIETPI_VERSION_RC=2
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’

echo $G_DISTRO_NAME $G_RASPBIAN
trixie

uname --all
Linux wh-orangepi-zero 6.18.40-current-sunxi #1 SMP Fri Jul 24 14:17:26 UTC 2026 armv7l GNU/Linux

dpkg --print-architecture
armhf

echo $G_HW_MODEL_NAME
Generic Device (armv7l) → actually OrangePi Zero v1.5

PSU: 5v 3A

SD Card: Transcend microSD 300s (8GB)

Additional Information (if applicable)

  • Migration script from Armbian to DietPi
  • Bug report ID | echo $G_HW_UUID
  • Tried to create a bug report but the process hangs once the error has happened.

Steps to reproduce

  1. Upgrade Armbian to DietPi
  2. Issue a reboot or shutdown command

Expected behaviour

System should reboot/shutdown

  • …

Actual behaviour

Console/prompt hangs

  • …

Extra details

I have converted Ambian Trixie to DietPi on OPi Zero v1.5. Everything looks OK but when I attempt a “reboot” or “shutdown” command the console hangs, and I can recover with CTRL+C. Afterwards “systemctl” is unresponsive and will hang in the same way. After some time the error “Failed to list units: Transport endpoint is not connected” returns. I have tried two different SBCs and two different SD cards with the same behaviour with every combination. NOTE that a cold reboot will return the system to a working state. I have console access and so can run any command that will provide more information as requested. Thank You.
…

  • …
paste lines of logs or code into such code fences here

Is this a root user session? Else try sudo reboot. DietPi ships with systemd-logind masked, and dbus uninstalled. That way, some privileges elevation like the ability to run systemctl as non-root user, as not available OOTB. Usually one should see

Failed to connect to system scope bus via local transport: No such file or directory

as systemctl attempts to gain the privileges via D-Bus from logind. But possible that in a transient state and shell, where a logind session was registered before, and some respective XDG_* variables set, this causes systemctl to be confused and hang. “Transport endpoint” at least sounds like it tried to connect to D-Bus, while it obviously tried in a different way compared to how it did when receiving above error message.

Hi Michalng, thanks for the reply. The behaviour is always seen in a root user session. I don’t see that DBUS message. It doesn’t seem to matter whether root is logged in on debug console ttyS0 or SSH. I could run a diagnostic command from one when it’s hung on the other if that would be any help? Just to clarify everything works Ok from a cold boot until i try “reboot” or “poweroff” - after that something gets broken.

Wait, you mean the reboot/poweroff/systemctl, commands are broken even after a power cycle, so it is not just a transient state right after dietpi-installer ran through in the same session?

Then probably something is broken on the base image already. Which one did you use?

Yes systemctl works OK after a cold boot, but once i issue a “reboot” or “shutdown” command the prompt “freezes” and I must use CTRL+C to break out of the hang. After this happens systemctl now does nothing and hangs in the same way - and here CTRL+C will also break back to the prompt. The image I used was Armbian Trixie from the page here - Orange Pi Zero | Armbian. Once it’s initial run was complete I applied the dietpi upgrade script immediately.

Hmm, that is surprising. The Armbian images should be clean.

The reboot and poweroff commands should just call systemctl start reboot.target and poweroff.target respectively, which do not invoke D-Bus. But somehow they seem to hang systemd. Maybe it partially shuts down already, but the shutdown sequence hangs sonewhere. Do you have a UART adapter to check whether you see the systemd shutdown sequence there?

I have been connected to the UART the whole time, because I needed that to run the dietpi migration script which drops the SSH connection. I include the entries from journalctl -bbelow that are between the login and CTRL+C from the hung reboot. Note that echo b | sudo tee /proc/sysrq-trigger will cause a restart and that will render systemctl working again.

Aug 08 16:43:38 DietPi login[462]: ROOT LOGIN ON ttyS0
Aug 08 16:44:15 DietPi systemd[1]: Unnecessary job was removed for dev-ttyS7.device - /dev/ttyS7.
Aug 08 16:44:15 DietPi systemd[1]: Unnecessary job was removed for dev-ttyS6.device - /dev/ttyS6.
Aug 08 16:44:15 DietPi systemd[1]: Unnecessary job was removed for dev-ttyS4.device - /dev/ttyS4.
Aug 08 16:44:15 DietPi systemd[1]: Unnecessary job was removed for dev-ttyS2.device - /dev/ttyS2.
Aug 08 16:44:15 DietPi systemd[1]: Unnecessary job was removed for dev-ttyS5.device - /dev/ttyS5.
Aug 08 16:44:15 DietPi systemd[1]: Unnecessary job was removed for dev-ttyS3.device - /dev/ttyS3.
Aug 08 16:44:15 DietPi systemd[1]: Unnecessary job was removed for dev-ttyS1.device - /dev/ttyS1.
Aug 08 16:44:15 DietPi systemd[1]: Removed slice system-modprobe.slice - Slice /system/modprobe.
Aug 08 16:44:15 DietPi systemd[1]: Stopped target timers.target - Timer Units.
Aug 08 16:44:15 DietPi systemd[1]: dpkg-db-backup.timer: Deactivated successfully.
Aug 08 16:44:15 DietPi systemd[1]: Stopped dpkg-db-backup.timer - Daily dpkg database backup timer.
Aug 08 16:44:15 DietPi systemd[1]: fake-hwclock-save.timer: Deactivated successfully.
Aug 08 16:44:15 DietPi systemd[1]: Stopped fake-hwclock-save.timer - Periodically save current clock.
Aug 08 16:44:15 DietPi systemd[1]: fstrim.timer: Deactivated successfully.
Aug 08 16:44:15 DietPi systemd[1]: Stopped fstrim.timer - Discard unused filesystem blocks once a week.
Aug 08 16:44:15 DietPi systemd[1]: systemd-tmpfiles-clean.timer: Deactivated successfully.
Aug 08 16:44:15 DietPi systemd[1]: Stopped systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories.
Aug 08 16:44:15 DietPi systemd[1]: Stopped target time-set.target - System Time Set.
Aug 08 16:44:15 DietPi systemd[1]: Stopped target usb-gadget.target - Hardware activated USB gadget.
Aug 08 16:44:15 DietPi systemd[1]: systemd-rfkill.socket: Deactivated successfully.
Aug 08 16:44:15 DietPi systemd[1]: Closed systemd-rfkill.socket - Load/Save RF Kill Switch Status /dev/rfkill Watch.
Aug 08 16:44:15 DietPi systemd[1]: Stopping cron.service - Regular background program processing daemon...
Aug 08 16:44:15 DietPi systemd[1]: Starting dietpi-kill_ssh.service - DietPi-Kill_SSH on shutdown...
Aug 08 16:44:15 DietPi systemd[1]: dietpi-postboot.service: Deactivated successfully.
Aug 08 16:44:15 DietPi systemd[1]: Stopped dietpi-postboot.service - DietPi-PostBoot.
Aug 08 16:44:15 DietPi systemd[1]: dietpi-postboot.service: Consumed 40.318s CPU time, 83.4M memory peak.
Aug 08 16:44:15 DietPi dropbear[457]: [457] Aug 08 16:44:15 Early exit: Terminated by signal

Right, makes sense, since NetworkManager drops any active connection when it is uninstalled.

So it really starts a shutdown sequence, but it does not reach far. What I do not see is cron and dietpi-kill_ssh finishing. From the latter, the dropbear early exit is coming, otherwise the SSH session remains active until network is deconfigured, so that SSH clients hang, instead of receiving a disconnect. But there should be a Stopped cron.service and Started dietpi-kill_ssh.service. Doesn’t say that any of these is causing the hang, but it is an easy test:

systemctl disable --now cron dietpi-kill_ssh
reboot

This is a great hint. During testing and development, I reached hanging systemd several times for several reasons. I didn’t know a better way to solve it than power cycle. /proc/sysrq-trigger is a neat direct kernel communication channel, to e.g. force a direct reboot, bypassing systemd entirely: Linux Magic System Request Key Hacks — The Linux Kernel documentation
Of course it means that disk sync and unmount is skipped, hence no assured data loss prevention, but still better than a power cycle, and the only option for remote systems. There are btw also commands to sync and attempt to remount drives R/O. So that can be attempted to prevent loss of potential data in write buffer:

echo s | sudo tee /proc/sysrq-trigger # sync
echo u | sudo tee /proc/sysrq-trigger # remount everything R/O
echo b | sudo tee /proc/sysrq-trigger # reboot

OK I disabled cron and dietpi-kill_ssh but the journalctl output is the same:

Aug 08 18:53:40 DietPi login[463]: ROOT LOGIN ON ttyS0
Aug 08 18:54:30 DietPi systemd[1]: Removed slice system-modprobe.slice - Slice /system/modprobe.
Aug 08 18:54:30 DietPi systemd[1]: Stopped target graphical.target - Graphical Interface.
Aug 08 18:54:30 DietPi systemd[1]: Stopped target multi-user.target - Multi-User System.
Aug 08 18:54:30 DietPi systemd[1]: Stopped target getty.target - Login Prompts.
Aug 08 18:54:30 DietPi systemd[1]: Stopped target timers.target - Timer Units.
Aug 08 18:54:30 DietPi systemd[1]: dpkg-db-backup.timer: Deactivated successfully.
Aug 08 18:54:30 DietPi systemd[1]: Stopped dpkg-db-backup.timer - Daily dpkg database backup timer.
Aug 08 18:54:30 DietPi systemd[1]: fake-hwclock-save.timer: Deactivated successfully.
Aug 08 18:54:30 DietPi systemd[1]: Stopped fake-hwclock-save.timer - Periodically save current clock.
Aug 08 18:54:30 DietPi systemd[1]: fstrim.timer: Deactivated successfully.
Aug 08 18:54:30 DietPi systemd[1]: Stopped fstrim.timer - Discard unused filesystem blocks once a week.
Aug 08 18:54:30 DietPi systemd[1]: systemd-tmpfiles-clean.timer: Deactivated successfully.
Aug 08 18:54:30 DietPi systemd[1]: Stopped systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories.
Aug 08 18:54:30 DietPi systemd[1]: Stopped target time-set.target - System Time Set.
Aug 08 18:54:30 DietPi systemd[1]: Stopped target usb-gadget.target - Hardware activated USB gadget.
Aug 08 18:54:30 DietPi systemd[1]: systemd-rfkill.socket: Deactivated successfully.
Aug 08 18:54:30 DietPi systemd[1]: Closed systemd-rfkill.socket - Load/Save RF Kill Switch Status /dev/rfkill Watch.
Aug 08 18:54:30 DietPi systemd[1]: dietpi-postboot.service: Deactivated successfully.
Aug 08 18:54:30 DietPi systemd[1]: Stopped dietpi-postboot.service - DietPi-PostBoot.
Aug 08 18:54:30 DietPi systemd[1]: dietpi-postboot.service: Consumed 40.155s CPU time, 83.6M memory peak.

I think I might have found the solution. I noticed in the dmesg output the following:

Aug 08 19:04:56 DietPi systemd[1]: dev-ttyS7.device: Job dev-ttyS7.device/start timed out.
Aug 08 19:04:56 DietPi systemd[1]: Timed out waiting for device dev-ttyS7.device - /dev/ttyS7.
Aug 08 19:04:56 DietPi systemd[1]: dev-ttyS7.device: Job dev-ttyS7.device/start failed with result 'timeout'.

This gave me a reason to look at the serial ports above ttyS0, and I found this:

cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A mmio:0x01C28000 irq:137 tx:3406 rx:168 RTS|DTR
1: uart:unknown port:00000000 irq:0
2: uart:unknown port:00000000 irq:0
3: uart:unknown port:00000000 irq:0
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
7: uart:unknown port:00000000 irq:0

So it looks like the kernel is enumerating serial devices that do not exist and then systemctl is trying to stop those phantom serial ports during reboot/shutdown. This is what is causing the hang. Unfortunately I can’t do systemctl list-jobs to show what is stalled/waiting, so instead I did the following:

systemctl mask dev-ttyS1.device

and so on, up to S7 and GS0. Now after a reboot the reboot and poweroff works correctly. If you know a neater way to handle this situation that will survive kernel upgrades etc. then please let me know, but for now it works.

I notice that disabling the serial ports in dietpi-config does the same thing as systemctl mask, but it would be nice to prevent the kernel from creating them in the first place. Does that have something to do with an incorrect DTB? I’m not sure about that - and I also see mention of dtoverlay=disable-uart online, but that may be for another SBC and might also disable ttyS0 ?

Oh yeah that makes totally sense. On unknown SBCs, where we don’t know for sure which UART device is the primary/debug port, we just enable all of them, which is why you see ttyS1 til ttyS7 all enabled, if those nodes /dev/ttyS* do all exist. But usually only 1-3 are actually usable as serial console, most likely ttyS0 being the primary serial console on pins 6+8 or the dedicated debug UART port (if it exists).

I did not recognize this causing issues before, but possible, and it isn’t clean anyway. What I thought about already is, to check via stty -F /dev/ttyS0 etc on each device whether that probe actually works, or whether it returns an “Input/output error”, in which case it is obviously not usable as console.

That will be difficult. These 8 device nodes exist on every mainline Linux, though with Debian kernel on x86_64 it is 4 only. But this does not require any device tree nodes, the kernel creates them automatically, no matter whether used or not, probably based on a build config value, so that it can be 4 or 8 or more on different kernel builds. It is similar to the 64 /dev/tty0 - /dev/tty63 nodes.

The dtoverlay= setting you saw is for Raspberry Pi only, with their closed source bootloader.

You should btw not mask dev-ttyS*.device units, but serial-getty@ttyS*.service, which is what dietpi-config does. For those devices which are anyway no true consoles, systemctl disable would be actually sufficient. We are additionally masking them, since, if they are functional, systemd may auto-generate and start them without being explicitly requested.

The dev-ttyS*.device units are created by udev tags as helper units, to assure serial-getty@ttyS*.service do start before udev configured the device. But the device units alone should not cause issues.

OK my understanding was that the system was waiting for dev-ttyS*.device so that’s the one I masked. Doesn’t the serial-getty@ttyS*.service just create a login prompt on the serial device ? But in my case the hang was caused by the device not the service ? I’m just trying to make sure I have it straight in my head :slight_smile:

Yes, the serial-getty@ttyS*.service units create the login prompt, like getty@tty*.service on the local console(s). But they pull in the respective dev-*.device units in the first place, and (attempt) to configure them, like setting the desired baud rate etc. With the getty services disabled, the device units should not appear in the boot and shotdown sequence at all.

OK. Thanks so much for all your help, everything seems to be working perfectly now. I would be happy to share the image with the community if it was acceptable as an unofficial version. The OPi Zero is perfectly capable of running armbian + dietpi and these boards are still available as the newer ones get more expensive !!! There is not a community dietpi image available for Trixie as far as I could find.

We can probably just add support natively. Not exactly much work, if the Armbian build system supports it based on mainline Linux: build/config/boards/orangepizero.csc at 6e1c7552d55f8c331a5ba9acedb3a243bcb96975 · armbian/build · GitHub
This is how it looks like integrating new SBCs our end in such case: Orange Pi 4 Pro / Orange Pi Zero 3W by MichaIng · Pull Request #8227 · MichaIng/DietPi · GitHub

Before hosting community images, which need to be maintained as well, this would be the better approach.

What I wonder is why they set HAS_VIDEO_OUTPUT="yes" explicitly and enable the tty1 console. This board does not have any video output port. Are there expansion boards or such, to get video output? But wouldn’t be the first time I see confusing/false variables in Armbian board configs, resulting from some copy&paste without careful validation. And this one is “CSC” community support only, no dedicated Armbian board maintainer.

Yes there is a hat available that adds extra USB ports and a composite video output. It’s compatible with all the zero (1/2/3) models - Orange Pi Expansion Board - Orangepi. It would be nice to see the OPi Zero supported, as it is ideal for small tasks like PiHole etc. The previous revision to mine, 1.4 is the LTS version with possible long-term availabilty. If there is any information you need from my running system just let me know.

PS unrelated I know but I’ve just been looking at the new update to 10.6.2 and I had a thought that as a function of the large hostname you could add a choice to display the hostname or else custom text so you could have “DietPi” in large letters in the same way that “Armbian” displays its name on login.

That is good to know. So console output needs to stay enabled, to assure users with this expansion board but without UART adapter, can get offline access.

I’d render a large “DietPi” in the banner as a waste of space :smile:. I mean you do have the “DietPi v10.6.2 : 21:41 - Sun 08/09/26” line at the top already, and the existence of the such styled banner, allows you to know immediately that you are on a DietPi system, and not accidentally connected to another server in your network, or so. This large hostname feature was added, with the aim to tell apart different DietPi servers quickly on first glace, without needing to look closer for the regular/small hostname entry, IP, or other identifiers.

But if you really see a benefit in this, we could open a feature request for an additional entry, to show a custom large text. Most flexible would probably a “custom large command” entry, so like the other custom commands, but not shown at the bottom, but instead shown at the top in large. Or a sub menu to select one of the added regular custom commands, to be shown (their output) at the top in large. So you could use echo 'DietPi' there, or a more complex command to show useful information in large.

OK I will take a look at the custom options. My last question on this topic concerns copying the current image I have running to another OPi Zero (I have two). What file do I delete or change so that once the second OPiZ boots it will run the first-run dialog again? Obviously if I just flash the image to another SD card it will be an identical set-up. Thanks.

Cleanest would be of course to save the image right after dietpi-installer ran through, after poweroff, before booting into first run setup.

You can also re-enable first run dialogs by re-enabling systemctl enable dietpi-firstboot before poweroff and image cloning. This service sets /boot/dietpi/.install_stage to 0 at boot, which triggers the dialogs on login. And it also generates unique Dropbear SSH keys, a unique machine ID, and applies a number of /boot/dietpi.txt settings. So you can change the initial hostname, network settings and stuff there, if needed.

But an issue remains, that you cannot clone this to a smaller SD card, but only to larger ones. You could shrink filesystem and partition of course. If you have another DietPi, Debian, or Ubuntu system, you could attach the SD card there, and use dietpi-imager to generate an image from it. This script can run on any regular Debian or Ubuntu as well. It minimizes the root filesystem size, then the partition, zeroes out empty space via zerofree, before generating an img file, and compressing it, for a minimal image size that fits on smaller SD cards. The dietpi-fs_partition_resize boot service is enabled as well, to have partition and filesystem automatically re-expended. Ah, the ext4 journal is also removed by the image, and re-added by the resize service. So it is sized and positioned well on any target SD card or drive.

But the preferable and cleanest solution remains to use also dietpi-imager on an image where dietpi-installer finished, without having it booted afterwards. So it is a fresh image in all regards.