wylanswets / homebridge-icontrol-platform

Enables iControl home security systems and other accessories in Homebridge for homekit
4 stars 2 forks source link

Permissions Issue? #1

Closed AFN40 closed 4 years ago

AFN40 commented 4 years ago

Any advice on how to solve the below? Thanks!

Error: EACCES: permission denied, mkdir '/persist' at Object.mkdirSync (fs.js:823:3) at Function.sync (/usr/lib/node_modules/homebridge-icontrol-platform/node_modules/mkdirp/index.js:71:13) at LocalStorage.parseDirSync (/usr/lib/node_modules/homebridge-icontrol-platform/node_modules/node-persist/src/local-storage.js:642:20) at LocalStorage.parseDataDirSync (/usr/lib/node_modules/homebridge-icontrol-platform/node_modules/node-persist/src/local-storage.js:572:21) at LocalStorage.initSync (/usr/lib/node_modules/homebridge-icontrol-platform/node_modules/node-persist/src/local-storage.js:145:14) at Object.nodePersist.initSync (/usr/lib/node_modules/homebridge-icontrol-platform/node_modules/node-persist/src/node-persist.js:41:29) at new iControl (/usr/lib/node_modules/homebridge-icontrol-platform/node_modules/icontrol-api/index.js:26:11) at new iControlPlatform (/usr/lib/node_modules/homebridge-icontrol-platform/index.js:32:25) at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:337:32) at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:90:36) at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:59:10) at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) at internal/main/run_main_module.js:17:11

wylanswets commented 4 years ago

Hmm, it looks like the persist module can’t create its folder. What operating system are you running on?

It’s also looking like it’s trying to create that folder on the root of the drive... which would cause most OSs to complain. How are you trying to start homebridge? You may want to change directories to like your user home folder or the homebridge folder before trying to start it, as it creates that folder wherever the pwd is (present working directory).

AFN40 commented 4 years ago

Thanks for the response! I'm On Raspbian.

I followed these instructions to install Homebridge and the UI/X plugin: https://github.com/oznu/homebridge-config-ui-x/wiki/Homebridge-&-Systemd-(Raspbian,-Ubuntu,-Debian)

choukalos commented 4 years ago

I get a similar error message and my homebridge refuses to start until I remove the platforms configuration block.

Clip from logs: Error: EACCES: permission denied, mkdir '/homebridge/persist' at Object.mkdirSync (fs.js:752:3) at Function.sync (/usr/local/lib/node_modules/homebridge/node_modules/mkdirp/index .js:71:13) at LocalStorage.parseDirSync (/usr/local/lib/node_modules/homebridge/node_modules/ hap-nodejs/node_modules/node-persist/src/local-storage.js:642:20) at LocalStorage.parseDataDirSync (/usr/local/lib/node_modules/homebridge/node_modu les/hap-nodejs/node_modules/node-persist/src/local-storage.js:572:21) at LocalStorage.initSync (/usr/local/lib/node_modules/homebridge/node_modules/hap- nodejs/node_modules/node-persist/src/local-storage.js:145:14) at Object.nodePersist.initSync (/usr/local/lib/node_modules/homebridge/node_module s/hap-nodejs/node_modules/node-persist/src/node-persist.js:41:29) at Object.init (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/ind ex.js:31:13) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:30:7) at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22 ) at Module._compile (internal/modules/cjs/loader.js:701:30) /usr/local/lib/node_modules/homebridge/node_modules/mkdirp/index.js:90 throw err0; ^

I'm running in a docker container (ozone-homebridge) on a Synology NAS Docker Image: ozone-homebridge (latest) Homebridge version 0.4.53 Container is based on Alpine Linux (3.11.3) NodeJS version v12.16.1 NPM version v6.13.4

The docker image is using user: abc, group: users folder /homebridge/persist already exists and has permissions 710 the JSON files within the persist directory have either 644 or 710 permissions - save user/group

Like @AFN40 I installed the homebridge-config-ui-x plugin and use that to install/manage plugins and configuration.

Travisco29 commented 4 years ago

i am having this issue also

wylanswets commented 4 years ago

So @AFN40 it looks like the plugin is trying to create a folder at the root of the system called "persist". I can see that being an issue in any modern linux distro. Otherwise it may be ownership problems. The thing about this plugin currently is it uses a "relative" path for where to create and read that folder from. This means that when the UI program you're using launches homebridge, wherever it executes from in a relative directory is where it tries to create the folder, and the file ownership would be whatever it is executed as as well....

One possible solution is I could tinker with allowing a folder override variable in the config so you could define a known folder location for it to store it's data in if you have a location selected that could work for the persist library to write to.

wylanswets commented 4 years ago

You can now define a path on your own using the new "path" parameter in the config. If you do not provide a path it will behave the same way it does now. This should help track down the issue, I'll mark closed for now but please re-open this if you still have this issue after using the "path" option (see readme).

AFN40 commented 4 years ago

Thank you @wylanswets ! Your solution worked perfectly. Created the persist folder where I had the correct permissions, rebooted and it worked.

AFN40 commented 4 years ago

@wylanswets One more question if you don't mind. I have 3 doors that have wired sensors from a previous ADT installation. Essentially they were retrofitted to work with the Xfinity Home system. Does this plugin only support Xfinity-provided equipment?

The two windows I have Xfinity sensors on show up in the Home app but not the 3 doors.

wylanswets commented 4 years ago

I didn’t know they could retrofit sensors, that’s pretty neat! How did they pull that off?

If they aren’t showing up then I’m sure this plugin does not recognize them. Really the only option I’d have to even try that is if you were willing to send me a login to your system to take a look.

joedahero commented 4 years ago

I know this issue is closed but I’m not sure where to put this info. I ran into this same issue and found a setting in homebridge-config-ui-x that solves the problem. In the plugin settings, in the advanced section there is a checkbox for “Use Sudo”. Enabling this setting seems to allows this plugin the proper permissions to launch correctly. I hope this helps someone.

wylanswets commented 4 years ago

@joedahero thanks for that info! Personally I do not use homebridge-config-ui-x so that insight is very useful. That also makes sense that super user permissions would make it work. If you don't mind it running with elevated permissions (not too much to be worried about honestly) that works out just fine.