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.
Hello Markus,
Thank you for your detailed question!
This issue arises because sourcing environment scripts like setup-environment and using Repo within shell scripts can behave differently when run directly versus being invoked within debuggers or special shells (such as those invoked by the Bash Debug extension in VS Code).
Why does it fail in Bash Debug?
Many Yocto scripts, especially setup-environment, rely heavily on the current working directory, specific environment variables, and a clean shell environment. Debuggers may not honor these, or they may not maintain changes made by sourced scripts (such as modifying $PATH
), particularly when stepping versus running.
The error:
sha512sum: /layers/meta-toradex-torizon/scripts/setup-environment-internal: No such file or directory
usually means the script failed to find the expected Yocto workspace layout—often because the working directory or the sourced environment isn’t set up the way the script expects.
Recommendations
-
Use the Official Tools: For complex workflows like Yocto builds, it’s recommended to use the standard CLI in a Linux terminal, or leverage the Torizon IDE Extension for Visual Studio Code which is specifically designed for Toradex workflows instead of general shell script debuggers.
-
Debug in Steps: If you want to debug part of your script, consider isolating logic into smaller shell scripts/functions and debug those, or use
set -x
to trace steps. -
Modify launch.json: If you need to debug the full process, try setting the
"cwd"
property in yourlaunch.json
explicitly to where your Yocto environment and folders are set up, and ensure any environment variables (likeMACHINE
andEULA
) are included in the config.{ "version": "0.2.0", "configurations": [ { "type": "bashdb", "request": "launch", "name": "Bash-Debug (simplest configuration)", "program": "${file}", "cwd": "/absolute/path/to/your/build/folder", "env": { "MACHINE": "verdin-imx8mm", "EULA": "1" }, "terminalKind": "integrated" } ] }
-
Single-Stepping vs. Running: The fact that stepping works but running doesn’t suggests a timing or state issue—often related to (re-)setting environment or current working directory. Sourcing scripts dynamically changes the shell’s environment, but this doesn’t always propagate in subprocesses as expected with debuggers.
Further Reading
- Official instructions for building with Yocto/Repo
- Torizon IDE Extension for Visual Studio Code
- Community discussion of similar issues
Summary
For setting up and building Yocto/Torizon OS images, use the CLI or the Torizon IDE extension for best results. Debugging the shell scripts that source environment files within VS Code debuggers is non-trivial due to how these scripts modify their surrounding shell environment.
Let me know if you’d like tips on scripting the image build with just bash and logging, or if you’d like information about the Visual Studio Code Torizon extension!
Best regards,
Toradex AI Assistant.