I am running a Virtual Machine that has Debian 13 as its OS, and acting as my Web / Proxy server to the outside world, including managing my SSL certs.
In the past, I would use deploy_freenas.py to push a cert to my TrueNAS when the cert was renewed. With the new API on the way, I wanted to move to deploy_truenas.py instead.
After following the instructions from DanB’s GitHub, the script is downloaded and configured, and I think the TrueNAS API client is installed, but I’m getting the following error:
root@virtualmin:~# /root/scripts/deploy_truenas/deploy_truenas.py
Traceback (most recent call last):File “/root/scripts/deploy_truenas/deploy_truenas.py”, line 28, in from truenas_api_client import ClientModuleNotFoundError: No module named ‘truenas_api_client’
root@virtualmin:~# pipx install git+https://github.com/truenas/api_client.git
'truenas_api_client’ already seems to be installed. Not modifying existing installation in‘/root/.local/share/pipx/venvs/truenas-api-client’. Pass ‘–force’ to force installation.
root@virtualmin:~# /root/scripts/deploy_truenas/deploy_truenas.py
Traceback (most recent call last):File “/root/scripts/deploy_truenas/deploy_truenas.py”, line 28, in from truenas_api_client import ClientModuleNotFoundError: No module named ‘truenas_api_client’
root@virtualmin:~#
root@virtualmin:~# pip install git+https://github.com/truenas/api_client.git
error: externally-managed-environment
× This environment is externally managed╰─> To install Python packages system-wide, try apt installpython3-xyz, where xyz is the package you are trying to install.
If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.13/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
root@virtualmin:~# apt install python3
python3 is already the newest version (3.13.5-1).
Summary:
Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 0
root@virtualmin:~#
Have a look at tnascert-deploy. It’s written in Go and the compiled binaries have no external dependencies. See the GitHub Repository. Pre-compiled binaries are available at tnascert-deploy version 2.0
I’m inclined to agree, especially after iX have apparently deprecated the setup.py installation for the Python client. If you’re looking to run my script on the NAS itself, it’d be fine, but on a remote system it seems to be increasingly difficult to get the Python client installed in a way that would be usable.
When I run the REST version, it works fine. When I run the WebSockets version, I get an error:
root@virtualmin:~# /root/scripts/tnascert-deploy/tnascert-deploy -c /root/scripts/tnascert-deploy/tnas-cert.ini restapi
2025/12/05 09:39:24 processing certificate installation for 'restapi'
2025/12/05 09:39:25 truenas.aiskon.net is running version '25.10.0.1'
2025/12/05 09:39:25 certificate verification: x509: certificate signed by unknown authority
2025/12/05 09:39:25 importing the letsencrypt-2025-12-05-1764945565 certificate
2025/12/05 09:39:30 successfully imported the letsencrypt-2025-12-05-1764945565 certificate
2025/12/05 09:39:39 updated the active UI certificate to use letsencrypt-2025-12-05-1764945565
2025/12/05 09:39:44 deleting old certificates with prefix 'letsencrypt'
2025/12/05 09:39:44 skip the deletion of the active UI certificate letsencrypt-2025-12-05-1764945565
2025/12/05 09:39:44 deleted certificate letsencrypt-2025-12-05-1764942707
2025/12/05 09:39:44 successfully deleted old certificates
2025/12/05 09:39:44 post installation tasks error, failed to restart the UI
root@virtualmin:~# /root/scripts/tnascert-deploy/tnascert-deploy -c /root/scripts/tnascert-deploy/tnas-cert.ini wsapi
2025/12/05 09:39:50 processing certificate installation for 'wsapi'
2025/12/05 09:39:51 error creating client for 'wsapi': error: failed to connect: tls: failed to verify certificate: x509: certificate signed by unknown authority
root@virtualmin:~#