"Fixing" my HomeAssistant install on FreeBSD | brnrd - Bernard Spil
bhyve
FreeBSD
LibreSSL
MariaDB
Misc
Security
My HomeAssistant install was up and running, but I was not happy with it. Errors and warnings in the logs, filesystem layout not aligning with standard FreeBSD practice. So I decided to fix this stuff.
Overview
This is a follow-up on the previous Jailed Zigbee and HomeAssistant on FreeBSD blog-post.
What will this blog-post address
SSDP errors (due to install in Jail)
Warnings and errors in UI
Logs not rotating
Configuration not in /usr/local/etc (but in homeassistant install dir)
Logs not in /var/log (but in config dir)
Backups not in /var/backups (but in config dir)
Cache directory not in /var/cache (but in config dir)
The default setup probably makes sense when runnig this as a container, it doesn't when running in FreeBSD.<br>I like my things to follow the standard FreeBSD hierarchy as documented in hier(7).
Fixing errors and warnings
Multiple things going on, missing dependencies, network issues.
SSDP errors in the logs
Documentation on this is "meh"...<br>Finding the issue is easy, finding a fix is not.<br>The issue is with the default_config, and once you know you can find things in the docs.
Process is something like
Disable default_config in configuration.yaml
Find out what "Integrations" should be enabled
Enumerate the integrations in configuration.yaml
# Disable default_config (pulls in default integrations)<br># default_config:<br># The default enabled stuff can be found in<br># /usr/local/homeassistant/lib/python3.14/site-packages/homeassistant/components/default_config/manifest.json
#assist_pipeline:<br>#bluetooth:<br>#cloud:<br>#conversation:<br>dhcp:<br>energy:<br>file:<br>#go2rtc: Fails to start<br>history:<br>homeassistant_alerts:<br>logbook:<br>#media_source:<br>mobile_app:<br>my:<br>#ssdp: # Broken in jails, uses broadcast<br>#stream:<br>sun:<br>#usage_prediction:<br>#usb:<br>webhook:<br>#zeroconf:
I ended up listing all entries from the default_config manifest, but disabling even more.<br>In the UI there was an issue with setting up stream so disabled that as well.<br>You can find descriptions about what the configs do using Integrations search.<br>Throw the label in search and check details.
Missing dependencies
Install zlib-ng and googletest packages.<br>pip install zlib_ng.<br>uninstall googletest.
Install libjpeg-turbo.
Filesystem layout
Location<br>Use
/usr/local/homeassistant<br>1. Home directory<br>2. Python VirtualEnv
/usr/local/etc/homeassistant<br>Configuration directory
/var/cache/homeassistant<br>Cache directory (originally in config dir)
/var/logs/homeassistant<br>Logs (originall in config dir)
/backups<br>Backup (originally in config dir)
Preparing the directories
install -d -o homeassistant /usr/local/etc/homeassistant<br>install -d -o homeassistant /var/log/homeassistant<br>install -d -o homeassistant /var/cache/homeassistant<br>install -d -o homeassistant /backups
Fixing configuration and logs directories
These are configured using command-line switches.<br>In the startup script, these are configured via hass_confdir and hass_args.
The startup script I have, supports setting the configdir using hass_confdir.<br>Logs are configured using the hass_args in the jail's /etc/rc.conf.
hass_confdir="-c /usr/local/etc/homeassistant " # Set the configuration dir<br>hass_args="--log-file /var/log/homeassistant/homeassistant.log "<br>hass_args+="--log-rotate-days 7"
Rotation reduces the size of logs used.
Move around data
Stop HomeAssistant, move all content from the old to the new configuration directory.
cd /usr/local/homeassistant/.homeassistant<br>mv * /usr/local/etc/homeassistant/
cd /usr/local/etc/homeassistant<br>mv backups/* /backups/<br>rmdir backups<br>ln -s /backups backups<br>mv .cache/* /var/cache/homeassistant/<br>rmdir .cache<br>ln -s /var/cache/homeassistant .cache
Start HomeAssistant
This blog is proudly powered by Pelican, which takes great advantage of Python.
W3 Personal Blog is a flat bootstrap responsive theme designed by W3layouts ported to a pelican by Samael500.
This work is CC-BY-4.0 licensed.