Debug mode link layer is getting failed

I am using Acontis master it running well in release mode. When try run in debug mode my link layer is getting failed.

CEcDeviceBase::Open() Failed to open link layer!

emInitMaster(): Error opening EtherCAT device!

In debug mode where it will search for link layer.
in dockerfile I am COPY libemllFslFec.so /usr/local/lib/
I am also doing same in dockerfileDebug
Still its failing. In debug where it search for link layer.

RUN chmod -R a+rw /home/torizon    
RUN chmod -R a+rw /usr/local/lib/libemllFslFec.so
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf && ldconfig

CMD [ "/usr/sbin/sshd", "-D" ]

my yml file

services:
  acontisupdated-debug:
    build:
      context: .
      dockerfile: Dockerfile.debug
    image: ${LOCAL_REGISTRY}:5002/acontisupdated-debug:${TAG}
    privileged: true
    cap_add:
      - NET_ADMIN
      - NET_RAW
    #network_mode: host
    ports:
      - ${DEBUG_SSH_PORT}:${DEBUG_SSH_PORT}

    profiles:
      - debug
   

  Acontisupdated:
    build:
      context: .
      dockerfile: Dockerfile
    image: ${DOCKER_LOGIN}/acontisupdated:${TAG}
    privileged: true
    cap_add:
      - SYS_PTRACE
      - NET_ADMIN
      - NET_RAW
    ports:  
      - "2345:2345"   # gdbserver port 
      - ${DEBUG_SSH_PORT}:${DEBUG_SSH_PORT}
    profiles:
      - release

How to fix it?

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for your detailed question.

The issue you’re facing in debug mode is commonly related to how the EtherCAT link layer library (libemllFslFec.so) is found and loaded in the container environment. In debug mode, path or permission mismatches can prevent the library from being accessible.

Steps to Troubleshoot and Fix the Problem

1. Ensure Correct Library Location

You are already copying libemllFslFec.so to /usr/local/lib/, which is correct. Make sure the permissions are suitable, but it’s safer to use chmod 755 instead of granting read-write to all users:

COPY libemllFslFec.so /usr/local/lib/
RUN chmod 755 /usr/local/lib/libemllFslFec.so

2. Update the Loader Configuration

After copying the library, you need to make sure the dynamic linker is aware of this library path:

RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf && ldconfig

Ensure that the above command runs after the COPY and chmod steps.

3. Container Privileges and Capabilities

Your YAML setup looks mostly correct, but ensure you have the necessary capabilities for EtherCAT/Ethernet access, and the privileged: true flag is set. For debugging, it’s also helpful to add SYS_PTRACE if not already present.

Example:

privileged: true
cap_add:
  - NET_ADMIN
  - NET_RAW
  - SYS_PTRACE

4. Not Needed: Broad Permissions

Avoid running chmod -R a+rw /usr/local/lib/libemllFslFec.so or similar broad permission changes—these are not required and may introduce security risks.

5. Debug Command and Entry Point

Ensure your actual debug entry point starts the Acontis master with a command similar to this (tailored for your target):

./EcMasterDemo -fslfec 1 1 custom imx8m rgmii 7 nopinmuxing nomacaddr -t 0 -sp

Replace this with the appropriate command for your board.

6. Device/Interface Access

Make sure your debug container can access the correct network PHY. Also, verify the interface is available inside the container.

7. Kernel Module/Overlay

From BSP 6.6 onwards, you need to use device tree overlays to bind the Ethernet interface to the atemsys kernel module (the old BindFecToAtemsys.sh script is deprecated). Ensure the overlay is applied if you’re on a recent Toradex BSP.

Reference:
How to get started with Acontis EC-Master EtherCAT Stack


If you apply these points—especially ensuring permissions and library path are correct, and re-running ldconfig—your debug build should be able to find and load the link layer. If issues persist, double-check the container’s access to the network device (sometimes the debug container may see different interfaces than in release mode).

Let me know if this resolves your problem, or if you need more troubleshooting help!

Best regards,
Toradex AI Assistant.

Hi @kalai,

Could you please post the output of tdx-info from the board, so I could get all the hardware and software information, which would be helpful?

Sure, Thank you for your support.

torizon@verdin-imx8mm-14684109:~$ cd /var/rootdirs/media/6666-61352/
torizon@verdin-imx8mm-14684109:/var/rootdirs/media/6666-61352$ ls
 Appl   Components   Config   LogFiles  'System Volume Information'   Transfer
torizon@verdin-imx8mm-14684109:/var/rootdirs/media/6666-61352$ sudo rm -rf Components
Password: 
torizon@verdin-imx8mm-14684109:/var/rootdirs/media/6666-61352$ sudo rm -rf LogFiles  
torizon@verdin-imx8mm-14684109:/var/rootdirs/media/6666-61352$ ls
 Appl   Config  'System Volume Information'   Transfer
torizon@verdin-imx8mm-14684109:/var/rootdirs/media/6666-61352$ cd
torizon@verdin-imx8mm-14684109:~$ tdx-info
Please, run as root.
torizon@verdin-imx8mm-14684109:~$ sudo tdx-info
Password:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.148-6.8.0+git.8c5c2dcbf6ba #1-TorizonCore SMP PREEMPT Tue Aug 6 10:01:59 UTC 2024
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/f472cd7ec8bcef7cca7faeb40f675c70f0a511438c8c1b1ce68f8b2aff7a941c/0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.8.0-build.22
Distro variant:           VARIANT="Docker"
Hostname:                 verdin-imx8mm-14684109
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Mini on Verdin Development Board
Toradex version:          0057 V1.1B
Serial number:            14684109
Processor arch:           aarch64
------------------------------------------------------------
torizon@verdin-imx8mm-14684109:~$

Hi Rudhi,

Any updates?

Hello @kalai !

Since the release mode works but debug mode fails to load the link layer, please double-check that libemllFslFec.so is present and has correct permissions in /usr/local/lib inside your debug container (ls -l /usr/local/lib/libemllFslFec.so).

Also, run ldconfig -p | grep libemllFslFec to make sure the library is registered with the dynamic linker, and run ip link inside the container to confirm the expected network interface is available.

Additionally, please check for missing dependencies with ldd /usr/local/lib/libemllFslFec.so, and ensure you run ldconfig after copying the library in your Dockerfile.

Let me know what you find, and we can troubleshoot further if needed!