Tool/software:
Hello,
I'm encountering an issue after migrating our AM437x-based project from SDK 8.x to the latest SDK 9.3.
When a USB drive with partitions is inserted directly into the USB port of our am437 system, our existing udev
rule is triggered correctly. This rule launches a mount.sh
script, which mounts the partitions successfully.
However, when connecting the same USB drive through a USB HUB, the behavior changes:
-
The
udev
rules still trigger correctly. -
mount.sh
is executed as expected. -
But inside
mount.sh
, the call tosystemd-mount
fails due to a dependency issue.
Specifically, systemd-mount
creates a transient unit like run-media-sda1.automount
, but this unit reports a failure caused by a device dependency not being fulfilled (e.g., dev-sda1.device
timed out or is inactive).
root@am437x-alx:~# systemctl status run-media-sda1.automount ○ run-media-sda1.automount Loaded: loaded (/run/systemd/transient/run-media-sda1.automount; transient) Transient: yes Active: inactive (dead) Triggers: ● run-media-sda1.mount Where: /run/media/sda1 May 19 21:18:23 am437x-alx systemd[1]: Dependency failed for run-media-sda1.automount. May 19 21:18:23 am437x-alx systemd[1]: run-media-sda1.automount: Job run-media-sda1.automount/start failed with result 'dependency'. May 19 21:20:03 am437x-alx systemd[1]: Dependency failed for run-media-sda1.automount. May 19 21:20:03 am437x-alx systemd[1]: run-media-sda1.automount: Job run-media-sda1.automount/start failed with result 'dependency'.
It seems to fail because dev-sda1.device also failed, and this is the status:
root@am437x-alx:~# systemctl status dev-sda1.device ○ dev-sda1.device - /dev/sda1 Loaded: loaded Active: inactive (dead) May 19 21:18:23 am437x-alx systemd[1]: dev-sda1.device: Job dev-sda1.device/start timed out. May 19 21:18:23 am437x-alx systemd[1]: Timed out waiting for device /dev/sda1. May 19 21:18:23 am437x-alx systemd[1]: dev-sda1.device: Job dev-sda1.device/start failed with result 'timeout'. May 19 21:20:03 am437x-alx systemd[1]: dev-sda1.device: Job dev-sda1.device/start timed out. May 19 21:20:03 am437x-alx systemd[1]: Timed out waiting for device /dev/sda1. May 19 21:20:03 am437x-alx systemd[1]: dev-sda1.device: Job dev-sda1.device/start failed with result 'timeout'.
But the thing is that /dev/sda1 is present and actually If I manually run a mount command (not systemd-mount) the partition mounts fine, its just when running systemd-mount thru a hub when it fails.
It seems like the device node /dev/sda1
eventually appears, but not in time for systemd
to satisfy the dependency when the transient mount is created.
These are the contents of the systemd rule "automount.rules" but I think are pretty much the default that came with the TI sdk
# Media automounting SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" SUBSYSTEM=="block", ACTION=="change", ENV{DISK_MEDIA_CHANGE}=="1" RUN+="/etc/udev/scripts/mount.sh"
For some reason I cannot attach the /etc/udev/scripts/mount.sh file but its the default that cames with the SDK that rely the actual mount to a systemd-mount binary call
Has anyone encountered this issue or can suggest how to make systemd
handle the delayed appearance of block devices more gracefully (especially via USB HUBs)?
Thanks in advance!