I’m running my HomeAssistant deployment on top of Podman running inside one PI4 running Fedora 36(soon to be 37).

I didn’t feel the necessity to use Home Assistant Operating System, since I do prefer to manually install all my plugins and integrations, so for that podman was the best alternative, even though I’m not running my HA instance in a rootless mode, Podman was the easiest way for me to setup my instance, since I’m using selinux the :Z flag was enabled while mounting the directory to persist the HA data.

My preference with podman is to run all container using systemd, to make sure that all logs are traceable using journal.

Let’s first create a directory called ha at / to persist the data from HA.

mkdir /ha

After this we can proceed to the creation of our systemd-unit for Home Assistant:

cat <<EOF > /etc/systemd/system/homeassistant.service
[Unit]
Description=Home Assistant
After=network.target

[Service]
Type=simple
TimeoutStartSec=5m
ExecStartPre=-/usr/bin/podman rm -f "homeassistant"
ExecStart=podman run --name homeassistant --privileged --restart=unless-stopped -e TZ=America/Sao_Paulo -v /ha:/config:Z --network=host ghcr.io/home-assistant/home-assistant:stable
ExecReload=-/usr/bin/podman stop "homeassistant"
ExecReload=-/usr/bin/podman rm "homeassistant"
ExecStop=-/usr/bin/podman stop "homeassistant"
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
EOF

Make sure to change the -e TZ= variable to match your timezone.

Now let’s reload the units from systemd and also enable/start the Home Assistant unit:

systemctl daemon-reload
systemctl enable --now homeassistant.service

Now you should be able to see the Home Assistant logs directly from journal:

journalctl -u homeassistant.service

I’m also running Zigbee2Mqtt in my stack, and it’s also running with podman, here’s the systemd unit to run Mosquitto and Zigbee2Mqtt with podman:

cat <<EOF > /etc/systemd/system/zigbee2mqtt.service
[Unit]
Description=Zigbee2Mqtt
After=network.target

[Service]
Type=simple
TimeoutStartSec=5m
ExecStartPre=-/usr/bin/podman rm -f "zigbee2mqtt"
ExecStart=podman run --name zigbee2mqtt -v /zigbee2mqtt-data:/app/data:Z -v /run/udev:/run/udev:ro --device /dev/ttyUSB0 -p 8080:8080 -eTZ=America/Sao_Paulo koenkk/zigbee2mqtt
ExecReload=-/usr/bin/podman stop "zigbee2mqtt"
ExecReload=-/usr/bin/podman rm "zigbee2mqtt"
ExecStop=-/usr/bin/podman stop "zigbee2mqtt"
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
EOF

Some things to check for zigbe2mqtt, the --device is the dev that your USB Hub gets in the system, it can change from vendor to vendor.

I’m had issues mapping my USB Hub with podman 4.0.2-1, but after updating to 4.3.1-1 everything worked out of the box, so if you are facing issues while trying to mount the Usb Hub, check if you can update to the lastest version of podman.

For Mosquitto:

cat <<EOF > /etc/systemd/system/mqtt.service
[Unit]
Description=mqtt
After=network.target

[Service]
Type=simple
TimeoutStartSec=5m
ExecStartPre=-/usr/bin/podman rm -f "zigbee2mqtt"
ExecStart=podman run --name mqtt -p 1883:1883 -p 9001:9001 -v /mosquitto-data:/mosquitto:Z eclipse-mosquitto:2.0 mosquitto -c /mosquitto-no-auth.conf
ExecReload=-/usr/bin/podman stop "mqtt"
ExecReload=-/usr/bin/podman rm "mqtt"
ExecStop=-/usr/bin/podman stop "mqtt"
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
EOF

Now we need to create the directories for Zigbee2Mqtt and Mosquitto:

mkdir /mosquitto-data
mkdir /zigbee2mqtt-data

Now reload all system units and enable/start Zigbe2Mqtt and Mosquitto:

systemctl daemon-reload
systemctl enable --now mqtt.service
systemctl enable --now zigbee2mqtt.service

And just like Home Assistant, both Zigbee2Mqtt and Mosquitto should show logs in the journalctl.