How to downgrade addons?

How do I downgrade an addon? There seems to be no way of downgrading to an older version of an addon, when some addon doesn’t work.

1 Like

You can’t downgrade add-ons.

Here’s what the ha CLI command states:

This command can upgrade a Home Assistant add-on to its latest version.
It is currently not possible to upgrade/downgrade to a specific version.

Usage:
ha addons update [slug] [flags]

Aliases:
update, upgrade, up

Examples:
ha addons update core_ssh

Flags:
-h, --help help for update

Restore from your backup you did before updating. Or you should be able to get older versions from the github of the addon and install from that.

Add-ons are docker containers. When you make a Snapshot (a backup) it doesn’t make a copy of the container, only the configuration and user-created data. Restoring from backup will not revert to the previous version of the add-on.

EDIT
True and false. It doesn’t make a copy of the container but restoring from backup will revert to the previous version because it will download the older version.

Because add-ons are distributed as docker containers, you won’t find an archive of all available versions on GitHub. They’re located on Docker Hub.

EDIT
True and the backup contains all the information it needs to download older versions.

Replacing a docker container is definitely possible. The easiest way is (arguably) using Portainer (yet another add-on). However, Supervisor is normally responsible for installing/uninstalling all add-ons (containers) and I don’t know if there are any precautions one must take before attempting to do that task using Portainer (like maybe disabling Supervisor first). All this to say, it might be prudent to try this kind of surgery on a sacrificial test system before potentially screwing up a production system.

EDIT
Probably true but completely unnecessary because restoring a backup (snapshot) reverts to the previous version. However, if one does not have a backup then the mentioned technique is one way to try to downgrade the Add-on.

Interesting! I’m glad I use raspberry pi then as I’ve restored from backup a few times and works :slight_smile: sorry to provide incorrect info I didn’t know about the limitation with docker.

I am not sure that is accurate. I have seen many people say that they have been able to revert an addon version from a snapshot.

EDIT having checked, the container is not placed in the snapshot. What I think happens that when the config is saved, it saves the container version, which gets pulled when you restore the snapshot. Therefore it is effectively restoed t the old version.

1 Like

I just downloaded a snapshot from esphome it’s only 16kb. Hopefully it allows you to load an older version when restoring. Otherwise I’ve been really reckless when upgrading. I just assumed you could roll back, aside from the supervisor.

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
4 Likes