Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating homebridge-config-ui-x to 4.5.2 causes homebridge-config-ui-x to stop working #220

Closed
HammerAce42 opened this issue Aug 9, 2019 · 26 comments
Labels

Comments

@HammerAce42
Copy link

Describe Your Problem:
UI was showing an update to the homebridge-config-ui-x plugin available. I tried installing and upon restarting, the UI failed to load. I deleted the existing docker container, updated to the latest using docker-compose pull homebridge and recreated it.

To ensure it wasn't a coincidence, I tried updating again once the new container was up and running and had the same outcome.

Logs: (including only the pieces which seem relevant)

homebridge_1 | [8/9/2019, 3:55:59 AM] Error: Cannot find module 'commander'
homebridge_1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
homebridge_1 | at Function.Module._load (internal/modules/cjs/loader.js:562:25)
homebridge_1 | at Module.require (internal/modules/cjs/loader.js:692:17)
homebridge_1 | at require (internal/modules/cjs/helpers.js:25:18)
homebridge_1 | at Object. (/usr/local/lib/node_modules/homebridge-config-ui-x/dist/index.js:12:19)
homebridge_1 | at Module._compile (internal/modules/cjs/loader.js:778:30)
homebridge_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
homebridge_1 | at Module.load (internal/modules/cjs/loader.js:653:32)
homebridge_1 | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
homebridge_1 | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
homebridge_1 | at Module.require (internal/modules/cjs/loader.js:692:17)
homebridge_1 | at require (internal/modules/cjs/helpers.js:25:18)
homebridge_1 | at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:72:23)
homebridge_1 | at Server. (/usr/local/lib/node_modules/homebridge/lib/server.js:153:14)
homebridge_1 | at Array.forEach ()
homebridge_1 | at Server._loadPlugins (/usr/local/lib/node_modules/homebridge/lib/server.js:145:22)
homebridge_1 | at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:57:24)
homebridge_1 | at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:32:16)
homebridge_1 | at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
homebridge_1 | at Module._compile (internal/modules/cjs/loader.js:778:30)
homebridge_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
homebridge_1 | at Module.load (internal/modules/cjs/loader.js:653:32)

[8/9/2019, 3:55:59 AM] Error: The requested platform 'config' was not registered by any plugin.
homebridge_1 | at API.platform (/usr/local/lib/node_modules/homebridge/lib/api.js:134:13)
homebridge_1 | at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:327:45)
homebridge_1 | at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:90:36)
homebridge_1 | at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10)
homebridge_1 | at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
homebridge_1 | at Module._compile (internal/modules/cjs/loader.js:778:30)
homebridge_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
homebridge_1 | at Module.load (internal/modules/cjs/loader.js:653:32)
homebridge_1 | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
homebridge_1 | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
homebridge_1 | at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
homebridge_1 | at startup (internal/bootstrap/node.js:283:19)
homebridge_1 | at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
homebridge_1 | [8/9/2019, 3:55:59 AM] Got SIGTERM, shutting down Homebridge...
homebridge_1 | s6-applyuidgid: fatal: unable to exec homebridge-config-ui-x: No such file or directory
homebridge_1 | s6-applyuidgid: fatal: unable to exec homebridge-config-ui-x: No such file or directory
homebridge_1 | s6-applyuidgid: fatal: unable to exec homebridge-config-ui-x: No such file or directory

Docker Start Command:

Docker Compose file:

version: '2'
services:
homebridge:
image: oznu/homebridge:latest
restart: always
network_mode: host
volumes:
- ./config:/homebridge
environment:
- PGID=1000
- PUID=1000
- HOMEBRIDGE_CONFIG_UI=1
- HOMEBRIDGE_CONFIG_UI_PORT=80

Environment:

  • Host Operating System: Raspbian
@oznu
Copy link
Member

oznu commented Aug 9, 2019

Hi @HammerAce42,

I can't replicate, but perhaps npm failed to install the updated package correctly.

You can get back up and running by executing these commands in the same folder as your docker-compose.yml file:

docker-compose down
docker-compose up -d

Note: The UI updates to take a few minutes (5+) on a Pi , make sure you're not closing the update window or restarting while the command is in progress.

@HammerAce42
Copy link
Author

Had it happen twice though. I am already back up and running since I deleted and recreated the container one more time, but I still see the update pending. Are you planning to publish an updated docker container with the newer version of the UI plugin?

Here's something that might have caused me to get into a weird state:
I tried to update the ui plugin by using sudo npm install -g --unsafe-perm homebridge-config-ui-x via the terminal in the UI a few days ago since I was trying the homebridge-gsh plugin and hadn't seen the note that it was still work in progress, so thought I wasn't seeing the setup UI due to an outdated version of the ui plugin. I ultimately ran sudo npm uninstall -g --unsafe-perm homebridge-config-ui-x to undo any effects of that right before installing the update via the UI for the first time earlier today. In any case, I thought deleting and recreating the docker container would get me back to a good state, but that seems not to be the case? Is there a more thorough way to reset to get to a good state?

@oznu
Copy link
Member

oznu commented Aug 9, 2019

I just published a new image. To update:

docker-compose pull
docker-compose up -d

While uninstalling the homebridge-config-ui-x plugin would have caused things to break, a new container should have fixed everything up.

@HammerAce42
Copy link
Author

Thanks for the new image! That obviously takes care of the update notification for the ui plugin. I'll close this out for now and re-open in case the same problem arises when the next ui plugin release is published.

@HammerAce42
Copy link
Author

This occurred again today when trying to update config-ui-x to 4.6.0. Any suggestions on how to get to a clean config since the below commands clear up the issue temporarily but it comes back each time I attempt a config-ui-x update?

 docker-compose down
docker-compose up -d

If all fails, I plan to just re-image the SD card and setup everything again, but hoping it doesn't come to that.

@HammerAce42 HammerAce42 reopened this Aug 15, 2019
@jpetticrew
Copy link

+1 for me. Every time I try to update to 4.6.0 I have to manually restart using
docker-compose down docker-compose up -d

@HammerAce42
Copy link
Author

HammerAce42 commented Aug 16, 2019

So I ended up re-imaging and setting everything up again, only to find that the issue still occurs when updating. Unfortunately, I only saw jpetticrew's +1 after I had started the re-imaging.

Sounds like pulling a new docker image with the latest config-ui-x is the workaround. Oznu, could you update the docker image to include the published 4.6.0 version of config-ui-x (the one in the latest docker image is currently homebridge-config-ui-x v4.6.0-beta.40, which still shows the update prompt). Also, may I suggest disabling updates to that specific plugin via the UI until the root cause is figured out and addressed?

@killerrabbit33
Copy link

I have the same problem. Pulling a new image works just fine (as long as it has an updated plugin!) but updating through the UI itself still breaks the plugin.

@oznu
Copy link
Member

oznu commented Aug 16, 2019

Are you all running on Raspberry Pi?

@killerrabbit33
Copy link

Yes, I'm running on a 3B with Docker.

@oznu
Copy link
Member

oznu commented Aug 16, 2019

Could you try this, in Homebridge Config UI X go to the Terminal (Docker logo -> Terminal) and run this command then restart (using the UI):

npm install -g --unsafe-perm homebridge-config-ui-x@latest

If that works I have a theory why it might be breaking.

@killerrabbit33
Copy link

killerrabbit33 commented Aug 16, 2019

Did not work. It never finished the install--it stopped at about 2/3 of the way for more than 10 minutes, and restarting after that leads to the same error.

Edit: recreating the image still fixes the problem.

@oznu
Copy link
Member

oznu commented Aug 16, 2019

Thanks for testing. That rules out one theory I had. Can you try this:

  1. Open the UI to the Status page in a browser tab and just leave it running there while you complete the following steps.

  2. From the command line on your Raspberry Pi exec into you container

docker-compose exec homebridge sh
  1. Try the install command here:
npm install -g --unsafe-perm homebridge-config-ui-x@latest

@killerrabbit33
Copy link

Seems to get me the same result. This is where it hangs:
[ ......] \ remove:homebridge-config-ui-x: sill doSerial remove 10
It doesn't show the progress bar but it's about 2/3 of the way there.

Many thanks for looking into this--It's late where I am so I'll return tomorrow to keep working.

@jpetticrew
Copy link

FWIW, I am running on Ubuntu Server.

@oznu
Copy link
Member

oznu commented Aug 16, 2019

I can't replicate this on a Raspberry Pi 4 or Ubuntu Server 18.04 (my main docker machine and the only platform I actually test everything on).

While it does hang on [ ......] \ remove:homebridge-config-ui-x: sill doSerial remove 10, it will always resume after a few minutes.

I'm thinking this is due to some file locking like issue, where the npm update command is trying to overwrite a file that's currently in use. While I have no immediate fix for this issue, I do have plans to do an "offline" upgrade, where Homebridge Config UI X will itself down to update itself which should alleviate this issue.

@jpetticrew
Copy link

Mine also hangs on that step but always comes back. Mine fails on the restart. It never comes back up.

@oznu
Copy link
Member

oznu commented Aug 16, 2019

In the meantime, I just pushed an image update with the latest UI; v4.6.0 and the new Node.js v10.16.3.

@killerrabbit33
Copy link

Sounds good. Thank you again for investigating!

@HammerAce42
Copy link
Author

I noticed v4.6.1 of ui-x is now available. @oznu, have you made any changes that might fix the upgrade issue? If so, I will give updating a shot.

@jpetticrew
Copy link

I just tried to update. Same issue. Update “finished” and told me to restart Homebridge and it failed to restart. Had to do it manually.

@oznu
Copy link
Member

oznu commented Aug 24, 2019

Nothing new for this issue sorry. There is a new docker image out.

@oznu
Copy link
Member

oznu commented Aug 25, 2019

After a failed upgrade, where the UI is refusing to start, can you please provide the output from this command (executed inside the container):

ls -la $(npm -g prefix)/lib/node_modules/homebridge-config-ui-x/node_modules

@killerrabbit33
Copy link

I already pulled a new image with the updated plugin. Is there a way to pull the previous build so I can try to update the plugin?

@oznu oznu added the pinned label Sep 13, 2019
@oznu
Copy link
Member

oznu commented Oct 8, 2019

4.6.2 should fix this, but it won't help you getting you to 4.6.2 - so you may need to update the docker image manually again.

@killerrabbit33
Copy link

Thank you! Updated the image and everything is working. Looking forward to trying the plugin update. Thanks again for looking into this.

@oznu oznu removed the pinned label Nov 3, 2019
@oznu oznu closed this as completed Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants