Skip to content
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

OTA updates from server error 8 #3909

Closed
Mr-HaleYa opened this issue Apr 15, 2020 · 27 comments
Closed

OTA updates from server error 8 #3909

Mr-HaleYa opened this issue Apr 15, 2020 · 27 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@Mr-HaleYa
Copy link

I'm doing an OTA update from an HTTP server using the example. https://github.com/espressif/arduino-esp32/blob/master/libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino

I have it working now but I had to modify the Update.cpp file because I was getting an error: 8 even tho my magic bytes are starting correctly.

I deleted https://github.com/espressif/arduino-esp32/blob/master/libraries/Update/src/Updater.cpp#L218-L221

Now it works perfectly. I'm assuming this is a bug... I found an old issues post on here #325 that describes this problem but it has been closed a long time and it doesn't seem that the issue was fully fixed...

Is there any way to fix this other than modifying the library files?

@stale
Copy link

stale bot commented Jun 14, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jun 14, 2020
@Mr-HaleYa
Copy link
Author

So it looks like no one cares that there's a bug that makes it so that some Arduino devices can't use the Arduino ota update but whatever I guess lol it's a pretty easy fix for the user if they just want to delete the magic byte check (doesn't fix the problem but a quick way around it)

@stale
Copy link

stale bot commented Jun 16, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Jun 16, 2020
@viktak
Copy link

viktak commented Aug 6, 2020

Same issue here. I removed the lines @Mr-HaleYa suggested and the update process starts and finishes fine.

@stale
Copy link

stale bot commented Oct 6, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Oct 6, 2020
@Mr-HaleYa
Copy link
Author

Same issue here. I removed the lines @Mr-HaleYa suggested and the update process starts and finishes fine.

glad it worked for you. just wished someone would actually reply, even if to say this can be fixed (more like they won't since code can always be fixed) then have a useless stale bot close issues they don't want to reply to

@stale
Copy link

stale bot commented Oct 6, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Oct 6, 2020
@stale
Copy link

stale bot commented Dec 6, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Dec 6, 2020
@viktak
Copy link

viktak commented Dec 6, 2020

Keeping this issue alive....

@stale
Copy link

stale bot commented Dec 6, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Dec 6, 2020
@stale
Copy link

stale bot commented Feb 7, 2021

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Feb 7, 2021
@viktak
Copy link

viktak commented Feb 8, 2021

Still not resolved...

@stale
Copy link

stale bot commented Feb 8, 2021

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Feb 8, 2021
@star297
Copy link

star297 commented Mar 18, 2021

You could try something like what I use, just set the FIRMWARE_URL and call updateFIRMWARE() in your program.
Returns true if successful, restart and its done.
Works on HTTP and HTTPS url's.
I use it to download ota updates that I put on my from Firebase Storage, works every time.

#include <Firebase_ESP_Client.h>
#include <Update.h>
#include "HTTPClient.h"

HTTPClient http;

char      FIRMWARE_URL[256] = "firmware update URL";


int updateFIRMWARE()
{ 
  http.begin(FIRMWARE_URL);
  int httpCode = http.GET();
  if (httpCode <= 0) {
    //Error HTTP failed
    return 0;
  }
  int contentLen = http.getSize();
  bool canBegin = Update.begin(contentLen);
  if (!canBegin) {
    // Error, not  enough space for the new binary.
    return 0;
  }
  WiFiClient* client = http.getStreamPtr();
  size_t written = Update.writeStream(*client);
  if (written != contentLen) {
    // Error, wrote partial binary.
    return 0;
  }
  if (!Update.end()) {
    // Error from Update.end()
    return 0;
  }
  if (Update.isFinished()) {
   // Update successfully completed. Reboot to apply update.
   return 1;
  } else {
    // Error from Update.isFinished()
    return 0;
  }
}

@ziadalkalza
Copy link

@star297 Do you have a place where I can learn how to perform ota updates from the firebase storage? I tried looking at the library you included, but I'm not that experienced so I need some help with it.

@star297
Copy link

star297 commented May 17, 2021

Create a Firebase account here:
https://firebase.google.com/products/realtime-database

You can look at our updater for some instructions:
This is a more advanced set up if you have many devices in many remote locations.
But there are no firmware files on the links at the moment.
https://esp-updater.netlify.app/docs/firebase

@ziadalkalza
Copy link

@star297 Thank you for the quick reply. Yeah I need it for a product that I'm making, so it's potentially (fingers crossed) going to be hundreds of devices worldwide. Therefore, I need the device to support future updates, so not only will I be able to update the mobile app, but also the esp32 device.

@sansillusion
Copy link

sansillusion commented May 17, 2021 via email

@ziadalkalza
Copy link

Why would I go through all that when I can just do an OTA update from the esp32 straight away. I'll basically tell the esp32 to update by sending a message via BLE (which is what the app uses) when a button is pressed on the mobile app. So that the esp32 can do its job and just fetch the bin file.

@sansillusion
Copy link

sansillusion commented May 17, 2021 via email

@star297
Copy link

star297 commented May 18, 2021

We found using Firebase Storage the best solution for multiple remote ESP32 device ota updates in our case.
The firmware can be compiled from any global location placed on Firebase Storage and uploaded to a device to any global location providing there's wifi connection.
Devices will check to see if there's firmware available when active, download and update automatically.

We have used ESP8266 with 4Mbyte Flash, but we needed more analog functions.
Plenty of space for SSL even with a very large program.

@ziadalkalza
Copy link

@star297 Yes this was my initial approach, but I can't seem to find a way to:

  1. access the bin files from the Firebase storage securely.
  2. download the bin file into the OTA partition, so I can then restart the ESP32.
    How do you reckon I can go about doing that? I know there is a firebase arduino library but I'm still fairly new to this.

@ziadalkalza
Copy link

ziadalkalza commented May 19, 2021

Ok I think for a secure anonymous connection to the Firebase storage, all we need is to include the host link and the secrets authentication token in the device firmware. Conversely, if you want to use proper user sign in, you'll need to include the email and password.

Is my understanding correct? Or is there something I'm missing regarding this aspect of the code?

@stale
Copy link

stale bot commented Jul 20, 2021

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jul 20, 2021
@stale
Copy link

stale bot commented Aug 4, 2021

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Aug 4, 2021
@Introvertuous
Copy link

is anyone even maintaining this?

@reinerbraun99
Copy link

I'm doing an OTA update from an HTTP server using the example. https://github.com/espressif/arduino-esp32/blob/master/libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino

I have it working now but I had to modify the Update.cpp file because I was getting an error: 8 even tho my magic bytes are starting correctly.

I deleted https://github.com/espressif/arduino-esp32/blob/master/libraries/Update/src/Updater.cpp#L218-L221

Now it works perfectly. I'm assuming this is a bug... I found an old issues post on here #325 that describes this problem but it has been closed a long time and it doesn't seem that the issue was fully fixed...

Is there any way to fix this other than modifying the library files?

Hello, I have the same issue, and I'm trying to delete the lines you attached here, but it seems the source code of Updater.cpp has changed. Could you please give me the exact lines I must delete in Updater.cpp?

Best regards,
Rainier Adrian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

7 participants