zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Error in Proxmox

Open aperezva opened this issue 11 months ago • 13 comments

What happened?

Bare-metal installations (no Docker/Home Assistant add-on) For Git based installations: removed configuration.yaml from repo, this will result in the following error when updating: error: Your local changes to the following files would be overwritten by merge: data/configuration.yaml To fix this, update by executing: mv data/configuration.yaml data/configuration.yaml.bak ./update.sh # (update as you usually do) mv data/configuration.yaml.bak data/configuration.yaml

I have tried to do this intructions 3 times, and it´s not woirking.

What did you expect to happen?

Work as usual to update version in proxmox

How to reproduce it (minimal and precise)

trying again update and trying again the instructions and the same error

Zigbee2MQTT version

1.42.0

Adapter firmware version

20221226

Adapter

Slzb-06

Setup

Proxmox

Debug log

No response

aperezva avatar Jan 04 '25 18:01 aperezva

It look that i have the same Problem in Proxmox. The update is aborting.

root@zigbee2mqtt:/opt/zigbee2mqtt# ./update.sh Checking Zigbee2MQTT status... Stopping Zigbee2MQTT... Creating backup of configuration... Checking out changes to package-lock.json... Updated 0 paths from the index Updating... Updating a353acc8..3c46cfb2 error: Your local changes to the following files would be overwritten by merge: data/configuration.example.yaml data/configuration.yaml Please commit your changes or stash them before you merge. Aborting root@zigbee2mqtt:/opt/zigbee2mqtt#

first lines of configaration.yaml:

frontend: port: 8080 host: 192.168.168.27 homeassistant: false permit_join: true mqtt: base_topic: zigbee2mqtt server: mqtt://192.168.168.30:1883 user: iobroker password: password keepalive: 60 reject_unauthorized: false version: 4 client_id: Zigbee2mqtt serial: port: tcp://192.168.168.18:20130 adapter: zstack baudrate: 115200 advanced: pan_id: 53378 network_key: - 206 - 1 - 5 - 152 - 78 - 234 - 111 - 59 - 181 - 192 - 117 - 65 - 131 - 200 - 204 - 171 channel: 20 log_syslog: app_name: Zigbee2MQTT eol: /n host: localhost localhost: localhost path: /dev/log pid: process.pid port: 514 protocol: udp4 type: '5424' homeassistant_legacy_entity_attributes: false homeassistant_legacy_triggers: false
legacy_api: false legacy_availability_payload: false last_seen: ISO_8601_local log_level: warning device_options: legacy: false devices: '0x00158d00028a7dbe':

smarteshome2020 avatar Jan 04 '25 18:01 smarteshome2020

The issue is that the whole data/ directory has been added to gitignore (finally!). This causes the conflict with your local changes. Copy the file to a safe location, git restore the config (should be deleted), run the update, recover the config from the safe location. There is a related discussion on the Proxmox community-scripts repo.

dsiebel avatar Jan 04 '25 19:01 dsiebel

The issue is that the whole data/ directory has been added to gitignore (finally!). This causes the conflict with your local changes. Copy the file to a safe location, git restore the config (should be deleted), run the update, recover the config from the safe location. There is a related discussion on the Proxmox community-scripts repo.

git restore /opt/zigbee2mqtt/data/ delete the configuration.yaml and build a new one. After ./update i recieved al lot of errors.

root@zigbee2mqtt:/opt/zigbee2mqtt/data# ls -l total 348 -rw-r--r-- 1 root root 760 Jan 4 20:15 configuration.example.yaml -rw-r--r-- 1 root root 444 Jan 4 20:24 configuration.yaml -rw-r--r-- 1 root root 12579 Jan 4 19:09 configuration.yaml.bak -rw-r--r-- 1 root root 12064 Jan 4 19:08 configuration_V1_41_0.yaml -rw-r--r-- 1 root root 12579 Jan 4 19:06 configuration_V2_0_0.yaml -rw-r--r-- 1 root root 18612 Jan 4 20:19 coordinator_backup.json -rw-r--r-- 1 root root 87935 Jan 4 20:19 database.db -rw-r--r-- 1 root root 30029 Nov 8 18:46 database.db.backup drwxr-xr-x 3133 root root 131072 Jan 4 20:19 log -rw-r--r-- 1 root root 21298 Jan 4 20:29 state.json root@zigbee2mqtt:/opt/zigbee2mqtt/data# cd .. root@zigbee2mqtt:/opt/zigbee2mqtt# ./update.sh ERROR: Backup directory exists. May be previous restoring was failed?

  1. Save 'data-backup' and 'data' dirs to safe location to make possibility to restore config later.
  2. Manually delete 'data-backup' dir and try again. root@zigbee2mqtt:/opt/zigbee2mqtt# rm -r data-backup root@zigbee2mqtt:/opt/zigbee2mqtt# ./update.sh Checking Zigbee2MQTT status... Stopping Zigbee2MQTT... Creating backup of configuration... Checking out changes to package-lock.json... Updated 0 paths from the index Updating... Updating a353acc8..3c46cfb2 Fast-forward .github/workflows/ci.yml | 116 +- .github/workflows/codeql.yaml | 7 +- .github/workflows/release_please.yml | 6 +- .github/workflows/stale.yml | 8 +- .github/workflows/update_dep.yml | 9 +- .github/workflows/update_deps.yml | 13 +- .prettierignore | 2 +- .prettierrc | 1 + .release-please-manifest.json | 2 +- CHANGELOG.md | 131 ++ CODE_OF_CONDUCT.md | 30 +- CONTRIBUTING.md | 8 +- README.md | 24 +- babel.config.js | 5 - data/configuration.example.yaml | 29 +- data/configuration.yaml | 20 - docker/Dockerfile | 49 +- index.js | 11 +- lib/controller.ts | 100 +- lib/eventBus.ts | 14 +- lib/extension/availability.ts | 22 +- lib/extension/bind.ts | 322 +-- lib/extension/bridge.ts | 430 ++-- lib/extension/configure.ts | 48 +- lib/extension/extension.ts | 1 - lib/extension/externalConverters.ts | 76 +- lib/extension/externalExtension.ts | 120 -- lib/extension/externalExtensions.ts | 59 + lib/extension/externalJS.ts | 191 ++ lib/extension/frontend.ts | 46 +- lib/extension/groups.ts | 374 +--- lib/extension/homeassistant.ts | 589 ++---- lib/extension/legacy/bridgeLegacy.ts | 424 ---- lib/extension/legacy/deviceGroupMembership.ts | 67 - lib/extension/legacy/report.ts | 204 -- lib/extension/legacy/softReset.ts | 61 - lib/extension/networkMap.ts | 90 +- lib/extension/onEvent.ts | 6 +- lib/extension/otaUpdate.ts | 213 +- lib/extension/publish.ts | 81 +- lib/extension/receive.ts | 20 +- lib/model/device.ts | 17 +- lib/model/group.ts | 1 - lib/mqtt.ts | 134 +- lib/state.ts | 4 +- lib/types/api.ts | 687 +++++++ lib/types/mkdir-recursive.ts | 3 - lib/types/types.d.ts | 78 +- lib/types/zigbee2mqtt-frontend.d.ts | 2 +- lib/util/data.ts | 2 +- lib/util/logger.ts | 41 +- lib/util/settings.schema.json | 433 ++-- lib/util/settings.ts | 341 +-- lib/util/settingsMigration.ts | 586 ++++++ lib/util/utils.ts | 186 +- lib/util/yaml.ts | 6 +- lib/zigbee.ts | 49 +- package-lock.json | 8661 ----------------------------------------------------------------------------- package.json | 69 +- pnpm-lock.yaml | 3530 +++++++++++++++++++++++++++++++ scripts/install.sh | 75 - test/assets/{ => external_converters}/mock-external-converter-multiple.js | 12 - test/assets/{ => external_converters}/mock-external-converter.js | 0 test/assets/external_extensions/example2Extension.js | 16 + test/assets/{ => external_extensions}/exampleExtension.js | 6 +- test/bind.test.js | 943 --------- test/controller.test.js | 1005 --------- test/controller.test.ts | 1053 ++++++++++ test/{data.test.js => data.test.ts} | 10 +- test/{availability.test.js => extensions/availability.test.ts} | 274 ++- test/extensions/bind.test.ts | 774 +++++++ test/{bridge.test.js => extensions/bridge.test.ts} | 1750 ++++++++-------- test/{configure.test.js => extensions/configure.test.ts} | 197 +- test/extensions/externalConverters.test.ts | 357 ++++ test/extensions/externalExtensions.test.ts | 207 ++ test/extensions/frontend.test.ts | 437 ++++ test/extensions/groups.test.ts | 773 +++++++ test/{homeassistant.test.js => extensions/homeassistant.test.ts} | 1816 +++++++--------- test/{networkMap.test.js => extensions/networkMap.test.ts} | 662 +++--- test/extensions/onEvent.test.ts | 98 + test/extensions/otaUpdate.test.ts | 465 +++++ test/{publish.test.js => extensions/publish.test.ts} | 1371 ++++++------- test/{receive.test.js => extensions/receive.test.ts} | 514 +++-- test/externalConverters.test.js | 167 -- test/externalExtension.test.js | 149 -- test/frontend.test.js | 427 ---- test/group.test.js | 1111 ---------- test/legacy/bridgeLegacy.test.js | 538 ----- test/legacy/report.test.js | 315 --- test/lib/flushPromises.js | 2 - test/{logger.test.js => logger.test.ts} | 153 +- test/mocks/data.ts | 305 +++ test/mocks/debounce.ts | 5 + test/mocks/jszip.ts | 11 + test/mocks/logger.ts | 55 + test/mocks/mqtt.ts | 35 + test/mocks/sleep.ts | 11 + test/mocks/types.d.ts | 15 + test/mocks/utils.ts | 14 + test/{stub/zigbeeHerdsman.js => mocks/zigbeeHerdsman.ts} | 692 +++++-- test/onEvent.test.js | 80 - test/otaUpdate.test.js | 579 ------ test/{settings.test.js => settings.test.ts} | 300 +-- test/settingsMigration.test.ts | 920 +++++++++ test/stub/data.js | 302 --- test/stub/logger.js | 48 - test/stub/mqtt.js | 37 - test/stub/sleep.js | 10 - test/tsconfig.json | 10 + test/{utils.test.js => utils.test.ts} | 42 +- test/vitest.config.mts | 26 + tsconfig.json | 7 +- update.sh | 21 +- 113 files changed, 16092 insertions(+), 21969 deletions(-) delete mode 100644 babel.config.js delete mode 100644 data/configuration.yaml delete mode 100644 lib/extension/externalExtension.ts create mode 100644 lib/extension/externalExtensions.ts create mode 100644 lib/extension/externalJS.ts delete mode 100644 lib/extension/legacy/bridgeLegacy.ts delete mode 100644 lib/extension/legacy/deviceGroupMembership.ts delete mode 100644 lib/extension/legacy/report.ts delete mode 100644 lib/extension/legacy/softReset.ts create mode 100644 lib/types/api.ts delete mode 100644 lib/types/mkdir-recursive.ts create mode 100644 lib/util/settingsMigration.ts delete mode 100644 package-lock.json create mode 100644 pnpm-lock.yaml delete mode 100644 scripts/install.sh rename test/assets/{ => external_converters}/mock-external-converter-multiple.js (66%) rename test/assets/{ => external_converters}/mock-external-converter.js (100%) create mode 100644 test/assets/external_extensions/example2Extension.js rename test/assets/{ => external_extensions}/exampleExtension.js (61%) delete mode 100644 test/bind.test.js delete mode 100644 test/controller.test.js create mode 100644 test/controller.test.ts rename test/{data.test.js => data.test.ts} (83%) rename test/{availability.test.js => extensions/availability.test.ts} (56%) create mode 100644 test/extensions/bind.test.ts rename test/{bridge.test.js => extensions/bridge.test.ts} (75%) rename test/{configure.test.js => extensions/configure.test.ts} (52%) create mode 100644 test/extensions/externalConverters.test.ts create mode 100644 test/extensions/externalExtensions.test.ts create mode 100644 test/extensions/frontend.test.ts create mode 100644 test/extensions/groups.test.ts rename test/{homeassistant.test.js => extensions/homeassistant.test.ts} (60%) rename test/{networkMap.test.js => extensions/networkMap.test.ts} (68%) create mode 100644 test/extensions/onEvent.test.ts create mode 100644 test/extensions/otaUpdate.test.ts rename test/{publish.test.js => extensions/publish.test.ts} (51%) rename test/{receive.test.js => extensions/receive.test.ts} (51%) mode change 100755 => 100644 delete mode 100644 test/externalConverters.test.js delete mode 100644 test/externalExtension.test.js delete mode 100644 test/frontend.test.js delete mode 100644 test/group.test.js delete mode 100644 test/legacy/bridgeLegacy.test.js delete mode 100644 test/legacy/report.test.js delete mode 100644 test/lib/flushPromises.js rename test/{logger.test.js => logger.test.ts} (74%) create mode 100644 test/mocks/data.ts create mode 100644 test/mocks/debounce.ts create mode 100644 test/mocks/jszip.ts create mode 100644 test/mocks/logger.ts create mode 100644 test/mocks/mqtt.ts create mode 100644 test/mocks/sleep.ts create mode 100644 test/mocks/types.d.ts create mode 100644 test/mocks/utils.ts rename test/{stub/zigbeeHerdsman.js => mocks/zigbeeHerdsman.ts} (55%) delete mode 100644 test/onEvent.test.js delete mode 100644 test/otaUpdate.test.js rename test/{settings.test.js => settings.test.ts} (79%) create mode 100644 test/settingsMigration.test.ts delete mode 100644 test/stub/data.js delete mode 100644 test/stub/logger.js delete mode 100644 test/stub/mqtt.js delete mode 100644 test/stub/sleep.js create mode 100644 test/tsconfig.json rename test/{utils.test.js => utils.test.ts} (67%) create mode 100644 test/vitest.config.mts Installing dependencies... npm error code EUSAGE npm error npm error The npm ci command can only install with an existing package-lock.json or npm error npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or npm error later to generate a package-lock.json file, then try again. npm error npm error Clean install a project npm error npm error Usage: npm error npm ci npm error npm error Options: npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling] npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]] npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit] npm error [--no-bin-links] [--no-fund] [--dry-run] npm error [-w|--workspace [-w|--workspace ...]] npm error [-ws|--workspaces] [--include-workspace-root] [--install-links] npm error npm error aliases: clean-install, ic, install-clean, isntall-clean npm error npm error Run "npm help ci" for more info npm error A complete log of this run can be found in: /root/.npm/_logs/2025-01-04T19_31_03_820Z-debug-0.log root@zigbee2mqtt:/opt/zigbee2mqtt#

smarteshome2020 avatar Jan 04 '25 19:01 smarteshome2020

i had the same problem i solved it by:

git stash git stash drop

after that it worked when i removed data-backup

i tried it than again and got some errors so i did

npm install npm ci npm install -g pnpm

and then the update.sh worked again

KrX3D avatar Jan 04 '25 19:01 KrX3D

npm install -g pnpm

Thanks, after the npm commands it looks good :-)

root@zigbee2mqtt:~# npm install -g pnpm

changed 1 package in 2s

1 package is looking for funding run npm fund for details root@zigbee2mqtt:~# npm fund root

root@zigbee2mqtt:~# cd /opt/zigbee2mqtt/ root@zigbee2mqtt:/opt/zigbee2mqtt# ./update.sh Checking Zigbee2MQTT status... Stopping Zigbee2MQTT... Updating... Already up to date. Installing dependencies... Lockfile is up to date, resolution step is skipped Packages: +368 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Progress: resolved 368, reused 0, downloaded 368, added 368, done node_modules/.pnpm/[email protected]/node_modules/unix-dgram: Running install script, done in 2.7s node_modules/.pnpm/[email protected]/node_modules/sd-notify: Running install script, failed in 921ms (skipped as optional) node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 121ms node_modules/.pnpm/@[email protected]/node_modules/@serialport/bindings-cpp: Running install script, done in 222ms

dependencies:

  • ajv 8.17.1
  • bind-decorator 1.0.11
  • debounce 2.2.0
  • express-static-gzip 2.2.0
  • fast-deep-equal 3.1.3
  • finalhandler 1.3.1
  • git-last-commit 1.0.1
  • humanize-duration 3.32.1
  • js-yaml 4.1.0
  • json-stable-stringify-without-jsonify 1.0.1
  • jszip 3.10.1
  • moment 2.30.1
  • mqtt 5.10.3
  • object-assign-deep 0.4.0
  • rimraf 6.0.1
  • semver 7.6.3
  • source-map-support 0.5.21
  • throttleit 2.1.0
  • winston 3.17.0
  • winston-syslog 2.7.1
  • winston-transport 4.9.0
  • ws 8.18.0
  • zigbee-herdsman 3.2.1
  • zigbee-herdsman-converters 21.12.0
  • zigbee2mqtt-frontend 0.9.4

optionalDependencies:

  • sd-notify 2.8.0

devDependencies:

  • @eslint/core 0.9.1
  • @eslint/js 9.17.0
  • @ianvs/prettier-plugin-sort-imports 4.4.0
  • @types/eslint__js 8.42.3
  • @types/finalhandler 1.2.3
  • @types/humanize-duration 3.27.4
  • @types/js-yaml 4.0.9
  • @types/node 22.10.2
  • @types/object-assign-deep 0.4.3
  • @types/readable-stream 4.0.18
  • @types/sd-notify 2.8.2
  • @types/serve-static 1.15.7
  • @types/ws 8.5.13
  • @vitest/coverage-v8 2.1.8
  • eslint 9.17.0
  • eslint-config-prettier 9.1.0
  • prettier 3.4.2
  • tmp 0.2.3
  • typescript 5.7.2
  • typescript-eslint 8.18.2
  • vitest 2.1.8

Done in 10.9s Building...

[email protected] build /opt/zigbee2mqtt tsc && node index.js writehash

Starting Zigbee2MQTT... Done! root@zigbee2mqtt:/opt/zigbee2mqtt#

smarteshome2020 avatar Jan 04 '25 20:01 smarteshome2020

i´m a little confuse,

Please could you put together all the process I have to follow?.

Thanks

aperezva avatar Jan 04 '25 21:01 aperezva

I updated https://github.com/Koenkk/zigbee2mqtt/discussions/24198, search for Bare-metal installations (no Docker/Home Assistant add-on), hopefully this helps.

Koenkk avatar Jan 05 '25 12:01 Koenkk

I updated #24198, search for Bare-metal installations (no Docker/Home Assistant add-on), hopefully this helps.

Would it be possible to update your instructions to include the commands to cover the subsequent issues after following the bare-metal installation instructions?:

ERROR: Backup directory exists. May be previous restoring was failed?
Save 'data-backup' and 'data' dirs to safe location to make possibility to restore config later.
Manually delete 'data-backup' dir and try again.

then the subsequent npm errors.

AGitDev avatar Jan 07 '25 19:01 AGitDev

Hello, I have the same problem so here is what I did I ran ./update.sh, then problem occurs. so I do git stash git stash drop then npm install -g pnpm then git pull --no-rebase then ./update.sh again. this time it went through with the update. But now I can't access zigbee2mqtt user interface so I did pnpm run clean. Still can't access it and come to find out the file configuration.yaml disappear from /data folder. Any idea how I can restore my configuration.yaml file. Thank you.

deflao avatar Jan 11 '25 08:01 deflao

This worked perfectly for me with zigbee2mqtt running in Proxmox using tteck's script (debian).

sudo systemctl stop zigbee2mqtt
apt update
apt upgrade
git checkout data/configuration.example.yaml
git checkout package-lock.json
mv data/configuration.yaml data/configuration.yaml.bak
git stash
git stash drop
npm install
npm audit fix
npm ci
npm install -g pnpm
git pull --no-rebase
./update.sh
mv data/configuration.yaml.bak data/configuration.yaml
sudo systemctl start zigbee2mqtt

zupancicmarko avatar Feb 09 '25 20:02 zupancicmarko

This worked perfectly for me with zigbee2mqtt running in Proxmox using tteck's script (debian).

sudo systemctl stop zigbee2mqtt
apt update
apt upgrade
git checkout data/configuration.example.yaml
git checkout package-lock.json
mv data/configuration.yaml data/configuration.yaml.bak
git stash
git stash drop
npm install
npm audit fix
npm ci
npm install -g pnpm
git pull --no-rebase
./update.sh
mv data/configuration.yaml.bak data/configuration.yaml
sudo systemctl start zigbee2mqtt

Thanks. That solved it for me.

AGitDev avatar Feb 15 '25 14:02 AGitDev

Hi, I have the following error after ./update.sh:

root@zigbee2mqtt:/opt/zigbee2mqtt# ./update.sh Checking Zigbee2MQTT status... Updating... Already up to date. Installing dependencies...  ERROR  Failed to switch pnpm to v10.4.1. Looks like pnpm CLI is missing at "/root/.local/share/pnpm/.tools/pnpm/10.4.1/bin" or is incorrect spawnSync /root/.local/share/pnpm/.tools/pnpm/10.4.1/bin/pnpm ENOENT Building...  ERROR  Failed to switch pnpm to v10.4.1. Looks like pnpm CLI is missing at "/root/.local/share/pnpm/.tools/pnpm/10.4.1/bin" or is incorrect spawnSync /root/.local/share/pnpm/.tools/pnpm/10.4.1/bin/pnpm ENOENT Done! root@zigbee2mqtt:/opt/zigbee2mqtt#

This worked perfectly for me with zigbee2mqtt running in Proxmox using tteck's script (debian).

sudo systemctl stop zigbee2mqtt
apt update
apt upgrade
git checkout data/configuration.example.yaml
git checkout package-lock.json
mv data/configuration.yaml data/configuration.yaml.bak
git stash
git stash drop
npm install
npm audit fix
npm ci
npm install -g pnpm
git pull --no-rebase
./update.sh
mv data/configuration.yaml.bak data/configuration.yaml
sudo systemctl start zigbee2mqtt

Schmakus avatar Mar 06 '25 11:03 Schmakus

@Schmakus I'm also getting this same error now. I run 4 z2m instances, one local in HA, 2 in proxmox, 1 one Rasberry Pi. Since the update to 2, I have endless nightmares updating the 3 instance not in HA.

The solution for me was to re-install pnpm using corepack:

npm install --global corepack@latest
corepack enable pnpm
corepack use pnpm@latest-10

Hope that helps you?

thargy avatar May 02 '25 15:05 thargy

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Jul 02 '25 00:07 github-actions[bot]