How to update/maintain Zigbee2MQTT and Mosquitto LXCs?

I have a Proxmox host with HA VM and 2 separate LXCs for Zigbee2MQTT and Mosquitto.

I’ve installed the LXCs by following this tutorial:

Now I want to make sure I’m maintaining this setup properly. Meaning: updates (from time to time).

Please mind that I’m not a Linux expert or anything like that, but I can make some bash scripts and follow tutorials, no problem :wink:

So… within the comments section, I’ve found this instruction and adapted it to my needs:

  1. ssh-z2m
  2. cd /opt/zigbee2mqtt
  3. git fetch
  4. sudo systemctl stop zigbee2mqtt
  5. git checkout <TAG>
  6. npm ci
  7. sudo systemctl start zigbee2mqtt

EDIT: I’ve found that docs recommend using the script, so the workflow is a bit simpler:

  1. ssh-z2m
  2. cd /opt/zigbee2mqtt
  3. ./

That’s upgrading Z2M. Questions:

  1. Is there a way to automate that sensibly, so that I don’t have to run it manually? I’ve looked around Z2M frontend, but didn’t see any update options… What about like new version notification? Or do I just run it like once a month “blindly”?
  2. When running it for the first time, I was prompted to update npm as well: npm notice New minor version of npm available! 10.2.4 -> 10.7.0 – any other updates I shall run to “maintain” the LXC? I’m not sure if I should treat LXC like a normal Linux and sudo apt update or something [?].
  3. What about Mosquitto LXC?
  4. Z2M’s downloads the latest master branch from github → I guess it would still be a bit safer getting the latest version tag (“release”) instead of master?

There is a lot of debate between the LXC and VM camps under servers like Proxmox. I am far from an expert and maybe partially because I have been using docker since day one for my Home Assistant components on a Raspberry PI 3. That said, from my minor testing on Proxmox, I have found that a light weight Debian VM running docker is my preferred way of running almost all of my home automation components, including Home Assistant, Mosquitto, Zigbee2MQTT. I do run my Postgresql server in a LXC. I now us a rather beefy Intel 13th Gen machine for my Proxmox. But the memory footprint of all my docker containers is really small. HA is the biggest. I was not able to see any impactful performance difference between a dedicated LXC for any of the above and a docker containerized version.

Two things that I think really make a VM with docker a winner for me over LXC :

  1. USB and pretty much any NAS volume mounting is much easier with VM and docker. USB in both LXC and VM is a PIA, however from my experience is it much more a PIA in LXC.

  2. Upgrades. Docker container are easier to spin up and be able to roll back. Example docker upgrade commands below.

Docker does take a bit of time to get you brain around, but since you appear to be down the rabbit hole of Proxmox and LXC’s, it is easier than these to get to a comfort level. I recommend Portainer and nice web gui docker container manager.

Most definitely try and use the ‘official’ docker container images from docker hub or other container repositories. Most all of the official docker containers have good documentation with them.

Home Assistant:

docker pull homeassistant/home-assistant:2024.2.5

docker run -i -t -d \
	--name="home-assistant-2024.2.5" \
	-v /home/user/homeassistant:/config \
	-v /media/:/media \
	-v /etc/localtime:/etc/localtime:ro \
	--net=host \
	--log-driver syslog --log-opt syslog-address=udp:// \

Mosquitto :

docker run -i -t -d --name="mosquitto-2.0.18" \
    -p 1883:1883 -p 9001:9001 \
    -v /home/user/mosquitto:/mosquitto/config \
    -v /home/user/mosquitto:/mosquitto/data \
    -v /home/user/mosquitto:/mosquitto/log \
    -v /etc/localtime:/etc/localtime:ro \
    --user $(id -u):$(id -g) \

Zigbee2MQTT :

docker pull koenkk/zigbee2mqtt:1.36.1

docker run -i -t -d \
   --name="production-zigbee2mqtt-1.36.1" \
   --restart=unless-stopped \
   -v /home/user/zigbee2mqtt:/app/data \
   -v /run/udev:/run/udev:ro \
   --device=/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_d8cdec347b29ec118a72757840c9ce8d-if00-port0 \
   --user 1000:1000 \
   --group-add dialout \
   --net=host \
   -e TZ=America/Los_Angeles \

Good hunting!

1 Like