Update to latest version of HA error

And here we are again with update issues.

HA OS installed on a truenas jail via the plugin.
ran update command from the shell via menu option 4

Failed to update due to error installing and building with PyNaCl==1.3.0

Can anyone offer help? Thanks.

2) status        5) start         8) check_config
3) restart       6) stop          9) exit_menu

Select: 4
Stopping homeassistant.
Requirement already up-to-date: homeassistant in /usr/local/share/homeassistant/lib/python3.8/site-packages (2021.6.6)
Requirement already satisfied, skipping upgrade: PyJWT==1.7.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (1.7.1)
Requirement already satisfied, skipping upgrade: pyyaml==5.4.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (5.4.1)
Requirement already satisfied, skipping upgrade: astral==2.2 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (2.2)
Requirement already satisfied, skipping upgrade: voluptuous-serialize==2.4.0 in/usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant)(2.4.0)
Requirement already satisfied, skipping upgrade: bcrypt==3.1.7 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (3.1.7)
Requirement already satisfied, skipping upgrade: requests==2.25.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (2.25.1)
Requirement already satisfied, skipping upgrade: ruamel.yaml==0.15.100 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (0.15.100)
Requirement already satisfied, skipping upgrade: certifi>=2020.12.5 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (2021.5.30)
Requirement already satisfied, skipping upgrade: ciso8601==2.1.3 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (2.1.3)
Requirement already satisfied, skipping upgrade: pip<20.3,>=8.0.3 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (20.2.4)
Requirement already satisfied, skipping upgrade: async-timeout==3.0.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (3.0.1)
Requirement already satisfied, skipping upgrade: attrs==21.2.0 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (21.2.0)
Requirement already satisfied, skipping upgrade: awesomeversion==21.4.0 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (21.4.0)
Requirement already satisfied, skipping upgrade: aiohttp==3.7.4.post0 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (3.7.4.post0)
Requirement already satisfied, skipping upgrade: httpx==0.18.0 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (0.18.0)
Requirement already satisfied, skipping upgrade: jinja2>=3.0.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (3.0.1)
Requirement already satisfied, skipping upgrade: yarl==1.6.3 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (1.6.3)
Requirement already satisfied, skipping upgrade: voluptuous==0.12.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (0.12.1)
Requirement already satisfied, skipping upgrade: cryptography==3.3.2 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (3.3.2)
Requirement already satisfied, skipping upgrade: backports.zoneinfo; python_version < "3.9" in /usr/local/share/homeassistant/lib/python3.8/site-packages (fromhomeassistant) (0.2.1)
Requirement already satisfied, skipping upgrade: python-slugify==4.0.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from homeassistant) (4.0.1)
Requirement already satisfied, skipping upgrade: pytz in /usr/local/share/homeassistant/lib/python3.8/site-packages (from astral==2.2->homeassistant) (2021.1)
Requirement already satisfied, skipping upgrade: cffi>=1.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from bcrypt==3.1.7->homeassistant) (1.14.5)
Requirement already satisfied, skipping upgrade: six>=1.4.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from bcrypt==3.1.7->homeassistant) (1.16.0)
Requirement already satisfied, skipping upgrade: chardet<5,>=3.0.2 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from requests==2.25.1->homeassistant) (4.0.0)
Requirement already satisfied, skipping upgrade: urllib3<1.27,>=1.21.1 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from requests==2.25.1->homeassistant) (1.26.5)
Requirement already satisfied, skipping upgrade: idna<3,>=2.5 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from requests==2.25.1->homeassistant) (2.10)
Requirement already satisfied, skipping upgrade: typing-extensions>=3.6.5 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from aiohttp==3.7.4.post0->homeassistant) (3.10.0.0)
Requirement already satisfied, skipping upgrade: multidict<7.0,>=4.5 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from aiohttp==3.7.4.post0->homeassistant) (5.1.0)
Requirement already satisfied, skipping upgrade: rfc3986[idna2008]<2,>=1.3 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from httpx==0.18.0->homeassistant) (1.5.0)
Requirement already satisfied, skipping upgrade: sniffio in /usr/local/share/homeassistant/lib/python3.8/site-packages (from httpx==0.18.0->homeassistant) (1.2.0)
Requirement already satisfied, skipping upgrade: httpcore<0.14.0,>=0.13.0 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from httpx==0.18.0->homeassistant) (0.13.3)
Requirement already satisfied, skipping upgrade: MarkupSafe>=2.0 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from jinja2>=3.0.1->homeassistant) (2.0.1)
Requirement already satisfied, skipping upgrade: text-unidecode>=1.3 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from python-slugify==4.0.1->homeassistant) (1.3)
Requirement already satisfied, skipping upgrade: pycparser in /usr/local/share/homeassistant/lib/python3.8/site-packages (from cffi>=1.1->bcrypt==3.1.7->homeassistant) (2.20)
Requirement already satisfied, skipping upgrade: h11<0.13,>=0.11 in /usr/local/share/homeassistant/lib/python3.8/site-packages (from httpcore<0.14.0,>=0.13.0->httpx==0.18.0->homeassistant) (0.12.0)
Testing configuration at /home/homeassistant/homeassistant
INFO:homeassistant.util.package:Attempting install of PyNaCl==1.3.0
ERROR:homeassistant.util.package:Unable to install package PyNaCl==1.3.0: ERROR: Command errored out with exit status 1:
   command: /usr/local/share/homeassistant/bin/python3.8 /usr/local/share/homeassistant/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpz3vf5kl0
       cwd: /tmp/pip-install-irg2mogk/pynacl
  Complete output (112 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8
  creating build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/public.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/hashlib.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/encoding.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/secret.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/utils.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/signing.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/__init__.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/exceptions.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  copying src/nacl/hash.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl
  creating build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/pwhash
  copying src/nacl/pwhash/_argon2.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/pwhash
  copying src/nacl/pwhash/__init__.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/pwhash
  copying src/nacl/pwhash/scrypt.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/pwhash
  copying src/nacl/pwhash/argon2i.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/pwhash
  copying src/nacl/pwhash/argon2id.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/pwhash
  creating build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/utils.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_box.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_shorthash.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/sodium_core.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_scalarmult.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/randombytes.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_secretstream.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_sign.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_generichash.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_kx.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_pwhash.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_secretbox.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_hash.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/crypto_aead.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  copying src/nacl/bindings/__init__.py -> build/lib.freebsd-12.2-RELEASE-p6-amd64-3.8/nacl/bindings
  running build_clib
  checking build system type... x86_64-unknown-freebsd12.2
  checking host system type... x86_64-unknown-freebsd12.2
  checking for a BSD-compatible install... /usr/bin/install -c
  checking whether build environment is sane... yes
  checking for a thread-safe mkdir -p... /tmp/pip-install-irg2mogk/pynacl/src/libsodium/build-aux/install-sh -c -d
  checking for gawk... no
  checking for mawk... no
  checking for nawk... nawk
  checking whether make sets $(MAKE)... yes
  checking whether make supports nested variables... yes
  checking whether UID '8123' is supported by ustar format... yes
  checking whether GID '8123' is supported by ustar format... yes
  checking how to create a ustar tar archive... gnutar
  checking whether make supports nested variables... (cached) yes
  checking whether to enable maintainer-specific portions of Makefiles... no
  checking for style of include used by make... GNU
  checking for gcc... gcc
  checking whether the C compiler works... yes
  checking for C compiler default output file name... a.out
  checking for suffix of executables...
  checking whether we are cross compiling... no
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether gcc accepts -g... yes
  checking for gcc option to accept ISO C89... none needed
  checking whether gcc understands -c and -o together... yes
  checking dependency style of gcc... none
  checking for a sed that does not truncate output... /usr/bin/sed
  checking how to run the C preprocessor... /lib/cpp
  configure: error: in `/tmp/pip-install-irg2mogk/pynacl/build/temp.freebsd-12.2-RELEASE-p6-amd64-3.8':
  configure: error: C preprocessor "/lib/cpp" fails sanity check
  See `config.log' for more details
  Traceback (most recent call last):
    File "/usr/local/share/homeassistant/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/usr/local/share/homeassistant/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/share/homeassistant/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-w89j9b45/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 221, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/pip-build-env-w89j9b45/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-w89j9b45/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 258, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/tmp/pip-build-env-w89j9b45/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 208, in <module>
      setup(
    File "/tmp/pip-build-env-w89j9b45/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-w89j9b45/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.8/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "setup.py", line 165, in run
      subprocess.check_call(
    File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/tmp/pip-install-irg2mogk/pynacl/src/libsodium/configure', '--disable-shared', '--enable-static', '--disable-debug', '--disable-dependency-tracking', '--with-pic', '--prefix', '/tmp/pip-install-irg2mogk/pynacl/build/temp.freebsd-12.2-REL

Others have reported a similar problem, see here for instance.

I’m very surprised at HAOS having this issue, so I’d recommend adding details to that issue.