# Persistent "Failed to download image due to 'connect ECONNREFUSED /var/run/balena-engine.sock" error

**URL:** <https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001>\
**Category:** Product support\
**Created:** [May 14, 2020, 6:07pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001 "2020-05-14T18:07:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![quietpynapple](https://avatars.discourse-cdn.com/v4/letter/q/dbc845/32.png) [@quietpynapple](https://forums.balena.io/u/quietpynapple)\
**Post date:** [May 14, 2020, 6:07pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/1 "2020-05-14T18:07:55Z")

</div>

Hi there,

I’m trying to set up the [Balena.io National Rail sign project](https://www.balena.io/blog/build-a-raspberry-pi-powered-train-station-oled-sign-for-your-desk/) on my Raspberry Pi 4, and I keep hitting the above error on first download-from-cloud device setup. Log snippets below:

> 14.05.20 18:45:07 (+0100) Supervisor starting  
> 14.05.20 18:45:11 (+0100) Applying configuration change {“SUPERVISOR\_POLL\_INTERVAL”:“900000”,“SUPERVISOR\_DELTA”:“1”,“SUPERVISOR\_DELTA\_VERSION”:“3”}  
> 14.05.20 18:45:11 (+0100) Applied configuration change {“SUPERVISOR\_POLL\_INTERVAL”:“900000”,“SUPERVISOR\_DELTA”:“1”,“SUPERVISOR\_DELTA\_VERSION”:“3”}  
> 14.05.20 18:45:12 (+0100) Creating network ‘default’  
> 14.05.20 18:45:12 (+0100) Creating volume ‘resin-data’  
> 14.05.20 18:45:13 (+0100) Downloading image [link removed to allow post]  
> 14.05.20 18:50:51 (+0100) Failed to download image [link removed to allow post] due to ‘connect ECONNREFUSED /var/run/balena-engine.sock’  
> 14.05.20 18:51:53 (+0100) Supervisor starting  
> 14.05.20 18:52:03 (+0100) Downloading image [link removed to allow post]  
> 14.05.20 18:57:48 (+0100) Failed to download image [link removed to allow post]due to ‘connect ECONNREFUSED /var/run/balena-engine.sock’  
> 14.05.20 18:59:25 (+0100) Supervisor starting  
> 14.05.20 18:59:26 (+0100) Downloading image '[link removed to allow post]

(This repeats over and over)

My Raspberry Pi 4 is connected to Ethernet, but it does the same over wifi as well, with refreshed SD card images on each occasion. It gets to anywhere between 20 and 60 percent complete before I get a ECONNREFUSED error. Does anyone have any advice?

I’ve granted 12 hours of support access for UDID 4dbdad259c01df1443125fa0ac23e27b. I’m new to balena so I’ve probably noobed it up somewhere…

Cheers in advance!

---

<div class="post-metadata">

**Author:** ![ab77](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ab77/32/2870_2.png) [@ab77](https://forums.balena.io/u/ab77)\
**Post date:** [May 14, 2020, 6:18pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/2 "2020-05-14T18:18:37Z")

</div>

Hi there, looking at the device diagnostics log, it would appear this device has issues with slow/corrupted SD card. Do you have another SD card you could try to re-provision with?

---

<div class="post-metadata">

**Author:** ![quietpynapple](https://avatars.discourse-cdn.com/v4/letter/q/dbc845/32.png) [@quietpynapple](https://forums.balena.io/u/quietpynapple)\
**Post date:** [May 14, 2020, 6:19pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/3 "2020-05-14T18:19:51Z")

</div>

I’ll dig around in the tat drawer and report back.

---

<div class="post-metadata">

**Author:** ![quietpynapple](https://avatars.discourse-cdn.com/v4/letter/q/dbc845/32.png) [@quietpynapple](https://forums.balena.io/u/quietpynapple)\
**Post date:** [May 14, 2020, 6:29pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/4 "2020-05-14T18:29:39Z")

</div>

No such luck - new one on order and will report back. Thanks!

---

<div class="post-metadata">

**Author:** ![ab77](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ab77/32/2870_2.png) [@ab77](https://forums.balena.io/u/ab77)\
**Post date:** [May 14, 2020, 6:31pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/5 "2020-05-14T18:31:06Z")

</div>

Cheers, please let us know how it goes with the new hardware.

---

<div class="post-metadata">

**Author:** ![quietpynapple](https://avatars.discourse-cdn.com/v4/letter/q/dbc845/32.png) [@quietpynapple](https://forums.balena.io/u/quietpynapple)\
**Post date:** [May 16, 2020, 7:06pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/7 "2020-05-16T19:06:26Z")

</div>

New SD card arrived from Amazon and that’s sorted everything! Thanks!

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 20, 2021, 10:30am UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/9 "2021-04-20T10:30:28Z")

</div>

Got the same problem here ☹

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 20, 2021, 10:57am UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/10 "2021-04-20T10:57:31Z")

</div>

![image](https://global.discourse-cdn.com/balena/original/2X/2/2a32a23b63722078fcd47e4fb5ebfbf171e419cc.png)

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 20, 2021, 11:26am UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/11 "2021-04-20T11:26:03Z")

</div>

There’s some really strange stuff going on here but I can still remote in.

 ![image](https://global.discourse-cdn.com/balena/original/2X/2/27ab7c678eec01876e3f83a21b6cb59b4e54b949.png)

Could somebody from balena pop in and have a look if I grant support access?

---

<div class="post-metadata">

**Author:** ![markcorbinuk](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/markcorbinuk/32/4771_2.png) [@markcorbinuk](https://forums.balena.io/u/markcorbinuk)\
**Post date:** [April 20, 2021, 12:33pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/12 "2021-04-20T12:33:54Z")

</div>

Hello @ajlennon  
Please grant support access and post the device UUID - we will take a look.

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 20, 2021, 12:57pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/13 "2021-04-20T12:57:08Z")

</div>

This is thoroughly strange! Now when I go to the device it forwards to a summary page which is blank!

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 20, 2021, 12:58pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/14 "2021-04-20T12:58:34Z")

</div>

I’ve granted support access on the “motioneye” app - based on the balena-motioneye one.

There’s only one device in there which is the problem

[https://dashboard.balena-cloud.com/apps/1819046/actions](https://dashboard.balena-cloud.com/apps/1819046/actions)

Thanks!

---

<div class="post-metadata">

**Author:** ![markcorbinuk](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/markcorbinuk/32/4771_2.png) [@markcorbinuk](https://forums.balena.io/u/markcorbinuk)\
**Post date:** [April 20, 2021, 1:01pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/15 "2021-04-20T13:01:43Z")

</div>

The blank summary page is related to an issue that our team are currently investigating at this end. See [https://status.balena.io/](https://status.balena.io/) for details.

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 20, 2021, 1:32pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/18 "2021-04-20T13:32:31Z")

</div>

Ah great - well anyway you should be able to get into the device now

---

<div class="post-metadata">

**Author:** ![markcorbinuk](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/markcorbinuk/32/4771_2.png) [@markcorbinuk](https://forums.balena.io/u/markcorbinuk)\
**Post date:** [April 20, 2021, 1:46pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/19 "2021-04-20T13:46:47Z")

</div>

I’ve had a look at the logs and can see that balena-engine is continually restarting. I’ve pinged our balena-engine team to look into this further.  
Do you have other devices running the same application and the same version of OS without any issues?

---

<div class="post-metadata">

**Author:** ![markcorbinuk](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/markcorbinuk/32/4771_2.png) [@markcorbinuk](https://forums.balena.io/u/markcorbinuk)\
**Post date:** [April 20, 2021, 2:22pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/47 "2021-04-20T14:22:24Z")

</div>

Hello @ajlennon  
It seems that the application has filled the `/mnt/data` partition completely which is preventing balena-engine from starting. The `/mnt/data/docker/volumes/1819046_media/` contains most of the data. Try clearing the contents of this volume, after backing it up as necessary, and see whether the device will then run normally.

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 20, 2021, 5:07pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/49 "2021-04-20T17:07:03Z")

</div>

Doh! I wish I had thought of that. Didn’t think it would fill up so quickly! Thanks very point for pointing it out to me.

A comment I would make is that overloading CPU or memory is always a cause of unexpected failure. It would be very good if the Balena framework could protect us from ourselves when we get these things wrong 😉

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 20, 2021, 9:48pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/50 "2021-04-20T21:48:45Z")

</div>

So I removed the data from the path as you suggested @markcorbinuk but I am still not fixed. Wondering if it to do with overlay being full?

 ![image](https://global.discourse-cdn.com/balena/original/2X/5/5f869c9cd0bb8aa3e9243cc663b596fa2503438a.png)

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ajlennon/32/63_2.png) [@ajlennon](https://forums.balena.io/u/ajlennon)\
**Post date:** [April 22, 2021, 1:28pm UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/51 "2021-04-22T13:28:08Z")

</div>

I can probably get in and reflash this over the weekend but I wondered if you had any thoughts in the meantime @markcorbinuk ? Thanks!

---

<div class="post-metadata">

**Author:** ![bearbobs](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bearbobs](https://forums.balena.io/u/bearbobs)\
**Post date:** [April 23, 2021, 9:45am UTC](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001/53 "2021-04-23T09:45:04Z")

</div>

@ajlennon ,faced similar issue.  
Fixed it by purging the data on my machine

[Next page](https://forums.balena.io/t/persistent-failed-to-download-image-due-to-connect-econnrefused-var-run-balena-engine-sock-error/114001.md?page=2)
