How to downgrade addons?

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