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

Avoid accidental downgrade (=bricking the device) #1927

Open
broth-itk opened this issue Apr 20, 2024 · 7 comments
Open

Avoid accidental downgrade (=bricking the device) #1927

broth-itk opened this issue Apr 20, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@broth-itk
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Well, it happed to me: I wanted to upgrade to the latest release but somehow I selected accidently an older version from the downloads folder.
The device rebooted and was obviously not available anymore.

I had to perform a complete reflash with the factory image and restore the configuration from backup.

Describe the solution you'd like

This problem might be easy to fix but some OpenDTU units might be installed in a not-so-easy-to-reach location.

I would like to suggest to

  • Include some kind of version number (integer) in an fixed address of the image, best somewhere at the beginning
  • Running OpenDTU checking if own version > upload version, then discard
  • If upload version is newer, proceed with the update as usual

Lets discuss the impact or maybe other ideas which would help.
Thanks!

Describe alternatives you've considered

No response

Additional context

No response

@broth-itk broth-itk added the enhancement New feature or request label Apr 20, 2024
@tbnobody
Copy link
Owner

I don't like the idea as it would prevent all users to downgrade if a version contains a mistake.

@MetaChuh
Copy link

@broth-itk

just for curiosity:
which older version did you flash, and was it the correct version for your board ?

i ask, because i can not reproduce a brick if i downgrade to a lower version within the scope of the last few months.
it would be nice and maybe helpful, to hear which version you used, and which esp32 type it was ment for, as well as on which esp32 type you flashed this version resulting in a temporary inoperable state (not brick)

after that you can close this issue.

thanks & greetings,
metachuh

@broth-itk
Copy link
Contributor Author

I'm not advocating against the possibility to downgrade. Don't get me wrong.
I just want to avoid the device getting bricked for some reason due to a mishap.

@MetaChuh The unit was running v24.3.31 and instead of installing v24.4.12 I uploaded v23.12.18

@broth-itk
Copy link
Contributor Author

What about a new version field which indicates the "generation" (including memory layout, configuration file format and so on):

  • Upgrades and downgrades within the same generation is possible.
  • Upgrade to newer generation only
  • No downgrade to older generation

@tbnobody
Copy link
Owner

tbnobody commented Apr 21, 2024

The downgrad to this version failed because of a bug in the upstream esp32 framework.
Feel free to create a PR implementing this checks. (and keep in mind, that memory is limited) But then you also have to check every release and check to which previous release it's possible to downgrade.
I don't have the resources to do this.

@broth-itk
Copy link
Contributor Author

This is not meant to be a "Arbeitsbeschaffungsmaßnahme" (work creation plan).

If there was an efficient way for the software to detect an older version, a message like "warning: attempting downgrade, are you sure" is sufficient.
... or a checkbox "allow downgrades" in the Firmware Upgrade section.

Any other ideas?

@MetaChuh
Copy link

@broth-itk

many ideas:
eg. instantaneous solutions:

  • clear the download folder of older downloads, before using any update files from there, or at least rename the files by adding the version number to the file name.
  • perform an upgrade via usb using the Web Flasher in Upgrade Mode (no downloads are needed)

possible code solutions:

  • the blocking has ideally to be done at the js side, e.g. by regexing the file name, which must then include the version number, compared to the own version number.
    any post upload method would appx require twice the space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants