Post

TrueNAS Home Assistant upgrade 'maturin' issue

TrueNAS Home Assistant upgrade 'maturin' issue

TL;DR

If you’re upgrading Home Assistant on TrueNAS (or possibly any other distro) and you’re seeing errors like

1
2
3
4
"cargo not found in PATH. Please install rust "
RuntimeError: cargo not found in PATH. Please install rust (https://www.rust-lang.org/tools/install) and try again
ERROR: Failed building wheel for maturin
Failed to build maturin

The fix was found from this post.

1
2
3
pkg install curl
su - homeassistant
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Longer version

I run TrueNAS at home, which has a couple of jails, and I have some super basic home automation with Home Assistant. I rarely touch it, as it is solid, and I don’t do much with it. Just some basic things like having the integration with Unifi NVR, thermostats and the like.

However, I recently bought some Zigbee devices to play around with and thought before I integrated them into Home Assistant, I would give that jail a bit of love. I installed Home Assistant on it probably about two years ago and haven’t touched it since, so I expected some issues. It was all looking pretty smooth and good to go until I got to the error;

1
2
3
4
5
6
File "setup.py", line 55, in run
"cargo not found in PATH. Please install rust "
RuntimeError: cargo not found in PATH. Please install rust (https://www.rust-lang.org/tools/install) and try again
ERROR: Failed building wheel for maturin
Failed to build maturin
ERROR: Could not build wheels for maturin which use PEP 517 and cannot be installed directly

This was a bit confusing, as doing a pkg install rust showed rust as already installed and up to date. My usual Google-fu magic showed other people with similar issues. Still, nothing was constructive and I didn’t want to blindly follow some lengthy post to install a bunch of dependencies which I didn’t know what they did or what they were for. Luckily, towards the end of my search, I came across this blog post, which suggested installing Rust via CURL instead of using pkg. I took a snapshot of the jail;

1
2
3
iocage stop homeassistant
iocage snapshot homeassistant
iocage start homeassistant

Then followed the blog post;

1
2
3
pkg install curl
su - homeassistant
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

After that, I re-run the upgrade tool within Home Assistant itself, and it worked! 🎉

Hopefully this helps anyone else who doesn’t actively maintain their Home Assistant install, and encounters similar issues :)

This post is licensed under CC BY 4.0 by the author.