Failed to Download image -- balenalib/raspberrypi3-python --

Hello everyone, I’m a beginner in balenaOS.
I try to build a simple python app on my raspberry pi 3 using LOCAL MODE
But when I’m building the project on local mode ( command: balena push [DEVICE IP] )
Some errors have occurred on the building progress.
This is Error message:

could not get decompression stream: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/82/8234b0b48c81adef5b8cb7b82a34cf41ab7062ee01b3b2731a8e078ed0dc91d2/data?verify=1560422007-OhidOYYs%2BP1ixCnMld4JUQ03Reg%3D: read tcp 192.168.1.190:53174->104.18.122.25:443: read: connection reset by peer

So I click the above URL and get some strange error message like this.

{“status”:403,“message”:“InvalidCharacterError: atob() called with invalid base64-encoded data. (Only whitespace, ‘+’, ‘/’, alphanumeric ASCII, and up to two terminal ‘=’ signs when the input data length is divisible by 4 are allowed.)”}

I’m wondering how this issue happens.
If someone has solutions of this issue. I really want his help.
Thanks for your attention and wait good idea :blush:
Best regards.

Hello,

It looks like the network connection was unstable or there might be some other network error. Is it possible to try this again on a different connection, like ethernet?

If you keep seeing this error, we could further debug it for sure. Then it’d be useful to get support access to the device to run diagnostics. I’d need you to enable support access and also pass us the device UUID (which is what you see in the url on balena dashboard). If you prefer, I could send a private message to get the device UUID (in case you enable public device URL, you might prefer to keep this device identifier private).

Cheers.

Thanks for your guide.
OK, I’ll share my device UUID and grant device access to you.
I hope to process these actions in private environment.
If you’re ok, We can discuss realtime chat service.

** Now My device is connected in ethernet **
Best Regards. :slight_smile:

Hello,

Could you please clarify if you are still experiencing this issue or not? Does changing the connection resolve the issue?

If not, let us know. I sent you an email to gather the device UUID.

Cheers…

Hi, This issue is still alive.
I’ve sent device info just before.
Will wait for good news from you.
I’m still available.
Regards.

Since you’re device is offline currently I can’t debug this further, without trying to reproduce the issue myself.
Could you share a sample application that contains a minimal reproduction of the issue?

Hi, Now I’m trying to convert device status into online.
I’ve restarted the all containers and power off , restart But until now It’s all failed.
This is second action as I’ve ever used balena.
Will try backup soon and share it’s status.
Regards.

Hi @lucianbuzzo
Sorry for the late reply.
My device is online just before.
Can you help me with this issue?
Hope you reply.
thanks

Hi there, thanks for getting your device back online, but as my colleague @lucianbuzzo mentioned above we really need to see a sample application that we can run to reproduce the issue that you’re having. Can you share the project that causes this error when you try to push it to the device running in local mode? We can then try to run it here and figure out what is going on. Thank you!

Hi.
Here’s my project. It’s based on balena test project.


In Docker template file,
[ FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3-stretch-run ]
When I build the project into balena, It pulls above image from balenalib
But Errors have occurred as I mentioned above.
Will wait your reply.
Thank you :sunny:

Hey there @polluxdev33 thanks for sharing your project!

I tried building it and got an error, but it wasn’t the same as the error you got. Could you let me know what operating system you’re running on? If you happen to be running on Windows, sometimes we see issues with line endings which although I am not certain, might be an issue. You can read more here, but the project will need to have unix style line endings before you use balena push.

Next, it looks like you’ve added a couple of additional Python modules to our sample project (getmac and netifaces). These modules will require the build variant of our base images to use, so in your Dockerfile you’ll need FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3-stretch-build. With this change I was able to build and run your project.

I hope this helps!

Hi @chrisys
Thank you very much for your help.
My project is good to go according to your guide.
:+1:
I want your help one more.
Now I’m working on balena registry.
When I work on local mode, I need to pull docker images from a various registry such as docker hub.
In that case, I also faced the same issue in the before. ( Not rebuild project on local mode using your guide until now )
Is it the same problem or another?
What I want to know is

  1. Is it possible to pull images from various docker registry on local mode?
  2. If you use your guide on local mode, Can I fix the issue which is the same as before?
    Kind Regards.

You should be able to pull Docker images from registries such as the Docker Hub, Google Container Registry and others. You can even use private registries, as described here: https://www.balena.io/docs/learn/deploy/deployment/#private-base-images

I didn’t see a docker-compose.yml file in the project you shared earlier in this thread, but you could use the image instruction of a docker-compose file to pull images. I suppose you could also use multiple FROM instructions in a multistage Dockerfile. I am not aware of “local mode” restrictions regarding pulling images from registries. When you said you “faced the same issue”, what issue do you mean exactly?

Hi
When I work in local mode, I use this command for pulling images
" balena-engine pull [OPTIONS] NAME[:TAG|@DIGEST] "
But same errors have occurred as I mentioned above.

could not get decompression stream: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/82/8234b0b48c81adef5b8cb7b82a34cf41ab7062ee01b3b2731a8e078ed0dc91d2/data?verify=1560422007-OhidOYYs%2BP1ixCnMld4JUQ03Reg%3D: read tcp 192.168.1.190:53174->104.18.122.25:443: read: connection reset by peer


How can I set and get SUPERVISOR_API_KEY ?
and Auth Token???

I think you are coming from the following documentation page, right?

The BALENA_SUPERVISOR_API_KEY and BALENA_SUPERVISOR_ADDRESS environment variables should be automatically set and exposed inside an app container for single-container apps, while multi-container apps require the io.resin.features.supervisor-api label to be set. To contact the supervisor from outside an app container (“from the Internet”), the Auth Token can be found by clicking on your username at the top right corner of the web dashboard, selecting Preferences, then the Access Tokens tab. I think you can either use the Session token that expires every week, or click the Create API key button for a token that doesn’t expire.

When I work in local mode, I use this command for pulling images
" balena-engine pull [OPTIONS] NAME[:TAG|@DIGEST] "

I’ve just tested the command “balena-engine pull redis” on a local-mode device and it worked, so it’s strange that you are getting the “connection reset by peer” error. I’ve noticed that the error quotes a https URL. Can your device access other https URLs without problems?

On a separate note, could you expand on the reason why you need / want to manually execute the balena-engine pull command on the device? This seems like an unusual workflow. I would expect the images used by your application to be specified in a docker-compose file, which can then be pushed to local mode devices, as explained in the following guides:

Thank you :+1: :slightly_smiling_face:

Hi @pdcastro
I try to find out the supervisor api on the dashboard and local mode.
But never find out :shushing_face:
Can you guide me with more detail that gets supervisor api and address?
such as command or snapshot etc
Regards.

Hello @polluxdev33 https://www.balena.io/docs/reference/supervisor/supervisor-api/#http-api-reference contains all the info on the API. Basically you need set the io.balena.features.supervisor-api label for the service that needs access to the supervisor API. Once you do that, your service will have some extra env vars such as BALENA_SUPERVISOR_ADDRESS or BALENA_SUPERVISOR_API_KEY already populated and you can use them to talk to the supervisor from your application code.

Thanks.
But What I want to know is how to get extra env vars you mentioned above.
such as Location of target env vars or command to get env vars in terminal