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

Permission error creating chunks directory #167

Open
keithskillicorn opened this issue Nov 6, 2022 · 26 comments
Open

Permission error creating chunks directory #167

keithskillicorn opened this issue Nov 6, 2022 · 26 comments

Comments

@keithskillicorn
Copy link

When starting Loki addon I get the following error and Loki stops:
`s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh

Add-on: Loki
Loki for Home Assistant

Add-on version: 1.11.2
You are running the latest version of this add-on.
System: Home Assistant OS 9.3 (amd64 / generic-x86-64)
Home Assistant Core: 2022.10.5
Home Assistant Supervisor: 2022.10.2

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to INFO
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun loki (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
s6-rc: info: service legacy-services successfully started
[14:29:37] INFO: Starting Loki...
[14:29:37] INFO: Using default config
[14:29:37] INFO: Retention period set to 30d
[14:29:37] INFO: Loki log level set to info
[14:29:37] INFO: Handing over control to Loki...
level=info ts=2022-11-04T14:29:38.253016834Z caller=main.go:103 msg="Starting Loki" version="(version=2.6.1, branch=HEAD, revision=6bd05c9a4)"
level=info ts=2022-11-04T14:29:38.253836497Z caller=modules.go:736 msg="RulerStorage is not configured in single binary mode and will not be started."
level=info ts=2022-11-04T14:29:38.254322253Z caller=server.go:288 http=127.0.0.1:8080 grpc=[::]:9095 msg="server listening on addresses"
level=info ts=2022-11-04T14:29:38.259738005Z caller=modules.go:962 msg="failed to initialize usage report" err="mkdir /data/loki/chunks: permission denied"
mkdir /data/loki/chunks: permission denied
error initialising module: compactor
github.com/grafana/dskit/modules.(*Manager).initModule
/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
/src/loki/pkg/loki/loki.go:341
main.main
/src/loki/cmd/loki/main.go:105
runtime.main
/usr/local/go/src/runtime/proc.go:255
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1581
level=error ts=2022-11-04T14:29:38.262652238Z caller=log.go:103 msg="error running loki" err="mkdir /data/loki/chunks: permission denied\nerror initialising module: compactor\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581"
[14:29:38] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped`

@PeteSSMMSS
Copy link

I have the same errors... can´t start the addon

@6773939989
Copy link

Hello same error here...

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh

Add-on: Loki
Loki for Home Assistant

Add-on version: 1.11.2
You are running the latest version of this add-on.
System: Home Assistant OS 9.2 (aarch64 / raspberrypi4-64)
Home Assistant Core: 2022.7.5
Home Assistant Supervisor: 2022.10.2

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to INFO
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun loki (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
s6-rc: info: service legacy-services successfully started
[11:52:58] INFO: Starting Loki...
[11:52:58] INFO: Using default config
[11:52:58] INFO: Retention period set to 30d
[11:52:58] INFO: Loki log level set to info
[11:52:58] INFO: Handing over control to Loki...
level=info ts=2022-11-08T10:52:59.118684538Z caller=main.go:103 msg="Starting Loki" version="(version=2.6.1, branch=HEAD, revision=6bd05c9a4)"
level=info ts=2022-11-08T10:52:59.121226269Z caller=server.go:288 http=127.0.0.1:8080 grpc=[::]:9095 msg="server listening on addresses"
level=info ts=2022-11-08T10:52:59.124498543Z caller=modules.go:736 msg="RulerStorage is not configured in single binary mode and will not be started."
level=info ts=2022-11-08T10:52:59.131744911Z caller=modules.go:962 msg="failed to initialize usage report" err="mkdir /data/loki/chunks: permission denied"
level=warn ts=2022-11-08T10:52:59.132276883Z caller=experimental.go:20 msg="experimental feature in use" feature="In-memory (FIFO) cache - chunksfifocache"
mkdir /data/loki/chunks: permission denied
error creating object client
github.com/grafana/loki/pkg/storage.(*store).chunkClientForPeriod
/src/loki/pkg/storage/store.go:185
github.com/grafana/loki/pkg/storage.(*store).init
/src/loki/pkg/storage/store.go:153
github.com/grafana/loki/pkg/storage.NewStore
/src/loki/pkg/storage/store.go:145
github.com/grafana/loki/pkg/loki.(*Loki).initStore
/src/loki/pkg/loki/modules.go:522
github.com/grafana/dskit/modules.(*Manager).initModule
/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:120
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
/src/loki/pkg/loki/loki.go:341
main.main
/src/loki/cmd/loki/main.go:105
runtime.main
/usr/local/go/src/runtime/proc.go:255
runtime.goexit
/usr/local/go/src/runtime/asm_arm64.s:1133
error initialising module: store
github.com/grafana/dskit/modules.(*Manager).initModule
/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
/src/loki/pkg/loki/loki.go:341
main.main
/src/loki/cmd/loki/main.go:105
runtime.main
/usr/local/go/src/runtime/proc.go:255
runtime.goexit
/usr/local/go/src/runtime/asm_arm64.s:1133
level=error ts=2022-11-08T10:52:59.135330401Z caller=log.go:103 msg="error running loki" err="mkdir /data/loki/chunks: permission denied\nerror creating object client\ngithub.com/grafana/loki/pkg/storage.(*store).chunkClientForPeriod\n\t/src/loki/pkg/storage/store.go:185\ngithub.com/grafana/loki/pkg/storage.(*store).init\n\t/src/loki/pkg/storage/store.go:153\ngithub.com/grafana/loki/pkg/storage.NewStore\n\t/src/loki/pkg/storage/store.go:145\ngithub.com/grafana/loki/pkg/loki.(*Loki).initStore\n\t/src/loki/pkg/loki/modules.go:522\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:120\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_arm64.s:1133\nerror initialising module: store\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_arm64.s:1133"
[10:52:59] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

@kristjanparve
Copy link

Same for me.

@mgguinne
Copy link

Same here. I wonder why?

@micoli
Copy link

micoli commented Nov 15, 2022

same for me if it can help there is the log

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Loki
 Loki for Home Assistant
-----------------------------------------------------------
 Add-on version: 1.11.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.3  (amd64 / generic-x86-64)
 Home Assistant Core: 2022.11.2
 Home Assistant Supervisor: 2022.10.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to INFO
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun loki (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
s6-rc: info: service legacy-services successfully started
[22:44:02] INFO: Starting Loki...
[22:44:02] INFO: Using default config
[22:44:02] INFO: Retention period set to 30d
[22:44:02] INFO: Loki log level set to info
[22:44:02] INFO: Handing over control to Loki...
level=info ts=2022-11-15T21:44:02.851238769Z caller=main.go:103 msg="Starting Loki" version="(version=2.6.1, branch=HEAD, revision=6bd05c9a4)"
level=info ts=2022-11-15T21:44:02.851566304Z caller=modules.go:736 msg="RulerStorage is not configured in single binary mode and will not be started."
level=info ts=2022-11-15T21:44:02.852008571Z caller=server.go:288 http=127.0.0.1:8080 grpc=[::]:9095 msg="server listening on addresses"
level=warn ts=2022-11-15T21:44:02.852533971Z caller=experimental.go:20 msg="experimental feature in use" feature="In-memory (FIFO) cache - chunksfifocache"
mkdir /data/loki/chunks: permission denied
error creating object client
github.com/grafana/loki/pkg/storage.(*store).chunkClientForPeriod
	/src/loki/pkg/storage/store.go:185
github.com/grafana/loki/pkg/storage.(*store).init
	/src/loki/pkg/storage/store.go:153
github.com/grafana/loki/pkg/storage.NewStore
	/src/loki/pkg/storage/store.go:145
github.com/grafana/loki/pkg/loki.(*Loki).initStore
	/src/loki/pkg/loki/modules.go:522
github.com/grafana/dskit/modules.(*Manager).initModule
	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:120
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
	/src/loki/pkg/loki/loki.go:341
main.main
	/src/loki/cmd/loki/main.go:105
runtime.main
	/usr/local/go/src/runtime/proc.go:255
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1581
error initialising module: store
github.com/grafana/dskit/modules.(*Manager).initModule
	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
	/src/loki/pkg/loki/loki.go:341
main.main
	/src/loki/cmd/loki/main.go:105
runtime.main
	/usr/local/go/src/runtime/proc.go:255
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1581
level=error ts=2022-11-15T21:44:02.854365538Z caller=log.go:103 msg="error running loki" err="mkdir /data/loki/chunks: permission denied\nerror creating object client\ngithub.com/grafana/loki/pkg/storage.(*store).chunkClientForPeriod\n\t/src/loki/pkg/storage/store.go:185\ngithub.com/grafana/loki/pkg/storage.(*store).init\n\t/src/loki/pkg/storage/store.go:153\ngithub.com/grafana/loki/pkg/storage.NewStore\n\t/src/loki/pkg/storage/store.go:145\ngithub.com/grafana/loki/pkg/loki.(*Loki).initStore\n\t/src/loki/pkg/loki/modules.go:522\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:120\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581\nerror initialising module: store\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581"
[21:44:02] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

@siw1973
Copy link

siw1973 commented Nov 27, 2022

Exact same error for me too.

@Locknes
Copy link

Locknes commented Nov 28, 2022

+1

Also tried
mkdir -p addons/data/loki/chunks && chown -R 12345:12345 &
mkdir -p addons/data/39bd2704-loki/chunks && chown -R 12345:12345, and I'm still receiving the error about permissions.

Full log below:

s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Loki
 Loki for Home Assistant
-----------------------------------------------------------
 Add-on version: 1.11.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.3  (amd64 / qemux86-64)
 Home Assistant Core: 2022.11.4
 Home Assistant Supervisor: 2022.11.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to INFO
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun loki (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
s6-rc: info: service legacy-services successfully started
[10:44:59] INFO: Starting Loki...
[10:44:59] INFO: Using default config
[10:44:59] INFO: Retention period set to 30d
[10:44:59] INFO: Loki log level set to info
[10:44:59] INFO: Handing over control to Loki...
level=info ts=2022-11-28T15:44:59.464938662Z caller=main.go:103 msg="Starting Loki" version="(version=2.6.1, branch=HEAD, revision=6bd05c9a4)"
level=info ts=2022-11-28T15:44:59.465016593Z caller=modules.go:736 msg="RulerStorage is not configured in single binary mode and will not be started."
level=info ts=2022-11-28T15:44:59.465319254Z caller=server.go:288 http=127.0.0.1:8080 grpc=[::]:9095 msg="server listening on addresses"
level=warn ts=2022-11-28T15:44:59.466172287Z caller=experimental.go:20 msg="experimental feature in use" feature="In-memory (FIFO) cache - chunksfifocache"
mkdir /data/loki/chunks: permission denied
error creating object client
github.com/grafana/loki/pkg/storage.(*store).chunkClientForPeriod
	/src/loki/pkg/storage/store.go:185
github.com/grafana/loki/pkg/storage.(*store).init
	/src/loki/pkg/storage/store.go:153
github.com/grafana/loki/pkg/storage.NewStore
	/src/loki/pkg/storage/store.go:145
github.com/grafana/loki/pkg/loki.(*Loki).initStore
	/src/loki/pkg/loki/modules.go:522
github.com/grafana/dskit/modules.(*Manager).initModule
	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:120
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
	/src/loki/pkg/loki/loki.go:341
main.main
	/src/loki/cmd/loki/main.go:105
runtime.main
	/usr/local/go/src/runtime/proc.go:255
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1581
error initialising module: store
github.com/grafana/dskit/modules.(*Manager).initModule
	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
	/src/loki/pkg/loki/loki.go:341
main.main
	/src/loki/cmd/loki/main.go:105
runtime.main
	/usr/local/go/src/runtime/proc.go:255
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1581
level=error ts=2022-11-28T15:44:59.466515989Z caller=log.go:103 msg="error running loki" err="mkdir /data/loki/chunks: permission denied\nerror creating object client\ngithub.com/grafana/loki/pkg/storage.(*store).chunkClientForPeriod\n\t/src/loki/pkg/storage/store.go:185\ngithub.com/grafana/loki/pkg/storage.(*store).init\n\t/src/loki/pkg/storage/store.go:153\ngithub.com/grafana/loki/pkg/storage.NewStore\n\t/src/loki/pkg/storage/store.go:145\ngithub.com/grafana/loki/pkg/loki.(*Loki).initStore\n\t/src/loki/pkg/loki/modules.go:522\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:120\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581\nerror initialising module: store\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581"
[15:44:59] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

@grumar
Copy link

grumar commented Nov 29, 2022

Today I've tried to configure promtail and also stucked on this error ( cannot start loki). Logs look more or less the same.
@mdegat01 let us knew if you need more details.
Thanks for your time!

@mdegat01
Copy link
Owner

mdegat01 commented Dec 6, 2022

Hey I just wanted to give an update. I am aware of this issue and am able to reproduce it. I missed it on update because it appears it does not affect existing instances that were updated to the latest version of Loki. I believe because the files it is complaining about already existed and had permissions set correctly. However I am able to reproduce it with an install from scratch and see the same error you all do, it appears the files cannot be created with the correct permissions at the time they are supposed to be anymore.

I was in the middle of working on a fix but when we had to rush to the hospital because the baby was coming. So now it will be a little bit before I can get back to it.

There's not really a good workaround in the meantime unfortunately. For users willing to dig in a bit there might be a way to get passed this if you have access to the docker CLI from the host shell. What I think would work is installing the addon and then doing the following before starting it:

arch="$(ha su info --raw-json | jq '.data.arch')"
docker pull "ghcr.io/mdegat01/loki/${arch}:1.10.2"
docker tag "ghcr.io/mdegat01/loki/${arch}:1.10.2" "ghcr.io/mdegat01/loki/${arch}:1.11.2"

What that should do is make HA use the image from the previous stable version instead of the latest one. Normally this would be a really bad idea since the addon config is still assuming its running the latest version. But I believe it should be safe in this case since really the only change from 1.10.2 to 1.11.2 was a bump in loki version.

Assuming it starts and runs successfully you should then be able to get to 1.11.2 by following up with this:

ha addons stop e9a81774_loki
arch="$(ha su info --raw-json | jq '.data.arch')"
docker pull "ghcr.io/mdegat01/loki/${arch}:1.11.2"
ha addons start e9a81774_loki

I want to clarify here that I have not tested this. I'm typing this out now because I've done similar things a lot of times in the past and I'm aware of the root cause here. If someone does try it I would appreciate a confirmation that it worked or let me know if not.

Will get to the actual issue when I can but may be some time with the newborn. Sorry about that!

@madface303
Copy link

Version 1.10.2 seems to have the same problem as 1.11.2, error when it tries to create the dirs. I made a last try with the 1.9.5 and then it works. Second problem is that the arch type variable is in double brackets so the docker pull command does not work.
Here are the commands i used in the end:

arch="$(ha su info --raw-json | jq '.data.arch' | tr -d '"')"
docker pull "ghcr.io/mdegat01/loki/${arch}:1.9.5"
docker tag "ghcr.io/mdegat01/loki/${arch}:1.9.5" "ghcr.io/mdegat01/loki/${arch}:1.11.2"

It starts and the dirs are created. Stop the addon in homeassistent (the ha addons stop command did not work for me either).

arch="$(ha su info --raw-json | jq '.data.arch' | tr -d '"')"
docker pull "ghcr.io/mdegat01/loki/${arch}:1.11.2"

And restart it using the gui. The addon should launch. So basically i removed the double quotes with | tr -d '"' and changed the version number.
@mdegat01 As always, thank you for your time and effort!

@niesink
Copy link

niesink commented Jan 16, 2023

Thanks both @mdegat01 and @madface303 this did indeed help me to work around the problem.
In case it helps anyone else: "access to the docker CLI from the host shell" in the case of a Home Assistant OS user basically means installing the 'SSH & Web Terminal' (or 'Terminal and SSH') addon and typing the above commands in the web ui that addon gives you.

@github-actions
Copy link

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Feb 16, 2023
@c-soft
Copy link

c-soft commented Feb 18, 2023

The wrokaround didnt work for me - seems like there is no "docker" command there?

core-ssh ~]$ docker pull "ghcr.io/mdegat01/loki/${arch}:1.9.5"
-bash: docker: command not found

This is when I SSH to the homeassistant addon, as suggested above.

Any hints?

@madface303
Copy link

The add-on you are using has no elevated access to the host, and then the docker command is not found. Install the addon niesink suggested:

image

And you have to disable the protected mode to access the docker command, but in this case the addon would tell you what to do.

@c-soft
Copy link

c-soft commented Feb 18, 2023

That was it, using right addon the workaround worked like a charm, thank you!

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Feb 19, 2023
@whoisdecoy
Copy link

whoisdecoy commented Feb 21, 2023

@madface303 @mdegat01

i followed your modified instructions, but am still getting the same error unfortunately. deleted all my images and tried again to no avail

@madface303
Copy link

madface303 commented Feb 22, 2023

Please try again one more time. Delete the addon in home assistant and reinstall.
Don't start it!
Go into the ssh addon and use the following commands:


arch="$(ha su info --raw-json | jq '.data.arch' | tr -d '"')"
docker pull "ghcr.io/mdegat01/loki/${arch}:1.9.5"
docker tag "ghcr.io/mdegat01/loki/${arch}:1.9.5" "ghcr.io/mdegat01/loki/${arch}:1.11.2"

Look if there aren't any errors after the commands
Then start the addon in homeassistant and look in the logs. Is the error still there?

(level=info ts=2022-11-04T14:29:38.259738005Z caller=modules.go:962 msg="failed to initialize usage report" err="mkdir /data/loki/chunks: permission denied")

If not, stop the addon, run

arch="$(ha su info --raw-json | jq '.data.arch' | tr -d '"')"
docker pull "ghcr.io/mdegat01/loki/${arch}:1.11.2"

and then restart the addon. If the error persists after the first docker commands i have no idea why.

@ccapndave
Copy link

@madface303 Thanks for this, it works for me!

@mf76130
Copy link

mf76130 commented Dec 12, 2023

Hi,
I have a fresh install of Loki 1.11.2 and get that error mkdir /data/loki/chunks: permission denied

@madface303
Copy link

It's a known problem, but the only solution this time is the workaround me and the other posted above. Please read from what i have written in Jan. and the next posts, it should solve your problem.

@codex70
Copy link

codex70 commented Apr 16, 2024

I've run the docker commands, it looks like loki and promtail are running perfectly fine, no errors, but cannot connect Grafana:

logger=tsdb.loki endpoint=checkHealth pluginId=loki dsName=loki dsUID=adix79yh5xu68a uname=admin fromAlert=false t=2024-04-16T18:44:20.651185202+02:00 level=info msg="Prepared request to Loki" duration=101.593µs queriesLength=1 stage=prepareRequest runInParallel=false
logger=tsdb.loki endpoint=checkHealth pluginId=loki dsName=loki dsUID=adix79yh5xu68a uname=admin fromAlert=false t=2024-04-16T18:44:20.658254446+02:00 level=error msg="Error received from Loki" duration=6.719392ms stage=databaseRequest statusCode=400 contentLength=65 start=1970-01-01T00:00:01Z end=1970-01-01T00:00:04Z step=1s query=vector(1)+vector(1) queryType=instant direction=backward maxLines=0 supportingQueryType=none lokiHost=39bd2704-loki:3100 lokiPath=/loki/api/v1/query status=error error="parse error at line 1, col 1: syntax error: unexpected IDENTIFIER" statusSource=downstream
logger=tsdb.loki endpoint=CheckHealth t=2024-04-16T18:44:20.658513298+02:00 level=error msg="Loki health check failed" error="error from loki: parse error at line 1, col 1: syntax error: unexpected IDENTIFIER"
logger=context userId=1 orgId=1 uname=admin t=2024-04-16T18:44:20.658991372+02:00 level=info msg="Request Completed" method=GET path=/api/datasources/uid/adix79yh5xu68a/health status=400 remote_addr=10.0.0.41 time_ms=11 duration=11.796302ms size=106 referer=http://homeassistant.local/api/hassio_ingress/-CbjdfgmpJq00qFUihAzlLJjqchaHJ0KD5LP_JYs3P0/connections/datasources/edit/adix79yh5xu68a handler=/api/datasources/uid/:uid/health status_source=server

Is Loki actually getting any data from Promtail, and how do I check this?

@Kfuhr
Copy link

Kfuhr commented Jul 5, 2024

I've run the docker commands, it looks like loki and promtail are running perfectly fine, no errors, but cannot connect Grafana:

logger=tsdb.loki endpoint=checkHealth pluginId=loki dsName=loki dsUID=adix79yh5xu68a uname=admin fromAlert=false t=2024-04-16T18:44:20.651185202+02:00 level=info msg="Prepared request to Loki" duration=101.593µs queriesLength=1 stage=prepareRequest runInParallel=false
logger=tsdb.loki endpoint=checkHealth pluginId=loki dsName=loki dsUID=adix79yh5xu68a uname=admin fromAlert=false t=2024-04-16T18:44:20.658254446+02:00 level=error msg="Error received from Loki" duration=6.719392ms stage=databaseRequest statusCode=400 contentLength=65 start=1970-01-01T00:00:01Z end=1970-01-01T00:00:04Z step=1s query=vector(1)+vector(1) queryType=instant direction=backward maxLines=0 supportingQueryType=none lokiHost=39bd2704-loki:3100 lokiPath=/loki/api/v1/query status=error error="parse error at line 1, col 1: syntax error: unexpected IDENTIFIER" statusSource=downstream
logger=tsdb.loki endpoint=CheckHealth t=2024-04-16T18:44:20.658513298+02:00 level=error msg="Loki health check failed" error="error from loki: parse error at line 1, col 1: syntax error: unexpected IDENTIFIER"
logger=context userId=1 orgId=1 uname=admin t=2024-04-16T18:44:20.658991372+02:00 level=info msg="Request Completed" method=GET path=/api/datasources/uid/adix79yh5xu68a/health status=400 remote_addr=10.0.0.41 time_ms=11 duration=11.796302ms size=106 referer=http://homeassistant.local/api/hassio_ingress/-CbjdfgmpJq00qFUihAzlLJjqchaHJ0KD5LP_JYs3P0/connections/datasources/edit/adix79yh5xu68a handler=/api/datasources/uid/:uid/health status_source=server

Is Loki actually getting any data from Promtail, and how do I check this?

did you resolve this - have the same issue.

@codex70
Copy link

codex70 commented Jul 5, 2024

I've run the docker commands, it looks like loki and promtail are running perfectly fine, no errors, but cannot connect Grafana:

logger=tsdb.loki endpoint=checkHealth pluginId=loki dsName=loki dsUID=adix79yh5xu68a uname=admin fromAlert=false t=2024-04-16T18:44:20.651185202+02:00 level=info msg="Prepared request to Loki" duration=101.593µs queriesLength=1 stage=prepareRequest runInParallel=false
logger=tsdb.loki endpoint=checkHealth pluginId=loki dsName=loki dsUID=adix79yh5xu68a uname=admin fromAlert=false t=2024-04-16T18:44:20.658254446+02:00 level=error msg="Error received from Loki" duration=6.719392ms stage=databaseRequest statusCode=400 contentLength=65 start=1970-01-01T00:00:01Z end=1970-01-01T00:00:04Z step=1s query=vector(1)+vector(1) queryType=instant direction=backward maxLines=0 supportingQueryType=none lokiHost=39bd2704-loki:3100 lokiPath=/loki/api/v1/query status=error error="parse error at line 1, col 1: syntax error: unexpected IDENTIFIER" statusSource=downstream
logger=tsdb.loki endpoint=CheckHealth t=2024-04-16T18:44:20.658513298+02:00 level=error msg="Loki health check failed" error="error from loki: parse error at line 1, col 1: syntax error: unexpected IDENTIFIER"
logger=context userId=1 orgId=1 uname=admin t=2024-04-16T18:44:20.658991372+02:00 level=info msg="Request Completed" method=GET path=/api/datasources/uid/adix79yh5xu68a/health status=400 remote_addr=10.0.0.41 time_ms=11 duration=11.796302ms size=106 referer=http://homeassistant.local/api/hassio_ingress/-CbjdfgmpJq00qFUihAzlLJjqchaHJ0KD5LP_JYs3P0/connections/datasources/edit/adix79yh5xu68a handler=/api/datasources/uid/:uid/health status_source=server

Is Loki actually getting any data from Promtail, and how do I check this?

did you resolve this - have the same issue.

I'm afraid not. I'm not using it, but would like to.

@Kfuhr
Copy link

Kfuhr commented Jul 6, 2024

@codex70 - got it to work - had to switch to a different repo (newer) for Promtail and Loki - https://github.com/bluemaex/home-assistant-addons

@codex70
Copy link

codex70 commented Jul 8, 2024

Fantastic news, I will take a look!

@ccapndave
Copy link

Me too! I have been wanting to use this plugin for a very long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests