[SOLVED] Influx doesn't start after openhabian-config as it wants to start as root

Hi Wolfgang,

and the story goes on. Similar like what happened before I started this thread that influxdb stopped working happened this morning. What is even weirder is that I have two openHAB instances running (dev and prod) that have both their own influxdb services running and both(!) stopped working this morning. I have no clue what the cause was but it happened. Now I cannot get them to run anymore.

When I start it with

sudo systemctl start influxdb

I get

Job for influxdb.service failed because the control process exited with error code.
See "systemctl status influxdb.service" and "journalctl -xe" for details.

journalctl --unit=influxdb -n 100 --no-pager

hardly tells anything

Jan 07 10:14:32 openhabian influxd-systemd-start.sh[31117]: /usr/lib/influxdb/scripts/influxd-systemd-start.sh: line 5: /var/lib/influxdb/influxd.pid: Permission denied
Jan 07 10:14:32 openhabian systemd[1]: influxdb.service: Control process exited, code=exited, status=1/FAILURE
Jan 07 10:14:32 openhabian systemd[1]: influxdb.service: Failed with result 'exit-code'.
Jan 07 10:14:32 openhabian systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.
Jan 07 10:14:32 openhabian systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 5.
Jan 07 10:14:32 openhabian systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
Jan 07 10:14:32 openhabian systemd[1]: influxdb.service: Start request repeated too quickly.
Jan 07 10:14:32 openhabian systemd[1]: influxdb.service: Failed with result 'exit-code'.
Jan 07 10:14:32 openhabian systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.

except permission denied of /var/lib/influxdb/influxd.pid

ls -l /var/lib/influxdb

says

drwxr-xr-x 2 root root 4096 Jan 7 09:56 data
drwxr-xr-x 2 root root 4096 Jan 7 09:56 meta

less /var/log/influxdb/influxdb.log
/var/log/influxdb/influxdb.log: No such file or directory

mount | grep influxdb
/dev/mmcblk0p2 on /opt/zram/influxdb.bind type ext4 (rw,noatime)
overlay2 on /var/lib/influxdb type overlay (rw,relatime,lowerdir=/opt/zram/influxdb.bind,upperdir=/opt/zram/zram2/upper,workdir=/opt/zram/zram2/workdir,redirect_dir=on)

I deactivated zram, reinstalled influx, it did’t start, reactivated zram, it is still not starting…

sudo chown -R influxdb:influxdb /var/lib/influxdb/*

after doing all these things I ended up with the following

influxd

2023-01-07T10:04:54.600923Z	info	InfluxDB starting	{"log_id": "0fEvtZn0000", "version": "1.8.10", "branch": "1.8", "commit": "688e697c51fd"}
2023-01-07T10:04:54.601032Z	info	Go runtime	{"log_id": "0fEvtZn0000", "version": "go1.13.8", "maxprocs": 4}
/var/lib/influxdb/meta/meta.dbtmp: permission denied

and

sudo systemctl restart influxdb
sudo journalctl -u influxdb.service

Jan 07 11:08:12 openhabian systemd[1]: Starting InfluxDB is an open-source, distributed, time series database...
Jan 07 11:08:12 openhabian influxd-systemd-start.sh[39012]: /usr/lib/influxdb/scripts/influxd-systemd-start.sh: line 5: /var/lib/influxdb/influxd.pid: Permission denied

UPDATE - SOLUTION

Based on what I found here InfluxDB doesn't work after reboot, problem with rights - #5 by ostap

what did help was

sudo chown -R 1000:1000 /var/lib/influxdb 
sudo chown -R influxdb:influxdb /var/lib/influxdb

sudo systemctl daemon-reload
sudo systemctl enable influxdb.service
sudo systemctl start influxdb.service

Though what I still don’t understand why it happened in the first place and not for the first time? :worried:

1 Like