I’ve unplugged my Raspberry PI 3B+ for 3 days because I needed to take it offline for a while. Now I’ve plugged it back in and everything works except for grafana. I can open the Basic UI, the PaperUI and so on but not Grafana. I my opinion I didn’t change anything since last time working (I know that everybody says that).
I forgot to mention: The systemctl restart grafana-server.service
gives me the following error:
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'grafana-server.service'.
Authenticating as: root
Password:
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to restart grafana-server.service: Access denied
See system logs and 'systemctl status grafana-server.service' for details.
i typed “openhabian” as password since this is the root password as default, acording to my Internet-Researches
I changed a few days earlier the owner of the openhab2 folder, to get access from network to it. I solved the problem causing me to do that with a other solution, but forgot to reset this ownership. Thats why I got that error message. I tryed with sudo… but that, of course, gave an Error because of the missing sudoers permission. Thats why I’ve tryed without the sudo and that caused this Error message. I fixed this permission thing now, so thats working and I get no error Message executing systemctl start grafana-server.service
but the Message from systemctl status grafana-server.service is still the same…
I’ve found out another Thing, but can’t really tell what to do with it:
running the Syslog during the start of the grafana-server.service brings up this error message:
Jun 24 14:44:27 openhab grafana-server[3617]: t=2020-06-24T14:44:27+0200 lvl=crit msg="Failed to parse /etc/grafana/grafana.ini, open /etc/grafana/grafana.ini: permission denied"
at beginning the owner of this file was “openhabian” I changed to root and back, but nothing really happend. Is there another userpermission I need to fix?
My problem was that many directories had the wrong owner. Because of that the grafana user hadn’t the permission to access its own files. I’ve corrected all the File-ownerships and Permissions, now is all back to life and running like it should.
(to give credit this was the lead to the solution:
but I marked this as solution cause it describes the error for future users)
Hi @Elektrokiste,
I am facing exactly the same problem, since I (clean) installed OH3 and Grafana and Influxdb via Openhabian.
May I ask you how you fixed the File-ownerships and Permissions?
Thank you!
In directory /var/cache/apt/archives/ you should be able to find a file that contains grafana in it’s name.
Do a
dpkg -c /var/cache/apt/archives/<name of the file here>
this will list all files contained in the deb package also showing the original permissions and ownership of the files and directories.
You can do a manual compare then ( do a ls -ld /< path >/< file > resp. ls -ld /< path > to see the permission and ownership of the files in your filesystem ).
I would suggest to start with directory and content under /etc.
@Wolfgang_S: Thanks for the quick reply. I got a little further. I did check the ownership and permissions of the grafana folders like you suggested. The permissions looked right or the same like in “ls -ld” to me. All the directories were owned by root. So I changed that with “sudo chown grafana: grafana -R /path”. Sadly grafana still won’t start.Is that he right way to correct the ownership?
Under /etc/grafana the files should have these ownership:
ls -ld /etc/grafana/ /etc/grafana/grafana.ini
drwxr-xr-x 2 root root 4096 Dec 17 19:40 /etc/grafana/
-rw-r----- 1 root grafana 7252 May 9 2020 /etc/grafana/grafana.ini
This means the file grafana.ini is owned by user root and belongs to the group grafana.
While the owner is able to ( r )ead and ( w )rite the group is able to ( r )ead the file.
An other thing is
Ok I think I was on the wrong trace. I did a fresh new intall of openhabian with grafana and checked all the files you mentioned. And they were exactly configured like you said they have to be. The funny thing is after installing influx+grafana via openhabian-config grafana works. But if i restart the rpi grafana won’t start up again. I just did the installation of influx+grafana to exclude any side effects of other software installation.
“systemctl status grafana-server.service” gave me the following, but I am not able to read any cause out of it:rafana-server.service - Grafana instance
Loaded: loaded (/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-12-26 13:56:19 CET; 62ms ago
Docs: http://docs.grafana.org
Process: 1734 ExecStart=/usr/sbin/grafana-server --config=${CONF_FILE} --pidfile=${PID_FILE_DIR}/grafana-server.pid –
Main PID: 1734 (code=exited, status=1/FAILURE)
Since I’m having same issues, this it what is shows running
sudo journalctl | grep grafana
result:
[19:53:59] openhabian@openHABianDevice:~$ sudo journalctl | grep grafana
[sudo] password for openhabian:
Dec 26 19:50:28 openHABianDevice **grafana**-server[897]: Failed to start **grafana**. error: failed to create log directory "/var/log/**grafana**": mkdir /var/log/**grafana**: permission denied
Dec 26 19:50:28 openHABianDevice systemd[1]: **grafana**-server.service: Main process exited, code=exited, status=1/FAILURE
Dec 26 19:50:28 openHABianDevice systemd[1]: **grafana**-server.service: Failed with result 'exit-code'.
Dec 26 19:50:28 openHABianDevice systemd[1]: **grafana**-server.service: Service RestartSec=100ms expired, scheduling restart.
Dec 26 19:50:28 openHABianDevice systemd[1]: **grafana**-server.service: Scheduled restart job, restart counter is at 1.
Dec 26 19:50:29 openHABianDevice **grafana**-server[1004]: Failed to start **grafana**. error: failed to create log directory "/var/log/**grafana**": mkdir /var/log/**grafana**: permission denied
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Main process exited, code=exited, status=1/FAILURE
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Failed with result 'exit-code'.
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Service RestartSec=100ms expired, scheduling restart.
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Scheduled restart job, restart counter is at 2.
Dec 26 19:50:29 openHABianDevice **grafana**-server[1026]: Failed to start **grafana**. error: failed to create log directory "/var/log/**grafana**": mkdir /var/log/**grafana**: permission denied
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Main process exited, code=exited, status=1/FAILURE
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Failed with result 'exit-code'.
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Service RestartSec=100ms expired, scheduling restart.
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Scheduled restart job, restart counter is at 3.
Dec 26 19:50:29 openHABianDevice **grafana**-server[1052]: Failed to start **grafana**. error: failed to create log directory "/var/log/**grafana**": mkdir /var/log/**grafana**: permission denied
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Main process exited, code=exited, status=1/FAILURE
Dec 26 19:50:29 openHABianDevice systemd[1]: **grafana**-server.service: Failed with result 'exit-code'.
Dec 26 19:50:30 openHABianDevice systemd[1]: **grafana**-server.service: Service RestartSec=100ms expired, scheduling restart.
Dec 26 19:50:30 openHABianDevice systemd[1]: **grafana**-server.service: Scheduled restart job, restart counter is at 4.
Dec 26 19:50:30 openHABianDevice **grafana**-server[1071]: Failed to start **grafana**. error: failed to create log directory "/var/log/**grafana**": mkdir /var/log/**grafana**: permission denied
Dec 26 19:50:30 openHABianDevice systemd[1]: **grafana**-server.service: Main process exited, code=exited, status=1/FAILURE
Dec 26 19:50:30 openHABianDevice systemd[1]: **grafana**-server.service: Failed with result 'exit-code'.
Dec 26 19:50:30 openHABianDevice systemd[1]: **grafana**-server.service: Service RestartSec=100ms expired, scheduling restart.
Dec 26 19:50:30 openHABianDevice systemd[1]: **grafana**-server.service: Scheduled restart job, restart counter is at 5.
Dec 26 19:50:30 openHABianDevice systemd[1]: **grafana**-server.service: Start request repeated too quickly.
Dec 26 19:50:30 openHABianDevice systemd[1]: **grafana**-server.service: Failed with result 'exit-code'.
running the folder permission it seems it’s just reading rights for others than admin, correct?
> [19:54:04] openhabian@openHABianDevice:~$ ls -ld /var/log
> drwxr-xr-x 1 root root 4096 Dec 26 19:50 /var/log
/var/log/grafana is normally being created during the installation by user root.
Thus the permissions for directory /var/log are correct.
I do not know if this cold be a probelm with zram but I would try to create the directory e.g.