Homeassistant container not able to update

A while ago I switched from a sd card on my Raspberry pi 3b to a ssd and moved the whole home assistant config. I can start the container and access home assistant when the image is set to the same as when the backup was done but when I try to use another image the container starts but I’m not able to access home assistant. Is there something to fix this or am I stuck with running the same home assistant version or starting over from scratch?

Is it possible the IP Address of your device is changing?

I don’t think so. I can run another container with the latest and it works but when i try to change the version of the image on my backup version it does not work.

More info needed like logs, commandline outputs etc.

There is no commandline output only that the container were created and is up an running.
This is the log file from ha:

2023-07-07 22:14:02.132 ERROR (SyncWorker_2) [homeassistant.
util.json] Could not parse JSON content: /config/.storage/ho
meassistant.exposed_entities
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/util/json.py",
line 68, in load_json
    return orjson.loads(fdesc.read())  # type: ignore[no-any
-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
orjson.JSONDecodeError: Input is a zero-length, empty docume
nt: line 1 column 1 (char 0)
2023-07-07 22:14:02.138 ERROR (MainThread) [homeassistant.se
tup] Error during setup of component homeassistant
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/util/json.py",
line 68, in load_json
    return orjson.loads(fdesc.read())  # type: ignore[no-any
-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
orjson.JSONDecodeError: Input is a zero-length, empty docume
nt: line 1 column 1 (char 0)

The above exception was the direct cause of the following ex
ception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line
 286, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/home
assistant/__init__.py", line 346, in async_setup
    await exposed_entities.async_initialize()
  File "/usr/src/homeassistant/homeassistant/components/home
assistant/exposed_entities.py", line 125, in async_initializ
e
    await self._async_load_data()
  File "/usr/src/homeassistant/homeassistant/components/home
assistant/exposed_entities.py", line 348, in _async_load_dat
a
    data = await self._store.async_load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/storage
.py", line 122, in async_load
    return await self._load_task
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/storage
.py", line 131, in _async_load
    return await self._async_load_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/storage
.py", line 149, in _async_load_data
    data = await self.hass.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.
py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/json.py",
line 74, in load_json
    raise HomeAssistantError(error) from error
homeassistant.exceptions.HomeAssistantError: Input is a zero
-length, empty document: line 1 column 1 (char 0)
2023-07-07 22:14:02.150 ERROR (MainThread) [homeassistant.bo
otstrap] Home Assistant core failed to initialize.
2023-07-07 22:14:02.151 WARNING (MainThread) [homeassistant.
bootstrap] Unable to set up core integrations. Activating sa
fe mode
2023-07-07 22:14:02.161 ERROR (MainThread) [homeassistant.bo
otstrap] Home Assistant core failed to initialize.

What commandline did you use to start the container?

docker-compose up -d

Then the docker-compose.yml would be helpful :slight_smile:

Ok then what does your dockercompose file say?

This one works nu it is when i change the version number to anything else the 2023.3.4 it stops working. I have tried stable, latest, 2023.6 these does not seem to work.

version: '3.0'

services:
  portainer:
    container_name: portainer
    image: portainer/portainer-ce
    restart: always
    ports:
      - "9000:9000/tcp"
    environment:
      - TZ=Europe/Stockholm
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/portainer:/data

  homeassistant:
    container_name: homeassistant
<3.3.4"
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
      - /dev/ttyUSB1:/dev/ttyUSB1
    restart: unless-stopped
    privileged: true
    network_mode: host

Follow the instructions would help

Whoops saw that the image line hade been cut of

  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:2023.3.4"
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
      - /dev/ttyUSB1:/dev/ttyUSB1
    restart: unless-stopped
    privileged: true
    network_mode: host

Have you tried a version closer to your current version?

I have tried 2023.5 no luck. Tried 2023.3.6 seem to work trying 2023.4 now. Maybe I just have to take smaller jumps until i reach the latest?

By the way I don’t think you need the devices: block because it runs as privileged.

I recall that in a recent update a new database scheme was introduced and the database needed to be updated after upgrading HA. Maybe that’s the reason for your errors like

Could not parse JSON content: /config/.storage/ho
meassistant.exposed_entities

How do i upgrade the database?

Managed to get the version to 2023.4.6 but 5 or higher does not work.

It does it on its own and takes a while. You should probably read the update notes and breaking changes from the version that doesn’t work for you.

By removing the exposed_entities file it seems to work and the file is created upon launch again. Thanks for the suggestions :smiley: