Zigbee2Mqtt update fails #292

Closed
opened 2026-02-04 17:47:26 +03:00 by OVERLORD · 13 comments
Owner

Originally created by @derolli1976 on GitHub (Jan 7, 2025).

Have you read and understood the above guidelines?

yes

📜 What is the name of the script you are using?

Zigbee2Mqtt

📂 What was the exact command used to execute the script?

update

📝 Provide a clear and concise description of the issue.

The container installed is a couple of months old version 1.42.
When trying to execute the update command to update to version 2.0.0 the script fails with the message attached.
2025-01-07 17 43 12

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

Debian 12

🔄 Steps to reproduce the issue.

  1. Have a running LXC container
  2. Execute "update" in the shell

Paste the full error output (if available).

2025-01-07 17 43 12

🖼️ Additional context (optional).

No response

Originally created by @derolli1976 on GitHub (Jan 7, 2025). ### ✅ Have you read and understood the above guidelines? yes ### 📜 What is the name of the script you are using? Zigbee2Mqtt ### 📂 What was the exact command used to execute the script? update ### 📝 Provide a clear and concise description of the issue. The container installed is a couple of months old version 1.42. When trying to execute the update command to update to version 2.0.0 the script fails with the message attached. ![2025-01-07 17 43 12](https://github.com/user-attachments/assets/f9e3cd52-2f2a-4c4c-9d29-6b7ffb0e06e1) ### ⚙️ What settings are you using? - [X] Default Settings - [ ] Advanced Settings ### 🖥️ Which Linux distribution are you using? Debian 12 ### 🔄 Steps to reproduce the issue. 1. Have a running LXC container 2. Execute "update" in the shell ### ❌ Paste the full error output (if available). ![2025-01-07 17 43 12](https://github.com/user-attachments/assets/4e2cf17e-9a15-4d44-8657-925f8b96a569) ### 🖼️ Additional context (optional). _No response_
OVERLORD added the not a script issue label 2026-02-04 17:47:26 +03:00
Author
Owner

@MickLesk commented on GitHub (Jan 7, 2025):

Have you read the PR & Discussion?

@MickLesk commented on GitHub (Jan 7, 2025): Have you read the PR & Discussion?
Author
Owner

@derolli1976 commented on GitHub (Jan 7, 2025):

Sorry, but I cannot find anything related. Would you mind, sharing the PR in question please?

@derolli1976 commented on GitHub (Jan 7, 2025): Sorry, but I cannot find anything related. Would you mind, sharing the PR in question please?
Author
Owner

@derolli1976 commented on GitHub (Jan 7, 2025):

Thanks, but I don't see a relation to the issue above. The PR and discussion seems to be about some name resolver issue in alpine, but I am trying to update the Z2M container under debian.
The new Z2M version is downloaded correctly (the file is present in /opt/ but the installation seems to fail.

Maybe I just don't see the connection here, but if this isn't a script issue. Do you happen to know the cause and a possible solution?

@derolli1976 commented on GitHub (Jan 7, 2025): Thanks, but I don't see a relation to the issue above. The PR and discussion seems to be about some name resolver issue in alpine, but I am trying to update the Z2M container under debian. The new Z2M version is downloaded correctly (the file is present in /opt/ but the installation seems to fail. Maybe I just don't see the connection here, but if this isn't a script issue. Do you happen to know the cause and a possible solution?
Author
Owner

@michelroegl-brunner commented on GitHub (Jan 7, 2025):

My bad, typo on my side: #1221

@michelroegl-brunner commented on GitHub (Jan 7, 2025): My bad, typo on my side: #1221
Author
Owner

@derolli1976 commented on GitHub (Jan 8, 2025):

Ah thanks! I totally did not see this whole thread. Sorry for the hassle.

@derolli1976 commented on GitHub (Jan 8, 2025): Ah thanks! I totally did not see this whole thread. Sorry for the hassle.
Author
Owner

@Tuxdiver commented on GitHub (Jan 8, 2025):

Let me add something here: I had the same problem and I think, there is something missing in the update script:

cd /opt
wget -q "https://github.com/Koenkk/zigbee2mqtt/archive/refs/tags/${RELEASE}.zip"
unzip -q ${RELEASE}.zip
mv zigbee2mqtt-${RELEASE} /opt/zigbee2mqtt
rm -rf /opt/zigbee2mqtt/data

The old /opt/zigbee2mqtt directory is never deleted or moved, so the zigbee2mqtt-${RELEASE} directory will be moved INSIDE the old directory and all following steps fail of course.

So there should be a mv /opt/zigbee2mqtt /opt/z2m_backup/ or something like that before the mv zigbee2mqtt-${RELEASE} /opt/zigbee2mqtt

@Tuxdiver commented on GitHub (Jan 8, 2025): Let me add something here: I had the same problem and I think, there is something missing in the update script: cd /opt wget -q "https://github.com/Koenkk/zigbee2mqtt/archive/refs/tags/${RELEASE}.zip" unzip -q ${RELEASE}.zip mv zigbee2mqtt-${RELEASE} /opt/zigbee2mqtt rm -rf /opt/zigbee2mqtt/data The old `/opt/zigbee2mqtt` directory is never deleted or moved, so the `zigbee2mqtt-${RELEASE}` directory will be moved INSIDE the old directory and all following steps fail of course. So there should be a `mv /opt/zigbee2mqtt /opt/z2m_backup/` or something like that before the `mv zigbee2mqtt-${RELEASE} /opt/zigbee2mqtt`
Author
Owner

@gorbunovav commented on GitHub (Jan 11, 2025):

@MickLesk there is definitively a bug in the update script - it will not work for any further updates too.

@gorbunovav commented on GitHub (Jan 11, 2025): @MickLesk there is definitively a bug in the update script - it will not work for any further updates too.
Author
Owner

@spec997 commented on GitHub (Jan 11, 2025):

Hi, I’m experiencing the exact same issue and can’t update from version 1.42.0 to 2.0.0 Is there any chance the update script could be fixed?

@spec997 commented on GitHub (Jan 11, 2025): Hi, I’m experiencing the exact same issue and can’t update from version 1.42.0 to 2.0.0 Is there any chance the update script could be fixed?
Author
Owner

@gorbunovav commented on GitHub (Jan 11, 2025):

@spec997 the update script doesn't handle the migration from pre-2.0 to 2.0, so it makes more sense to follow instructions from the related PR #1221 description

@gorbunovav commented on GitHub (Jan 11, 2025): @spec997 the update script doesn't handle the migration from pre-2.0 to 2.0, so it makes more sense to follow instructions from the related PR #1221 description
Author
Owner

@MickLesk commented on GitHub (Jan 11, 2025):

You can Install a new LXC and migrate data from older lxc.

Nobody know the exactly state from every Z2M lxc.

@MickLesk commented on GitHub (Jan 11, 2025): You can Install a new LXC and migrate data from older lxc. Nobody know the exactly state from every Z2M lxc.
Author
Owner

@gorbunovav commented on GitHub (Jan 11, 2025):

@MickLesk the issue is not with the state of Z2M lxc.

The new version of the script tries to do the following:

mv zigbee2mqtt-${RELEASE} /opt/zigbee2mqtt

But the directory /opt/zigbee2mqtt is already there (there is a check for its presence at the beginning of the script and then it is never removed during the update process).
So the line above will put the new release directory inside the /opt/zigbee2mqtt instead of replacing it.

If you already have 2.0.0 in /opt/zigbee2mqtt the script will not fail because you have pnpm-lock.yaml in /opt/zigbee2mqtt, but the actual update will not happen either.

@gorbunovav commented on GitHub (Jan 11, 2025): @MickLesk the issue is not with the state of Z2M lxc. The new version of the script tries to do the following: ``` mv zigbee2mqtt-${RELEASE} /opt/zigbee2mqtt ``` But the directory `/opt/zigbee2mqtt` is already there (there is a check for its presence at the beginning of the script and then it is never removed during the update process). So the line above will put the new release directory inside the `/opt/zigbee2mqtt` instead of replacing it. If you already have 2.0.0 in `/opt/zigbee2mqtt` the script will not fail because you have `pnpm-lock.yaml` in `/opt/zigbee2mqtt`, but the actual update will not happen either.
Author
Owner

@spec997 commented on GitHub (Jan 11, 2025):

Hello, thanks for the quick response. In my case, the best option was to follow steps 1 through 6 from #1221. Once I confirmed everything was working, I shut down the machine and then copied the configuration.yaml, database.db, and state.json files. After that, I created a new machine using the script from Proxmox VE Helper-Scripts Finally, I restored the files, restarted, and everything worked as it should. Thanks for your help!

@spec997 commented on GitHub (Jan 11, 2025): Hello, thanks for the quick response. In my case, the best option was to follow steps 1 through 6 from #1221. Once I confirmed everything was working, I shut down the machine and then copied the configuration.yaml, database.db, and state.json files. After that, I created a new machine using the script from [Proxmox VE Helper-Scripts](https://community-scripts.github.io/ProxmoxVE/scripts?id=zigbee2mqtt) Finally, I restored the files, restarted, and everything worked as it should. Thanks for your help!
Author
Owner

@BSkando commented on GitHub (Jan 12, 2025):

Hello, thanks for the quick response. In my case, the best option was to follow steps 1 through 6 from #1221. Once I confirmed everything was working, I shut down the machine and then copied the configuration.yaml, database.db, and state.json files. After that, I created a new machine using the script from Proxmox VE Helper-Scripts Finally, I restored the files, restarted, and everything worked as it should. Thanks for your help!

This is what worked for me. Could not get the migration to work properly otherwise. Thanks!

@BSkando commented on GitHub (Jan 12, 2025): > Hello, thanks for the quick response. In my case, the best option was to follow steps 1 through 6 from #1221. Once I confirmed everything was working, I shut down the machine and then copied the configuration.yaml, database.db, and state.json files. After that, I created a new machine using the script from [Proxmox VE Helper-Scripts](https://community-scripts.github.io/ProxmoxVE/scripts?id=zigbee2mqtt) Finally, I restored the files, restarted, and everything worked as it should. Thanks for your help! This is what worked for me. Could not get the migration to work properly otherwise. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ProxmoxVE#292