Hello everyone,
I’m experiencing issues with an application on my NVIDIA Jetson Xavier NX Developer Kit (JetPack version 5.1.3, Codename Jakku). The application communicates over two serial ports (/dev/ttyTHS0 and /dev/ttyTHS1) and works perfectly when I run it manually via SSH as the user vc. However, when I try to launch it automatically at boot—either using systemd or a cron wrapper—the serial ports appear to open correctly, but no data is transmitted or received.
System Details:
- Device: NVIDIA Jetson Xavier NX Developer Kit
- JetPack Version: 5.1.3 (Codename Jakku)
- User: vc (with proper group memberships, e.g., dialout)
- Serial Devices: /dev/ttyTHS0 and /dev/ttyTHS1 (both active as verified via systemctl)
Application Details:
- The application is located in my workspace (e.g., under
/home/vc/my_app
). - It requires a specific library path to be set (via
LD_LIBRARY_PATH
). - It behaves normally when run manually in an interactive session.
What I’ve Tried:
- Systemd Service Approach:
I created a service unit that:
- Waits for the network and the serial devices to be ready.
- Sets up the environment using an EnvironmentFile and explicit PATH.
- Adds supplementary groups for access to the serial ports.However, the service only functions properly if I manually restart it after logging in via SSH.
- Cron with a Wrapper Script:
I wrote a wrapper script that:
- Waits 20 seconds to allow for system and device initialization.
- Sources the user’s environment.
- Sets the required library path.
- Launches the application while logging its output.This script is scheduled in vc’s crontab with the
@reboot
directive. Despite this, the application fails to work correctly at boot, but when I manually restart it after an SSH login, it works as expected.
- User Switch via su/sudo:
I also attempted to run a wrapper as root that switches to the vc user using commands likesu - vc -c "..."
orsudo -u vc -H bash -l -c "..."
to force a full login environment for vc. Unfortunately, this approach still results in the serial ports opening without proper communication until I intervene manually post-boot.
Observations:
- At boot, the environment appears to be minimal compared to a full interactive SSH login. This might affect serial port initialization.
- Environment dumps indicate that certain session-specific variables and supplementary group information are not fully loaded until after a proper login session.
- Restarting the application manually after an SSH login consistently resolves the issue.
Questions:
- Has anyone encountered a similar issue with serial communication on the Jetson Xavier NX when launching applications via systemd or cron?
- What is the recommended method to force a full login environment (with all necessary environment variables and group memberships) for an application that relies on serial communication?
- Could there be any Jetson-specific initialization or timing issues affecting serial devices at boot?
I appreciate any insights or suggestions to ensure that my application receives the same environment and permissions as when I log in via SSH.
Thanks in advance for your help!