HA not starting after failed update from 2022.6.7

Everything was humming along fine, attempted to update from 2022.6.7 to current build, failed with the following:

Requirement already satisfied: homeassistant in /usr/local/share/homeassistant/lib/python3.9/site-packages (2022.6.7)
Collecting homeassistant
  Downloading homeassistant-2022.7.2-py3-none-any.whl (18.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.2/18.2 MB 39.1 MB/s eta 0:00:00
Requirement already satisfied: PyJWT==2.4.0 in /usr/local/share/homeassistant/lib/python3.9/site-packages (from homeassistant) (2.4.0)
Requirement already satisfied: aiohttp==3.8.1 in /usr/local/share/homeassistant/lib/python3.9/site-packages (from homeassistant) (3.8.1)
Requirement already satisfied: ciso8601==2.2.0 in /usr/local/share/homeassistant/lib/python3.9/site-packages (from homeassistant) (2.2.0)
Collecting orjson==3.7.5
  Downloading orjson-3.7.5.tar.gz (640 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 640.2/640.2 KB 154.0 MB/s eta 0:00:00
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [102 lines of output]
      Collecting maturin<0.13,>=0.12.19
        Downloading maturin-0.12.20.tar.gz (156 kB)
           ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 156.9/156.9 KB 3.8 MB/s eta 0:00:00
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting tomli>=1.1.0
        Downloading tomli-2.0.1-py3-none-any.whl (12 kB)
      Building wheels for collected packages: maturin
        Building wheel for maturin (pyproject.toml): started
        Building wheel for maturin (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for maturin (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [77 lines of output]
            running bdist_wheel
            running build
            running build_py
            creating build
            creating build/lib.freebsd-13.1-RC6-amd64-3.9
            creating build/lib.freebsd-13.1-RC6-amd64-3.9/maturin
            copying maturin/__init__.py -> build/lib.freebsd-13.1-RC6-amd64-3.9/maturin
            copying maturin/import_hook.py -> build/lib.freebsd-13.1-RC6-amd64-3.9/maturin
            running build_ext
            running build_rust
             Downloading crates ...
            error: failed to download `clap v3.2.4`
      
            Caused by:
              unable to get packages from source
      
            Caused by:
              failed to parse manifest at `/home/homeassistant/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.2.4/Cargo.toml`
      
            Caused by:
              feature `edition2021` is required
      
              The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.55.0 (32da73ab1 2021-08-23)).
              Consider trying a newer version of Cargo (this may require the nightly release).
              See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature.
            Traceback (most recent call last):
              File "/tmp/tmp_v0r1l8f_in_process.py", line 363, in <module>
                main()
              File "/tmp/tmp_v0r1l8f_in_process.py", line 345, in main
                json_out['return_val'] = hook(**hook_input['kwargs'])
              File "/tmp/tmp_v0r1l8f_in_process.py", line 261, in build_wheel
                return _build_backend().build_wheel(wheel_directory, config_settings,
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 216, in build_wheel
                return self._build_with_temp_dir(['bdist_wheel'], '.whl',
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
                self.run_setup()
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 145, in run_setup
                exec(compile(code, __file__, 'exec'), locals())
              File "setup.py", line 57, in <module>
                setup(
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
                return distutils.core.setup(**attrs)
              File "/usr/local/lib/python3.9/distutils/core.py", line 148, in setup
                dist.run_commands()
              File "/usr/local/lib/python3.9/distutils/dist.py", line 966, in run_commands
                self.run_command(cmd)
              File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
                self.run_command('build')
              File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/usr/local/lib/python3.9/distutils/command/build.py", line 135, in run
                self.run_command(cmd_name)
              File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools_rust/setuptools_ext.py", line 132, in run
                build_rust.run()
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools_rust/command.py", line 101, in run
                self.run_for_extension(ext)
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools_rust/build.py", line 112, in run_for_extension
                dylib_paths = self.build_extension(ext, self.target)
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools_rust/build.py", line 143, in build_extension
                target_dir = _base_cargo_target_dir(ext)
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools_rust/build.py", line 690, in _base_cargo_target_dir
                target_directory = ext._metadata()["target_directory"]
              File "/tmp/pip-build-env-obtan7tj/overlay/lib/python3.9/site-packages/setuptools_rust/extension.py", line 225, in _metadata
                self._cargo_metadata = json.loads(subprocess.check_output(metadata_command))
              File "/usr/local/lib/python3.9/subprocess.py", line 424, in check_output
                return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
              File "/usr/local/lib/python3.9/subprocess.py", line 528, in run
                raise CalledProcessError(retcode, process.args,
            subprocess.CalledProcessError: Command '['cargo', 'metadata', '--manifest-path', 'Cargo.toml', '--format-version', '1']' returned non-zero exit status 101.
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for maturin
      Failed to build maturin
      ERROR: Could not build wheels for maturin, which is required to install pyproject.toml-based projects
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

After the failed update, my webUI was no longer working. Checked the logs and saw this during start up:

2022-07-09 11:49:26 ERROR (MainThread) [homeassistant.auth.providers] Unable to load auth provider homeassistant: Shared object "libffi.so.7" not found, required by "_cffi_backend.cpython-39.so"
2022-07-09 11:49:26 ERROR (MainThread) [homeassistant.bootstrap] Home Assistant core failed to initialize. Further initialization aborted
2022-07-09 11:49:26 WARNING (MainThread) [homeassistant.bootstrap] Unable to set up core integrations. Activating safe mode
2022-07-09 11:49:26 ERROR (MainThread) [homeassistant.auth.providers] Unable to load auth provider homeassistant: Shared object "libffi.so.7" not found, required by "_cffi_backend.cpython-39.so"
2022-07-09 11:49:26 ERROR (MainThread) [homeassistant.bootstrap] Home Assistant core failed to initialize. Further initialization aborted

the only thing i can think of is that both python 3.8 and 3.9 are on my jail (running HA plugin on TrueNAS) and maybe there’s a misconfig on what version of pythong to use? According to my jail, default python being used is 3.8.13, but when testing HA service i get the following back:

Testing virtualenv...

  /usr/local/share/homeassistant

  Python 3.9.13
  Home Assistant 2022.6.7


Press ENTER to continue...

what might i be missing? kind of have an unusable automated house right now :frowning:

Maybe?

appreciate the input, I suppose it’s another branch to follow.

Sorry, I don’t mean to sound short here – It’s a busy week but I don’t want to leave you hanging

Any chance you have a snapshot of the jail that you can restore?

You mentioned your using the plugin but which version of TrueNAS Core is this, 12 or 13?

I’ve switched over to TN Scale now so I don’t have a running Core installation to quickly test on but the nightly CI test is still passing so my first guess is, you may need to just reinstall the Home Assistant virtualenv. You can do this from jail’s console.

# Press 0 to exit the console menu
service homeassistant stop
service homeassistant reinstall homeassistant
service homeassistant start

If that doesn’t work the quickest way back is likely going to be just reinstalling the plugin and restore your config from backup – Remember as long as you do not delete your existing plugin, your configuration can be saved even if the jail itself failed to start.

2 Likes

So you can have multiple versions of Python installed but testing the HA service will always be correct because it activates and runs python --version from inside the virtualenv.

The python version is set with an rcvar, for example

sysrc homeassistant_python=/usr/local/bin/python3.9

But setting that alone is not enough to switch version. The homeassistant_python rcvar is only used when creating the virtualenv, therefore it needs to be recreated before changes to the python version take effect.

Understandable on the busy week, and definitely thank you for taking the time to add some insight. Running on Core 13.0, this also might be the breaking point that makes me switch to scale, haha.

1 Like