How to downgrade addons?

Normally a snapshot restores the backed up version of the add-on. It is the only way to rollback an add-on.

1 Like

You can specify the version of esphome to use in the addon’s configuration section.

1 Like

Probably not the best example. Never the less I am also realizing that you need internet connectivity to restore a backup which kinda sucks.

Unfortunately I just did a complete update on my HA instance switching from 32-bit to 64-bit so there is really is no restore for me. Usually this isn’t a problem because bugs are just fixed in newer versions, however the last versions of Traccar are just completely broken since july and no fix seems to be in sight or planned:

There really needs to be an easy way of downgrading addons. I am not sure how you would go about downgrading an official addon. Does anyone have a list of steps to do that?

1 Like

Here’s the contents of one of my full snapshots. The screenshot shows the information saved for the core_mosquitto add-on.

It contains three files, mosquitto’s database and two configuration files, neither of which contains information about mosquitto’s version.

I encourage others to repeat this simple experiment and explore the contents of one of their snapshots (soon to be renamed backups) to understand precisely what it does, and doesn’t, contain.

EDIT
Nice screenshots but they hide a very important file that I failed to inspect: snapshot.json
It contains information about the contents of the snapshot file (the .tar file) including the Add-o’s version. In other words, when the snapshot is restored, it knows which version of the add-on should be restored (and pulls it from Docker Hub unless Supervisor hasn’t erased the old one yet).

There are no official instructions for doing that because replacing one container for another is normally a task handled by Supervisor (and only for upgrading an add-on).

EDIT
More or less true. Supervisor normally upgrades a container but it also knows how to downgrade it when restoring a backup that specifies an older version of the container. If necessary, Supervisor will download the older version.

Like I mentioned previously, you could try using Portainer to do it (a docker management UI) but I would not attempt the experiment on a production system (if you screw up badly, not even a Snapshot will help fix it). If you have never used Portainer then the first step is to install it and learn how to use it before attempting an add-on downgrade.

NOTE
There are docker commands (issued from the command line) that can also be used to replace containers but that’s even less-friendly (stop the container, remove the container, pull the desired container, etc).

EDIT
Yaddah-yaddah, don’t bother with all of this if you already have a snapshot of an older version of the Add-on.

Yes but if you revert the snapshot, supervisor will pull the older container.

Same with the official Tautulli addon, also broken since July.

It’s time for me to eat some crow. You’re absolutely right and I was wrong; a restored snapshot can indeed revert an Add-on to a previous version.

I failed to look in the right place within the tar file. Among its nested directories, there’s a snapshot.json file listing details about what’s in the tar file including an Add-on’s version.

I recently upgraded the Portainer Add-On to version 2.0 so I still had a snapshot for version 1.52. I restored the snapshot and, as you and francisp had explained, it reverted the add-on to 1.52 (i.e. behind the scenes it pulled the image for 1.52 because I now see two images for the same Add-on).

I have amended my previous comments to prevent leading other users astray. Thanks for being persistent about the facts.

2 Likes

Based on what I have learned here’s something that seems plausible (but I have not confirmed it yet). What if you want to downgrade an Add-on but don’t have a backup of it containing the desired older version?

  1. Make a partial backup containing just the current version of the Add-on.
  2. Open the tar file that was just generated and find snapshot.json.
  3. Modify the contents of snapshot.json. Change version to what you want.
  4. Save the changes and attempt to restore this altered backup file.

For example, here’s the snapshot.json file for a backup containing version 2.0.0 of the Portainer Add-on.

{
  "slug": "8a5ef12b",
  "name": "Just Portainer",
  "date": "2021-08-20T01:17:31.198321+00:00",
  "type": "partial",
  "addons": [
    {
      "slug": "a0d7b954_portainer",
      "name": "Portainer",
      "version": "2.0.0",
      "size": 0.03
    }
  ],
  "docker": {
    "registries": {}
  },
  "folders": [],
  "repositories": [
    "https://github.com/hassio-addons/repository"
  ],
  "homeassistant": {
    "port": 8123,
    "wait_boot": 600,
    "boot": true,
    "audio_input": "None",
    "watchdog": true,
    "ssl": false,
    "audio_output": "None",
    "version": "2021.8.7",
    "image": "ghcr.io/home-assistant/raspberrypi3-homeassistant",
    "refresh_token": "a23a0579e2cfd77d92562246988cfc706e28d873d60e577d3dca796be443594937698c72e57ada9eed7cffcf6b0b45f2da6e38626afac81084bc3d6f12d0b497"
  }
}

If I want to change to make it restore to version 1.5.1 (which I know is a valid older version) then I would change version in the file from 2.0.0 to 1.5.1

{
  "slug": "8a5ef12b",
  "name": "Just Portainer",
  "date": "2021-08-20T01:17:31.198321+00:00",
  "type": "partial",
  "addons": [
    {
      "slug": "a0d7b954_portainer",
      "name": "Portainer",
      "version": "1.5.1",
      "size": 0.03
    }
  ],
  "docker": {
    "registries": {}
  },
  "folders": [],
  "repositories": [
    "https://github.com/hassio-addons/repository"
  ],
  "homeassistant": {
    "port": 8123,
    "wait_boot": 600,
    "boot": true,
    "audio_input": "None",
    "watchdog": true,
    "ssl": false,
    "audio_output": "None",
    "version": "2021.8.7",
    "image": "ghcr.io/home-assistant/raspberrypi3-homeassistant",
    "refresh_token": "a23a...redacted"
  }
}

Save the file, restore from the modified snapshot and hope for the best. To reiterate, this is just a hypothesis and I have not tested it. However, if someone is hard-pressed to downgrade an Add-on, it might be worthwhile to carry out this simple experiment.

5 Likes

To make this harder to hypothesise, although the addon source is in this repo GitHub - hassio-addons/addon-portainer: Portainer - Home Assistant Community Add-ons, the details which the version relies on are in a separate repo repository/config.json at d99bb17f2d9bfaa2a424d9af8304eebaccc72e4f · hassio-addons/repository · GitHub

I just succeeded with restoring a backup that the addon made before the update. In my case it was the visual studio code server. I restored from the web frontend and it worked just fine.

1 Like

Here is my approach:

  1. Download ZIP with the older add-on version
  2. Copy it into /addons and unzip (I uploaded it using VSCode add-on and then just unzip from the Terminal & SSH addon)
  3. Go to add-on store, open the three-dots menu (top right corner) and click Check for updates
  4. You should see new Local add-ons section
  5. Install the add-on
5 Likes

I believe my Zigbee2MQTT add-on latest version has broken so device compatibility. To check/solve this I want to go back to a previous version. I do backups but it’s likely that I’ve already deleted those old backups.

Is there any way to just specify what version to pull? Can I “upgrade” to an old version in the ha cli?

No.

If you can document an error put it on the z2m github.

How/where do you get the zip from?

I’m trying to file a bug report for an addon and want to provide what version it broke but my backups skips over like 10 version numbers, I’d like to try and get the older ones to test so I can provide more useful “works ay X broke at Y” details but don’t know how to get it.

I am trying to downgrade one of my esp device to an older version. I have downloaded the version I want to revert. Added to the addon folder. Refresh check for update. I can see the new Local add-ons and the existing current version of Esphome.

If I install from the local add-on section, will it overwrite the current installed Esphome or will it install a second version of Esphome along side of it? Do I uninstall the existing Esphome before install from the local add-ons section??

You’ve probably resolved your issue by now, but I wanted to leave this breadcrumb for future Googlers.

I ended up forking the official community add-on repo and modifying the config.yaml file to specify the version I wanted.

Then, it’s a matter of adding my custom repo, installing, and figuring out the backup restore.

2 Likes

Interesting - I actually ended up digging out some older backup HDs and booted my old HA disk images managed to find backups of the addon from far earlier I was able to use but it was an absolute nightmare.

Thanks to @krystof.k for the info.
I made a quick tutorial on how to downgrade ESPHome to any previous version:

1 Like