-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using espressif/idf docker image on Raspberry PI to build application and flash the device (IDFGH-12342) #13373
Comments
Hello @krupis , have you tried to follow the hint message in the output.
It seems you are running the docker image as $USER and it may not have access rights to the |
I assume I have tried to run the following command on my Raspberry PI:
And then try to run the docker container, build and flash again but the same error persists |
yes, if Could you please check who owns the device with e.g. |
I have run the command that you have suggested and this is the result:
Its also important to note that I am running the docker using
Perhaps this is relevant? |
Have you tried this from a new shell? IIUC adding user to a group will not propagated to the current shell. You can check e.g. with There is also some docs related to this in the esptool https://docs.espressif.com/projects/esptool/en/latest/esp32/esptool/basic-options.html?highlight=dialout#serial-port
|
Ok, I think I understand now. The group is not propagated into the docker, so the user in docker is not in the |
@krupis you can start docker in privileged mode with '--privileged' option. It should help. |
@krupis if you don't want to run the container as privileged you can maybe use something like the following
|
I have checked which groups my user I have tried to run the command with
I have also tried what @fhrbata suggested Although there are a couple of things that I am confused about:
It binds to the root directory and not the project directory for some reason. I have to manually CD into project directory before running build or flash. Regardless of that small inconvenience, I was able to flash the device. See the full logs below:
The next step is to perform the same actions (run the docker image, build the project and flash the device) via the Gitlab CI/CD pipeline. I will update on how that goes. |
UPDATE I have setup gitlab-runner with docker executor on my Raspberry PI and trying to run the CI/CD pipeline as shown below:
It has failed as expected and the output is as following:
My question: My current
Perhaps you could clarify how to modify this as I am not sure how to add |
Hello @krupis ,
I believe you made a typo
IMHO the problem is that you are starting the container as privileged, but still setting the user to You can try the following, which shoudl work.
But note that all the files generated during build will be owned by root in the host directory, but maybe it's not a problem for you.
Probably because the
The project is build within the host directory, which is mounted into the docker container(
|
@fhrbata Thank you very much :) I can now run and flash the device using 3 methods:
Just make sure in the config.toml you change privileged to true Thanks for helping me out :) I will now continue with the automation and try to figure out what is the best method to automatically test our units after each Release. |
TBH I'm not that familiar with
Note I haven't tried this at all, just a quick look at the docs and my guess. Anyway, I believe this is not directly related to the esp-idf docker image and it's more about your ci configuration. I'm not sure if I'm able to help with this more. HTH |
Yeah that was it :) I have posted my reply above few seconds before you did. Thanks for all the help |
You're welcome, of course. I'll keep this discussion open for now. I'll discuss with other members of our team to see if we need to enhance our documentation regarding the scenario where the container is initiated under a specific non-root user, as recommended in our documentation. In this case, flashing may not be possible because the container user might not be added to the necessary 'dialout' group. Thank you! |
Answers checklist.
General issue report
Hello. I am currently experimenting with CI/CD, Jenkins and Docker. My goal is to automate build/flash process and run the HIL tests on my ESP32 board that is connected to Raspberry PI 4 via USB.
For this experiment, I have setup a simple Raspberry PI 4 and connected it to ESP32 Development board via USB. I can see that new device appears when I check with the command:
ls /dev/tty*
I can see that new device appears as /dev/ttyUSB0
To simply test serial communication, I have executed the following Python script on Raspberry PI:
and I can see that the messages are popping up, so the Serial port is working as expected
I have then tried to run the docker following the steps below:
CD into my project directory
cd /home/lukas/Projects/Embedded-FW-Guidelines
Run the docker image
Build the project using
idf.py build
Try to flash the device using
idf.py flash
The flashing fails because the docker container does not seem to detect the /tty/USB0 serial device. See the full logs below:
I have followed the espressif instructions and passed the serial port using the device option as described here:
Perhaps I am not doing it correctly? I would appreciate if someone could help me out :)
The text was updated successfully, but these errors were encountered: