Hello!
I am following this and am having some problems building the debug container.
I have an Ubuntu 16.04 development machine with the prerequisites already in place (Docker, Visual Studio Code, C# extension, .net core sdk 3.0).
I created the mytestapp directory, and inside it, ran dotnet new console
. Then code .
.
Then, for the settings.json file I have the following:
`{
“toradexdotnetcore.targetSSHPort”: “8023”,
"toradexdotnetcore.targetDevice": "172.16.100.69",
"toradexdotnetcore.SSHkey": "/containers/dotnetcoredbg/id_rsa",
"toradexdotnetcore.containersTemplatePath": "/containers",
"toradexdotnetcore.maindll": "mytestapp.dll",
"toradexdotnetcore.prjname": "mytestapp.csproj",
"toradexdotnetcore.containerParms": "",
"toradexdotnetcore.containerParms.debug": "",
"toradexdotnetcore.containerParms.release": "",
"toradexdotnetcore.containerTemplate.debug": "dotnetcoredbg",
"toradexdotnetcore.containerTemplate.release": "dotnetcore"
}`
I copied the containers directory from the repository into the mytestapp
directory.
When I run task builddebugcontainer
, it pulls the image and then I get:
Step 2/8 : RUN apt-get update && apt-get install -y unzip curl openssh-server rsync && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
---> Running in e68800a4926f
standard_init_linux,go:211: exec user process caussed "exec format error"
The command 'bin/sh -c apt-get update && apt-get install -y unzip curl openssh-server rsync && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*' returned a non-zero code:1
What am I missing?
Greetings @jaimeibk,
Apologies the article is a little unclear in that you need to configure your build environment. This is because the containers being built here are for arm32 machines such as our modules so you’ll need to emulate ARM instructions.
The following article describes how you can configure your machine for such: Configure Build Environment for Torizon Containers | Toradex Developer Center
Best Regards,
Jeremias
Hi, @jeremias.tx
Thank you for your response. Now that I have configured my build environment I have been able to successfully build and deploy the debug container, as well as to build the release container and running it in the target to get back the Hello World on console.
Where I found problems was in debugging. When I go to the debug window (.NET core launch (console) selected) and start debugging I get the following errors:
The preLaunchTask 'waitforsystemready' terminated with exit code 125.
Remember my choice in user settings.
And get three options: show errors, cancel, and debug anyway.
If I choose debug anyway, I get:
The pipe program 'ssh' exited unexpectedly with code 255
And get two options: cancel or Open launch.json
While in the console, the error I get is :
Error from pipe program 'ssh': ssh_askpass; exec(/usr/bin/ssh-askpass): No such file or directory
Error from pipe program 'ssh': Permission denied, please try again.
I did follow the instructions here to set up a passwordless ssh, but indeed, there is no ssh-askpass included in the Torizon, so I am not sure how to proceed here.
Regards!
Follow-up question:
To run the sample containers in the target, what other arguments do I need to add to the command docker run <sample-image>
?
Hi @jaimeibk,
I’m still looking into the issue about the debug error. Just to be clear I don’t believe ssh-askpass
has ever been in Torizon, so I don’t think the issue is there. Quick searches online reveal that there has been multiple similar cases with VScode having an error involving ssh-askpass
.
Just for clarification did this error pop up even without passwordless ssh set up?
As for your follow-up question, in short it depends on what kind of image you’re trying to run. Most well documented docker images should have instructions on what arguments to run alongside docker run. Otherwise you would need to understand what the container is doing to figure out what arguments need to be added.
Best Regards,
Jeremias
Hi, @jeremias.tx
The error comes up with and without passwordless ssh set up.
Hi @jaimeibk,
I ran through the example on my setup and while I didn’t run into your particular error I think I may know what is wrong.
First of all in your settings.json
file of your project the field toradexdotnetcore.SSHkey
. Is this file path correct and accessible from your project’s main folder? I noticed when I had this field incorrect and I tried to debug I got the following error in the debug console:
Error from pipe program 'ssh': Warning: Identity file ./dot-net-core/containers/dotnetcoredbg/id_rsa not accessible: No such file or directory.
Error from pipe program 'ssh': ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Error from pipe program 'ssh': Permission denied, please try again.
Error from pipe program 'ssh': ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Error from pipe program 'ssh': Permission denied, please try again.
Error from pipe program 'ssh': ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Error from pipe program 'ssh': root@10.12.1.54: Permission denied (publickey,password).
Which appears to be similar to your error.
Best Regards,
Jeremias
Hi, @jeremias.tx
SSHkey is the id_rsa in the host machine? I did change the path to that file, but still got the same response =/
Hi @jaimeibk
I specifically mean the id_rsa keys that were a part of the dot-net-core github repository that was cloned for the purpose of the demo: dot-net-core/containers/dotnetcoredbg at master · toradex/dot-net-core · GitHub
Hi, @jeremias.tx !
I will check this out. I generated a brand new id_rsa key, rather than copying the ones included in the repo. I am sure this will fix the problem, I just need to point to the correct key.
I have a couple more doubts on the dotnet matter:
- Does the
--privileged
flag allow the container to access the gpios through sysfs?? Does this not conflict with sysfs gpio access being deprecated?
- The sample for the srial port is not clear enough as to whether it needs additional parameters. Or does
SerialPort.GetPortNames()
scan all used uart ports?
- There’s also a
System.Device.Pwm
that I also need, but it calls for Chip, Channel, Frequency, DutyCycle
. Out of these, I am not sure as to what to pass to it to get it to work.
Thanks!
Hi @jaimeibk,
Does the --privileged flag allow the container to access the gpios through sysfs?? Does this not conflict with sysfs gpio access being deprecated?
So there are two things here, the privileged
flag for a docker container basically gives the container root access which it needs in order to access certain files/devices on the host system. As for the conflict, while sysfs is going to be deprecated, it does still currently work. And the particular System.Device.GPIO
api still relies on sysfs, unfortunately. I’m unaware if the dotnet libraries will be addressed to use a more modern GPIO interface.
The sample for the srial port is not clear enough as to whether it needs additional parameters. Or does SerialPort.GetPortNames() scan all used uart ports?
I believe you’re correct, in that it parses the ports based off of standard unix conventions/naming.
There’s also a System.Device.Pwm that I also need, but it calls for Chip, Channel, Frequency, DutyCycle. Out of these, I am not sure as to what to pass to it to get it to work.
So I’m not super familiar with the dot-net api/library being used for these samples but looking at the source it seems like this expects inputs similar to how we describe PWM usage here: High performance, low power Embedded Computing Systems | Toradex Developer Center
Please do mind though that while there is nothing wrong with the samples you’re using, they are a little dated. What this means it that with the first major release of Torizon coming within the next month or so, there may be major changes or revisions to all Torizon related articles and samples. So just keep this in mind if the documentation suddenly changes.
Best Regards,
Jeremias