homebridge-eufy-security / plugin

Homebridge plugin to control certain Eufy Security devices
Apache License 2.0
166 stars 24 forks source link

[Bug]: Cannot update from 1.0.8 to 2.0.0 (Error 505) #47

Closed Dominik-1980 closed 2 years ago

Dominik-1980 commented 2 years ago

What happened?

I can´t update to 2.0.0 because of Error 505 and Permission Denied.... Please see the log below...

`npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'homebridge-lib@5.1.15', npm WARN EBADENGINE required: { homebridge: '^1.3.5', node: '^14.18.1' }, npm WARN EBADENGINE current: { node: 'v16.15.0', npm: '8.5.5' } npm WARN EBADENGINE } npm ERR! code 1 npm ERR! path /homebridge/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge npm ERR! command failed npm ERR! command sh -c node install.js npm ERR! Downloading ffmpeg from https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-debian-armv7l.tar.gz npm ERR! node:events:505 npm ERR! throw er; // Unhandled 'error' event npm ERR! ^ npm ERR! npm ERR! Error: EACCES: permission denied, open '/root/.npm/_ffmpeg_for_homebridge/.download' npm ERR! Emitted 'error' event on WriteStream instance at: npm ERR! at emitErrorNT (node:internal/streams/destroy:157:8) npm ERR! at emitErrorCloseNT (node:internal/streams/destroy:122:3) npm ERR! at processTicksAndRejections (node:internal/process/task_queues:83:21) { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'open', npm ERR! path: '/root/.npm/_ffmpeg_for_homebridge/.download' npm ERR! }

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-05-28T16_03_29_008Z-debug-0.log `

github-actions[bot] commented 2 years ago

Did you check this Common Issues pages ?

thieren commented 2 years ago

Hi @Dominik-1980

There seems that there was a server error with the ffmpeg-for-homebridge dependency yesterday. I too couldn't download the file referenced in your log. Now it works for me.

Can you try again?

Dominik-1980 commented 2 years ago

I gave it a try right now. The error remains for me...

thieren commented 2 years ago

Could you please specify which homebridge version you're using? The log mentions that it's requiring version 1.3.5 and up. Actually for 2.0.0 you should even need a version > 1.4.1.

Maybe you'll have to update this package first.

Dominik-1980 commented 2 years ago

I am using 1.4.1 and homebridge docker on a raspberry pi 4

thieren commented 2 years ago

Did you already try to completely uninstall the plugin and then do a fresh install with 2.0.0?

Dominik-1980 commented 2 years ago

No, I didn't, because I don't want to loose all of my automations...

I tried to install 2.0.1-beta3. It works.

It is just the 2.0.0 Version which doesn't works.

So I will stay on 2.0.1-beta3 until the next stable version...

TimMichael69 commented 2 years ago

can not install the beta....

USER: root DIR: /homebridge CMD: npm install --save homebridge-eufy-security@2.0.1-beta.3

npm ERR! code 1 npm ERR! path /homebridge/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge npm ERR! command failed npm ERR! command sh -c node install.js npm ERR! Downloading ffmpeg from https://github.com/homebridge/ffmpeg-for-homebridge/releases/download/v0.1.0/ffmpeg-alpine-x86_64.tar.gz npm ERR! node:events:368 npm ERR! throw er; // Unhandled 'error' event npm ERR! ^ npm ERR! npm ERR! Error: EACCES: permission denied, open '/root/.npm/_ffmpeg_for_homebridge/.download' npm ERR! Emitted 'error' event on WriteStream instance at: npm ERR! at emitErrorNT (node:internal/streams/destroy:157:8) npm ERR! at emitErrorCloseNT (node:internal/streams/destroy:122:3) npm ERR! at processTicksAndRejections (node:internal/process/task_queues:83:21) { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'open', npm ERR! path: '/root/.npm/_ffmpeg_for_homebridge/.download' npm ERR! }

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-06-01T09_12_26_486Z-debug.log

Operation failed. Please review log for details.

thieren commented 2 years ago

Hi @TimMichael69

sry I can't reproduce this. For me it installs without any issues. According to your logs you have something going on with your permissions (despite being root).

But since this can't be reproduced I don't think we can help you here really.

Did you follow any tutorial for homebridge installation? I for example only know the global install option for plugins (npm install -g homebridge-eufy-security@beta). But your method also works for me.

TimMichael69 commented 2 years ago

I could install the beta with the command line in the last email. Wenn ich start HomeKit, the Homebridge freaks out…

[6/1/2022, 2:34:44 PM] [EufySecurity-2.0.1-beta.3] ERROR: Doorbell Error: spawn Unknown system error -8 at ChildProcess.spawn (node:internal/child_process:412:11) at spawn (node:child_process:698:9) at /homebridge/node_modules/homebridge-eufy-security/src/accessories/streamingDelegate.ts:276:37 at processTicksAndRejections (node:internal/process/task_queues:96:5) { errno: -8, code: 'Unknown system error -8', syscall: 'spawn' } [6/1/2022, 2:34:44 PM] [EufySecurity-2.0.1-beta.3] ERROR: Doorbell Failed to fetch snapshot. [Doorbell] Snapshot request handler provided empty image buffer!

The image is not showing in HomeKit

[6/1/2022, 2:34:29 PM] [EufySecurity-2.0.1-beta.3] WARN: T8010P2321062DE7 type: 2 [6/1/2022, 2:34:29 PM] [EufySecurity-2.0.1-beta.3] INFO: Updating accessory: EufyHomeBase2 [6/1/2022, 2:34:29 PM] [EufySecurity-2.0.1-beta.3] INFO: Updating accessory: Doorbell [6/1/2022, 2:34:29 PM] [HarmonyHub] {HarmonyHub} Found <4> activities: <Film, TV, Spiel, Switch> [6/1/2022, 2:34:29 PM] [EufySecurity-2.0.1-beta.3] WARN: Push Closed! [6/1/2022, 2:34:44 PM] [EufySecurity-2.0.1-beta.3] INFO: EufyHomeBase2 station livestream (P2P session) for Doorbell has started. [6/1/2022, 2:34:44 PM] [EufySecurity-2.0.1-beta.3] ERROR: Doorbell Error: spawn Unknown system error -8 at ChildProcess.spawn (node:internal/child_process:412:11) at spawn (node:child_process:698:9) at /homebridge/node_modules/homebridge-eufy-security/src/accessories/streamingDelegate.ts:276:37 at processTicksAndRejections (node:internal/process/task_queues:96:5) { errno: -8, code: 'Unknown system error -8', syscall: 'spawn' } [6/1/2022, 2:34:44 PM] [EufySecurity-2.0.1-beta.3] ERROR: Doorbell Failed to fetch snapshot. [Doorbell] Snapshot request handler provided empty image buffer! [6/1/2022, 2:34:59 PM] [EufySecurity-2.0.1-beta.3] WARN: Proxy Stream (id: 0) was terminated due to inactivity. (no data transmitted in 15 seconds) [6/1/2022, 2:34:59 PM] [EufySecurity-2.0.1-beta.3] INFO: EufyHomeBase2 station livestream for Doorbell has stopped.

Am 01.06.2022 um 13:48 schrieb thieren @.***>:

Hi @TimMichael69 https://github.com/TimMichael69 sry I can't reproduce this. For me it installs without any issues. According to your logs you have something going on with your permissions (despite being root).

But since this can't be reproduced I don't think we can help you here really.

Did you follow any tutorial for homebridge installation? I for example only know the global install option for plugins (npm install -g @.***). But your method also works for me.

— Reply to this email directly, view it on GitHub https://github.com/homebridge-eufy-security/plugin/issues/47#issuecomment-1143503394, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZNYMSZSMKCD5EV24ZCMRDDVM5EYXANCNFSM5XG2RKDQ. You are receiving this because you were mentioned.

thieren commented 2 years ago

It seems the plugin is unable to start the ffmpeg process on your system.

Did you try to install ffmpeg-for-homebridge globally as pointed out under https://github.com/homebridge-eufy-security/plugin/wiki/Common-Issues section Livestream?

Since this has nothing to do with the original issue I'll delete your posts and we can discuss this further in your other issue #60

thieren commented 2 years ago

Hey @Dominik-1980

Since this issue is not relevant for you anymore I'll close this. Please reopen if there are new things to share.

For anyone having update problems: There is a new section in Common issues which might help: https://github.com/homebridge-eufy-security/plugin/wiki/Common-Issues

permaMonk commented 2 years ago

Is this the same error?

I have had the same behavior updating to version 2.0.0. After a long painful process with de-installations, restarts, deleting directories, etc. I´ve got the system running again. Now it all comes up again when I try to install version 2.0.1.

-- USER: homebridge DIR: /usr/local CMD: sudo -E -n npm install -g homebridge-eufy-security@latest

npm WARN config global --global, --local are deprecated. Use --location=global instead. npm ERR! code 1 npm ERR! path /usr/local/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge npm ERR! command failed npm ERR! command sh -c node install.js npm ERR! Downloading ffmpeg from https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-raspbian-armv6l.tar.gz npm ERR! node:events:505 npm ERR! throw er; // Unhandled 'error' event npm ERR! ^ npm ERR! npm ERR! Error: EACCES: permission denied, open '/home/homebridge/.npm/_ffmpeg_for_homebridge/.download' npm ERR! Emitted 'error' event on WriteStream instance at: npm ERR! at emitErrorNT (node:internal/streams/destroy:157:8) npm ERR! at emitErrorCloseNT (node:internal/streams/destroy:122:3) npm ERR! at processTicksAndRejections (node:internal/process/task_queues:83:21) { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'open', npm ERR! path: '/home/homebridge/.npm/_ffmpeg_for_homebridge/.download' npm ERR! }

npm ERR! A complete log of this run can be found in: npm ERR! /home/homebridge/.npm/_logs/2022-06-21T15_47_18_367Z-debug-0.log

Operation failed. Please review log for details.

Sorry if I don't see what to do.

thieren commented 2 years ago

HI @permaMonk

can you attach the mentioned log /home/homebridge/.npm/_logs/2022-06-21T15_47_18_367Z-debug-0.log?

Better still: contact me on discord if you can.

permaMonk commented 2 years ago

Don´t know how to contact you directly in Discord. Don´t know how to copy (the contend of) this logfile.

thieren commented 2 years ago

just drag the file onto the textbox where you're typing your comment here. It will attach the file.

permaMonk commented 2 years ago

Drag&Drop not possible. I’m working only with CLI on that RasPi. Can open the log file with nano but unable to mark the whole content, then copy it to paste it in a text file on my PC.

Yes I know much to learn about Unix.

thieren commented 2 years ago

well you log into it using ssh or something, right? Just copy the file via ssh: https://www.simplified.guide/ssh/copy-file

permaMonk commented 2 years ago

Yes via ssh.

Your link sounds as a big help. I’ll try this later.

permaMonk commented 2 years ago

Ok it was a long way. Here it comes - the log file Logfile.txt .

thieren commented 2 years ago

Unfortunately it doesn't say exactly what's wrong, or I'm not seeing the issue right away.

Anyway the bug seems to be about the FFmpeg-for-homebridge dependency as was already stated by the error message above.

You could try a few things (I would suggest from top to bottom to do one step at a time and see if the update then works)

all commands will have to be run as root

  1. try to install the dependency manually: node /usr/local/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/install.js
  2. try to install the dependency globally: npm install -g ffmpeg-for-homebridge
  3. remove both installed directories (e.g. npm uninstall -g ffmpeg-for-homebridge and rm -rf node /usr/local/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ and rm -rf node /usr/local/lib/node_modules/ffmpeg-for-homebridge/ (the last one should do nothing if it was uninstalled correctly previously)

Try updating after each step and see if it has helped.

Let me know ;-)

permaMonk commented 2 years ago

I`ll give this a try on the weekend.

permaMonk commented 2 years ago

Ok, done. But nothing helped. :( Protocol.txt

So I´ve deinstalled the plugin and re installed. But same error as before. Now it´s gone - totally.

thieren commented 2 years ago

I have to admit that I'm longshotting here, but what happens if you'll drop the -E option from your sudo command?

Does any part of the path mentioned in the error messages even exist? /home/homebridge/.npm/_ffmpeg_for_homebridge/.download

permaMonk commented 2 years ago

You mean the original automated Homebridge-Eufy-security Plugin command “sudo -E -n npm install -g homebridge-eufy-security@latest”? Doing this manually on CLI without -E?

btw: What is the function of -E?

thieren commented 2 years ago

Yep. You can just run that manually on cli and it will do exactly what homebridge tries to do for you.

-E preserves the environment variables for this command. So homebridge tries to install something as root (hence the sudo) but want's it to use the $PATH, $HOME, etc. variables for it. My thinking is, that maybe something is wrong with these variables and by removing -E it will fallback to the root's user variables... But as said: without knowing the exact cause it's kind of a longshot.

For me at least a normal sudo npm install -g homebridge-eufy-security works just fine.

thieren commented 2 years ago

Btw. you should drop -n also I think. This prevents sudo from asking for a password. If you do this manually then it might error out due to the lack of the password.

permaMonk commented 2 years ago

So could say this worked. sudo npm install -g homebridge-eufy-security@latest added 145 packages, and audited 146 packages in 35s 23 packages are looking for funding run npm fund for details found 0 vulnerabilities

After restart Homebridge needed really long time to come up. A little fine tuning like unbridge the plugin. Replace username / MAC address and port number with the old data was necessary cause with the new data the Eufy Cam Status was not reachable / grey.

So happy again - but I'm afraid I'll have to do every future update manually.

Now a little bit later get red errors: ERROR: write EPIPE err: Error: write EPIPE at afterWriteDispatched (node:internal./stream_base_commons:160:15) at writeGeneric (node:internal./stream_base_commons:151:3) at Socket._writeGeneric (node:net:817:11) at Socket._write (node:net:829:8) at writeOrBuffer (node:internal./streams/writable:389:12) at _write (node:internal./streams/writable:330:10) at Socket.Writable.write (node:internal./streams/writable:334:10) at VideostreamProxy.ondata (node:internal./streams/readable:754:22) at VideostreamProxy.emit (node:events:527:28) at addChunk (node:internal./streams/readable:315:12) INFO: ErrorCode EPIPE

Sorry for the trouble.

TimMichael69 commented 2 years ago

So could say this worked. sudo npm install -g homebridge-eufy-security@latest added 145 packages, and audited 146 packages in 35s 23 packages are looking for funding run npm fund for details found 0 vulnerabilities

After restart Homebridge needed really long time to come up. A little fine tuning like unbridge the plugin. Replace username / MAC address and port number with the old data was necessary cause with the new data the Eufy Cam Status was not reachable / grey.

So happy again - but I'm afraid I'll have to do every future update manually.

Now a little bit later get red errors: ERROR: write EPIPE err: Error: write EPIPE at afterWriteDispatched (node:internal./stream_base_commons:160:15) at writeGeneric (node:internal./stream_base_commons:151:3) at Socket._writeGeneric (node:net:817:11) at Socket._write (node:net:829:8) at writeOrBuffer (node:internal./streams/writable:389:12) at _write (node:internal./streams/writable:330:10) at Socket.Writable.write (node:internal./streams/writable:334:10) at VideostreamProxy.ondata (node:internal./streams/readable:754:22) at VideostreamProxy.emit (node:events:527:28) at addChunk (node:internal./streams/readable:315:12) INFO: ErrorCode EPIPE

Sorry for the trouble.

Which Port did you use? how do I found which port my Doorbell is Using?

permaMonk commented 2 years ago

The plugin finds the entries username / MAC address and port number by itself and sets them in its config. I have only overwritten the new values with the entries from the backup of the old config.

thieren commented 2 years ago

So happy again - but I'm afraid I'll have to do every future update manually.

Now a little bit later get red errors:

Glad this helped.

The error you're experiencing is most likely this one: #14

Am I right to suspect that this only is a log output and doesn't crash the plugin/homebridge? As mentioned in the linked issue this is known but doesn't seem to introduce any unwanted behaviour. Also this seems to happen very randomly.

permaMonk commented 2 years ago

You are right - it’s a snippet of the log, no more crashing of the plug-in.

I take a look to the #14 thread later.