Moving HA Container install from one host to another: copying /config doesn't work

Hi everyone, really scratching my head on this one…

So I’m moving from unraid to a ubuntu host with portainer. I’ve been running an installation of HA Core for a few years now in unraid using the ghcr.io/home-assistant/home-assistant:stable image with only 1 mount: a folder (/mnt/user/appdata/Home-Assistant-Core) into /config. This installation works fine as I write this, it can boot up and runs all my devices/automations/etc… (aka the existing install works).

I now want to move this installation over to my portainer install. The portainer install uses a docker volume instead of a bind mount.

So on the new host:

  • I start the homeassistant container (same image as I’m using on the old one)
  • I stop it
  • rm -rf the volume directory that got created (/var/lib/docker/volumes/homeassistant/_data)

On the old host:

  • I shut down HA core container
    - rsync -avH /mnt/user/appdata/Home-Assistant-Core username@newhost:/var/lib/docker/volumes/homeassistant/_data
    → I double check that this copies over everything including dot files and directories like .storage

Then I start the homeassistant container again on the new host. It gives me the onboarding screen just as with a fresh install.

What am I doing wrong here?

Log on the new host:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun home-assistant (no readiness notification)
s6-rc: info: service legacy-services successfully started
2023-08-31 22:48:51.877 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-31 22:48:51.878 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration tesla_custom which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-31 22:48:51.878 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration auth_header which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-31 22:48:51.879 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration afvalbeheer which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-31 22:48:51.879 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration govee_lan which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-31 22:48:51.879 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration auto_backup which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-31 22:48:51.880 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration circadian_lighting which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-31 22:48:52.686 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly
2023-08-31 22:48:54.612 ERROR (MainThread) [homeassistant.setup] Error during setup of component automation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 259, in async_setup
    await _async_process_config(hass, config, component)
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 976, in _async_process_config
    entities = await _create_automation_entities(hass, updated_automation_configs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 860, in _create_automation_entities
    cond_func = await _async_process_if(hass, name, config_block)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 989, in _async_process_if
    checks.append(await condition.async_from_config(hass, if_config))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 246, in async_from_config
    return cast(ConditionCheckerType, await factory(hass, config))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 285, in async_or_from_config
    checks = [await async_from_config(hass, entry) for entry in config["conditions"]]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 285, in <listcomp>
    checks = [await async_from_config(hass, entry) for entry in config["conditions"]]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 246, in async_from_config
    return cast(ConditionCheckerType, await factory(hass, config))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 316, in async_not_from_config
    checks = [await async_from_config(hass, entry) for entry in config["conditions"]]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 316, in <listcomp>
    checks = [await async_from_config(hass, entry) for entry in config["conditions"]]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 246, in async_from_config
    return cast(ConditionCheckerType, await factory(hass, config))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/device_automation/condition.py", line 55, in async_condition_from_config
    return trace_condition_function(platform.async_condition_from_config(hass, config))
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/remote/device_condition.py", line 26, in async_condition_from_config
    return toggle_entity.async_condition_from_config(hass, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/device_automation/toggle_entity.py", line 146, in async_condition_from_config
    state_config = condition.state_validate_config(hass, state_config)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 1022, in state_validate_config
    config[CONF_ENTITY_ID] = er.async_validate_entity_ids(
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1395, in async_validate_entity_ids
    return [async_validate_entity_id(registry, item) for item in entity_ids_or_uuids]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1395, in <listcomp>
    return [async_validate_entity_id(registry, item) for item in entity_ids_or_uuids]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1364, in async_validate_entity_id
    raise vol.Invalid(f"Unknown entity registry entry {entity_id_or_uuid}")
voluptuous.error.Invalid: Unknown entity registry entry 92542f1ce713c028b90e6ebcbb9ce889
2023-08-31 22:48:54.623 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: automation
2023-08-31 22:48:54.625 ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: (DependencyError(...), 'Could not setup dependencies: automation')
2023-08-31 22:48:55.596 ERROR (MainThread) [homeassistant.components.homekit] HomeKit Guest Bedroom TV cannot startup: entity not available: {'include_entities': ['media_player.guest_bedroom_tv_2'], 'include_entity_globs': [], 'include_domains': [], 'exclude_domains': [], 'exclude_entity_globs': [], 'exclude_entities': []}
2023-08-31 22:48:55.598 ERROR (MainThread) [homeassistant.components.homekit] HomeKit Bedroom TV cannot startup: entity not available: {'include_entities': ['media_player.bedroom_tv_2'], 'include_entity_globs': [], 'include_domains': [], 'exclude_domains': [], 'exclude_entity_globs': [], 'exclude_entities': []}

Bind mount the config folder and verify it has correct user permissions

You can bind mount the folder using portainer

Bind mounting works immediately…

Does that mean that docker volumes are unsupported with HA Container? Is there some hard coded values that I need to change somewhere to get it working with docker volumes?

All my other containers (& my backup strategy) rely on docker volumes, so would like to avoid having to bind mount just for this container…

Allright closing this as I figured it out. So I rsync -avH with /* which I shouldn’t do because globbing made it so that dotfiles (like .storage) were actually ignored.

rm -rf directory first also didn’t help removing the previous dotfiles from the first bootup of the new container, which misled me in thinking that .storage actually got moved while in reality it was still the .storage of the previous installation.

So

  • Use rsync -avH / WITHOUT using a *
  • Either create the docker volume first before starting the container, if not possible, then make sure all dotfiles are removed from the created docker volume after first startup