homebridge / docker-homebridge

Homebridge Docker. HomeKit support for the impatient using Docker on x86_64, Raspberry Pi (armhf) and ARM64. Includes ffmpeg + libfdk-aac.
https://hub.docker.com/r/homebridge/homebridge/
GNU General Public License v3.0
2.57k stars 240 forks source link

Failed to start. Log says `config.json (/homebridge/config.json) not found` and `Error: EACCES: permission denied, mkdir '/homebridge/accessories'` #383

Closed boris1993 closed 3 years ago

boris1993 commented 3 years ago

Describe Your Problem:

Homebridge is failing on starting.

Logs:

[8/5/2021, 3:39:45 PM] [HB Supervisor] Restarting Homebridge...
[8/5/2021, 3:39:45 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /homebridge/node_modules
[8/5/2021, 3:39:45 PM] [HB Supervisor] Started Homebridge v1.3.4 with PID: 5178
Initializing HAP-NodeJS v0.9.4...
[8/5/2021, 3:39:46 PM] config.json (/homebridge/config.json) not found.
Error: EACCES: permission denied, mkdir '/homebridge/accessories'
    at Object.mkdirSync (fs.js:1009:3)
    at Object.module.exports.makeDirSync (/usr/local/lib/node_modules/homebridge/node_modules/fs-extra/lib/mkdirs/make-dir.js:101:15)
    at StorageService.initSync (/usr/local/lib/node_modules/homebridge/src/storageService.ts:10:15)
    at new BridgeService (/usr/local/lib/node_modules/homebridge/src/bridgeService.ts:130:25)
    at new Server (/usr/local/lib/node_modules/homebridge/src/server.ts:119:26)
    at cli (/usr/local/lib/node_modules/homebridge/src/cli.ts:79:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
[8/5/2021, 3:39:46 PM] [HB Supervisor] Homebridge Process Ended. Code: 1, Signal: null
[8/5/2021, 3:39:51 PM] [HB Supervisor] Restarting Homebridge...

Docker Start Command:

docker-compose.yml:

version: '3'

services:
  homebridge:
    image: oznu/homebridge:latest
    restart: always
    container_name: homebridge
    network_mode: host
    environment:
      - TZ=Asia/Shanghai
      - DSM_HOSTNAME=DS218plus
      - HOMEBRIDGE_CONFIG_UI=1
      - HOMEBRIDGE_CONFIG_UI_PORT=8581
    volumes:
      - /volume2/docker-data/homebridge:/homebridge

Homebridge Config:

I didn't modify it. This is the auto-generated one.

{
    "bridge": {
        "name": "Homebridge DD96",
        "username": "0E:B2:FE:38:DD:96",
        "port": 52142,
        "pin": "031-45-154"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        }
    ]
}

Screenshots:

Environment:

Client:
 Version:           20.10.3
 API version:       1.41
 Go version:        go1.15.6
 Git commit:        b455053
 Built:             Mon Jun 21 02:03:40 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.3
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.15.6
  Git commit:       a3bc36f
  Built:            Mon Jun 21 02:05:07 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.4.3
  GitCommit:        ea3508454ff2268c32720eb4d2fc9816d6f75f88
 runc:
  Version:          v1.0.0-rc93
  GitCommit:        31cc25f16f5eba4d0f53e35374532873744f4b31
 docker-init:
  Version:          0.19.0
  GitCommit:        ed96d00
boris1993 commented 3 years ago

Fixed by specifying my UID and GID in the docker-compose.yml