homebridge-raspbian-image: hb-service update-node issue: Stops homebridge from starting.

Raspberry Pi Model

Raspberry Pi 4 B

Describe The Bug

This issue is happening for me on a bare metal install on rPI 4B from latest homebridge image.

Running into an issue with updating node to 18.15.0 I just installed latest homebridge image from scratch yesterday.

  • I first figured out how to restore from backup. That took a while. I had to make sure i was using homebridge 1.5.1 and UI-X 4.50.1. Otherwise it would not restore from backup.
  • After figuring that out, I then upgraded to latest homebridge via: sudo apt-get update sudo apt-get dist-upgrade All was good. I now had node version 18.13.0.
  • I then performed a “hb-service update-node” command to get the latest node version. Thats when homebridge would not start.

The update-node command appears to work.

pi@homebridge:/var/lib/homebridge $ sudo hb-service update-node
       Installing Node.js v18.15.0 over v18.13.0...
       Target: /opt/homebridge
       Download complete.
       Cleaned up npm at at /opt/homebridge/lib/node_modules/npm
       Installed Node.js v18.15.0
Please restart Homebridge for the changes to take effect.

Homebridge at this point wont start. When i then try and run the update command again. sudo hb-service update-node I get this error /usr/bin/env: ‘node’: No such file or directory

I am able to enter the shell:

pi@homebridge:/var/lib/homebridge $ sudo hb-service shell
Entering Homebridge Shell. To exit type 'exit'.

Note: This is a restricted shell, sudo cannot be used here.

Homebridge Terminal

bash: /opt/homebridge/bin/node: No such file or directory
Node.js Version: 
Node.js Path: /opt/homebridge/bin/node
Plugin Path: /var/lib/homebridge/node_modules

Notice the bash error? And also the Node.js version is blank. When I navigate to cd /opt/homebridge/bin/ And see directory contents ls -l I am able to see that node is present. So I don’t understand why the error. Also if it’s useful. When installing hombridge via the image. Homebridge appears to run as user pi.

This is all starting from a fresh homebridge image install. So there is no other Nodejs manager that was installed. I was able to repeat this issue from fresh install many times. I kept thinking I must have done something wrong.

I believe one time during my retry attempts I was able to update to node 18.15.0 successfully. On this one succesful update, I upgraded to it from the hb-service shell, and ran the update-node command. Homebridge worked and was on the latest 18.15.0 node. Subsequently I ran a sudo apt-get update, sudo apt-get dist-upgrade series of command, which also updated the homebridge package. That downgraded me to node 18.13.0. Homebridge would still load. So all was good. However after an hb-service update-node command. Homebridge then would no longer start again. Had the same issues noted above. So i think something happens that messes up the ability to upgrade node via hb-service update-node after performing your first os homebridge package update via apt-get install homebridge. I’m afraid right now of updating node via hb-service. I’ve got everything working. Any ideas what may be going on? Any ideas on how to recover from the “/usr/bin/env: ‘node’: No such file or directory” error if i were to try and update again?

Thanks for the help!

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

@rionshin There is no 64 bit image for homebridge, only 32 bit

@moodler recommend the “controller” app, It’s the most expensive app I’ve ever bought. But it’s paid for itself by saving time the multiple times I’ve had to reset everything in homekit. It can help you recover with backups that it lets you save. It’s quite magical the first time you use it to recover.

@rionshin I’ve tried also going back to older node versions after updating to 18.15.0 using update-node. But it never worked for me. I think the first time you run he-service update-node it messes up the homebridge install or at least the node environment settings in some way. Going back does not fix it for me. Only installing homebridge and re-Installing gets things working again for me.