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.
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.