InfluxDB service not starting after reboot

Hello there,

I have some trouble with the InfluxDB service.

After a reboot it is not starting / It sarts with an error.
I have no clue what happenened

but if i do

sudo apt reinstall influxdb
sudo service influxdb start 

everything works again. Untill the next reboot.

Could it be a problem with my SD card?

Greetings
Manuel

Try sudo systemctl enable influxdb. This will tell the system to start the service at startup

and the error message is ?
Do you use openhabian ?

Thanks for the Answers.

@Felix_Schneider: service is enabled.

@Wolfgang_S:

Yes i use Opehabian on a Raspberry.
After reboot the Output of

sudo service influxdb status

is

xxxx@openhabian:~ $ sudo service influxdb status

● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2022-05-22 11:46:50 CEST; 33s ago
     Docs: https://docs.influxdata.com/influxdb/
  Process: 1583 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=1/FAILURE)

May 22 11:46:50 openhabian systemd[1]: influxdb.service: Service RestartSec=100ms expired, scheduling restart.
May 22 11:46:50 openhabian systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 5.
May 22 11:46:50 openhabian systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
May 22 11:46:50 openhabian systemd[1]: influxdb.service: Start request repeated too quickly.
May 22 11:46:50 openhabian systemd[1]: influxdb.service: Failed with result 'exit-code'.
May 22 11:46:50 openhabian systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.

if i simply reinstall it works again. also my data is still there then.

What i think is strange is:

My Data is retained… so at Zram saves Influxdb Data to the Sdcard. Yet something happens at reboot that i cannot start the service again… (also not manually…, After reinstall i can stop and start the service as often as i want untill the next reboot)

I also ran Fix Permisssions from openhabian conf. but it did not help.

After failing to start influxdb due to reboot please have a look to

sudo journalctl -u influxdb.service

that should give a further hint.
I assume that permissions inside of zram are correct but not in the underlying file system.
The reason why influxdb does not start should be logged in either journalctl and/or in influxdb log ( /var/log/influxdb/influxdb.log ).
reinstall fixes the permissions in zram thus you are able to restart the service in a booted system.

the output of sudo journalctl -u influxdb.service is :


May 22 11:46:49 openhabian systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.
May 22 11:46:50 openhabian systemd[1]: influxdb.service: Service RestartSec=100ms expired, scheduling restart.
May 22 11:46:50 openhabian systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 4.
May 22 11:46:50 openhabian systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
May 22 11:46:50 openhabian systemd[1]: Starting InfluxDB is an open-source, distributed, time series database...
May 22 11:46:50 openhabian influxd-systemd-start.sh[1583]: /usr/lib/influxdb/scripts/influxd-systemd-start.sh: line 5: /var/lib/influxdb/influxd.pid: Permission denied
May 22 11:46:50 openhabian systemd[1]: influxdb.service: Control process exited, code=exited, status=1/FAILURE
May 22 11:46:50 openhabian systemd[1]: influxdb.service: Failed with result 'exit-code'.

so it seems to be a permission issue

/var/log/influxdb/ is empty after restart → no file in directory

any idea what i can do?

the directory

needs to be owned by influxdb:influxdb.
What I did at the time I had a similar problem was to switch of zram for a moment.
Do the installation without running zram. Making sure that reboot works and then I installed/activated zram again.
It could be that it is enough to check for the underlying directory by checking the output of the mount command on the console ( mount | grep influxdb ).
There should be output like:

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)

It could be that it would be enough to fix the permissions of one of these directories mentioned in that row. But without having an example that does not work I am not sure.

1 Like

It worked.
I deactivated zram in openhabian-config. Then reinstalled Influxdb and activated zram.

thank you !

1 Like