Dear Developers of Debian Linux on BeagleBone series,
(This is my first post to this forum.)
Thank you very much for developing and maintaining Debian Linux on BeagleBone series.
I recently installed Debian 12 on my BeagleBone Black (== BBB) (rev. C) from the image file
“am335x-debian-12.11-base-vscode-v6.12-armhf-2025-05-29-4gb.img.xz”.
Now, that BBB is running Debian 12 in a very good way.
During the installation, I connected the BBB to the host machine (MacBook Pro) with a serial cable.
On the serial console, we have seen the following messages in the early boot stage:
Starting kernel ...
[ 0.151515] l3-aon-clkctrl:0000:0: failed to disable
[ 10.527512] debugfs: Directory '49000000.dma' with parent 'dmaengine' already present!
[ 10.560296] gpio-of-helper ocp:cape-universal: Failed to get gpio property of 'P8_03'
[ 10.560323] gpio-of-helper ocp:cape-universal: Failed to create gpio entry
[ 11.013593] mdio_bus 4a101000.mdio: mii_bus 4a101000.mdio couldn't get reset GPIO
[ 11.203895] omap_voltage_late_init: Voltage driver support not added
trap: EXIT: bad trap
The message “trap: EXIT: bad trap” seems to be a problem.
I investigated the problem and have found that the message comes from the script “scripts/init-bottom/overlayroot”
in “/boot/initrd.img-6.12.28-bone27”, which is expanded on RAM in the early boot stage.
The script “overlayroot” has the following contents around the line 606 as
cfgd="${TEMP_D}/configs"
mkdir -p "${cfgd}" || fail "failed to create tempdir"
trap cleanup EXIT
This line “trap cleanup EXIT” causes the message “trap: EXIT: bad trap”, since “trap” in the current “/bin/sh” on RAM
in the early boot stage does not understand the pseudo signal “EXIT”. Accordingly, I have changed “trap cleanup EXIT”
to “trap cleanup 0”.
Even after this fix, I met another problem. The script “overlayroot” has the following contents around the line 73 as
cleanup() {
[ -d "${TEMP_D}" ] && rm -Rf "${TEMP_D}"
}
Now, “/bin/rm” does not exist in the file system expanded on RAM in the early boot stage.
In my understanding, “/bin/nuke” should be used instead of “/bin/rm”. Accordingly, I change the above code to
cleanup() {
[ -d "${TEMP_D}" ] && if command -v nuke >/dev/null; then
nuke "${TEMP_D}"
else
# shellcheck disable=SC2114
rm -rf "${TEMP_D}"
fi
}
The script “scripts/init-bottom/udev” contains the following code fragment around the line 22
to treat a similar situation as
if command -v nuke >/dev/null; then
nuke /dev
else
# shellcheck disable=SC2114
rm -rf /dev
fi
I was taught by this code fragment.
Consequently, the patch file for “scripts/init-bottom/overlayroot” becomes as follows
-----------------------------------------------------------------------------------------------------------------------
--- overlayroot.org 2025-06-06 16:08:41.744691032 +0900
+++ overlayroot 2025-06-06 16:08:41.752694872 +0900
@@ -70,7 +70,12 @@
exit 0; # why do we exit success?
}
cleanup() {
- [ -d "${TEMP_D}" ] && rm -Rf "${TEMP_D}"
+ [ -d "${TEMP_D}" ] && if command -v nuke >/dev/null; then
+ nuke "${TEMP_D}"
+ else
+ # shellcheck disable=SC2114
+ rm -rf "${TEMP_D}"
+ fi
}
debug() {
_debug "$@"
@@ -603,7 +608,7 @@
cfgd="${TEMP_D}/configs"
mkdir -p "${cfgd}" || fail "failed to create tempdir"
-trap cleanup EXIT
+trap cleanup 0
# collect the different config locations into a file
# write individual config files in $cfgd that contain
-----------------------------------------------------------------------------------------------------------------------
In order to reflect this change, I have manually modified “/boot/initrd.img-6.12.28-bone27” as
(as root)
cd /tmp/
mkdir AAA
cd AAA
zstdcat /boot/initrd.img-6.12.28-bone27 | cpio -id
mv scripts/init-bottom/overlayrootfs scripts/init-bottom/overlayrootfs.org
cp scripts/init-bottom/overlayrootfs.org scripts/init-bottom/overlayrootfs
emacs -nw scripts/init-bottom/overlayrootfs (***modify as above***)
find | cpio -o -H newc | zstd -c > ../initrd.img-6.12.28-bone27
cd ../
mv /boot/initrd.img-6.12.28-bone27 /boot/initrd.img-6.12.28-bone27.back
cp initrd.img-6.12.28-bone27 /boot/initrd.img-6.12.28-bone27
I also made the same modification to “/usr/share/initramfs-tools/scripts/init-bottom/overlayroot”
for future occasions to make “/boot/initrd.img-x.x.x-yy” by “mkinitramfs” and “update-initramfs”.
After reboot, everything seems to be fine. I do not see the message “trap: EXIT: bad trap” any more
in the early boot stage on the serial console.
Sincerely yours,
Satoshi Adachi