In installed InfluxDB+Grafana from the OpenHabian-config tool, which seemed to work fine. Both the DB and grafana were working great. I just rebooted for the first time since then and Grafana failed to start.
sudo journalctl | grep grafana made it pretty obvious what the problem was… missing permissions to write log files: Failed to start grafana. error: failed to create log directory "/var/log/grafana": mkdir /var/log/grafana: permission denied
I fixed it with chmod ugo+rwx /var/log. This was probably more permissions that needed, but it needed it working and it’s working. If there is more appropriate set of permissions, someone please do tell and I will change it. Then sudo systemctl start grafana-server successfully started the service.
drwxr-xr-x 2 grafana grafana 4096 Jan 8 09:17 grafana
Directory here was created during the installation.
The postinstall script of the deb package contains following lines:
|
postinst:# Set user permissions on /var/log/grafana, /var/lib/grafana
postinst:mkdir -p /var/log/grafana /var/lib/grafana
postinst:chown -R $GRAFANA_USER:$GRAFANA_GROUP /var/log/grafana /var/lib/grafana
postinst:chmod 755 /var/log/grafana /var/lib/grafana
In case during installation there was no error and grafana was started during the installation I would assume that ZRAM was active during the install and the new created directory was not synced back to the SD card.
After making this post, I found NGINX also didn’t start. The /var/log/nginx directory and log file was gone. So this further eludes to the directories and everything having existed and then got deleted. I don’t know anything about zram but it sounds like that’s what happened.
I found the same thing happened when I rebooted again. The NGINX and Grafana log directories were gone and permissions gone.
I uninstalled zram from the menu. Ran the installer for InfluxDB+Grafana again without zram. Everything is fine now and worked upon rebooting.
I’m not familiar with zram. What are the benefits of reinstalling it? I’m concerned it will create more problems if there’s something wrong with it. Is leaving it off detrimental to anything?
Alright, zram it is. Should I expect to see this kind of problem with zram happening over and over then? Or should I expect reinstalling zram will fix whatever was wrong with it before?
BUT, does it stay that way after the next power loss? Prior to uninstalling and reinstalling zram, the entire directories and all permissions associated with them were lost when power was dropped. I would recreate the directories and fix the permissions. Then on power loss, it would all go away again. Like nothing was ever leaving the zram.
I haven’t tried cutting the power since uninstalling/reinstalling zram.
Had the same Issue and it took me the last 2 days to get it fixed. After I got Grafana running again, I had to reinstall my Deconz-Binding to which made me restart my RPi several times.
Just to find out, my Grafana wasn’t working again.
So it’s not just power loss but seems to be on every reboot, which is kind of annoying (and I do not remember having to do this on any previous reboots).
Same problem here.
Grafana and Nginx log directories are deleted on reboot of the RPI.
Manually adding the directories solves it, but is not a permanent fix.
I still have no idea what is causing this or how to solve it.
In case you do not have enabled ZRAM using openhabian-config it is not used.
Please check if you use a tmpfs ( especially for the /var/log directory ).