Grafana migration

Hi folks,
trying to migrate grafana from one server to another. Both are centos and I’m upgrading to grafana 8 in the new server.
Roughly I’m following these steps:

  • Install new instance of Grafana
  • Install used plugin on new server
  • Stop Grafana service on source and destination server
  • Copy /var/lib/grafana/grafana.db from old to new server
  • Check /etc/grafana/grafana.ini
  • Restart Grafana

Here comes the hassle: sudo systemctl restart grafana-server gives me:

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

This is strange, as the only thing that caused it was the overwrite of /var/lib/grafana/grafana.db with my old .db file. If I simply delete it and restart the service a new smaller (500kb) .db is created and I can see a fresh instance correctly running. Here the error:

$ sudo systemctl status grafana-server.service
● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disable>
   Active: failed (Result: exit-code) since Fri 2021-10-01 12:28:50 CEST; 3min 29s ago
     Docs: http://docs.grafana.org
  Process: 35075 ExecStart=/usr/sbin/grafana-server --config=${CONF_FILE} --pidfile=${PID_FILE_DIR>
 Main PID: 35075 (code=exited, status=1/FAILURE)

All env veriables in /etc/sysconfig/grafana-server seem to be existing and rightly called by the service.
The only critical message I get from /var/log/grafana.log is:

t=2021-10-01T12:52:07+0200 lvl=crit msg="alert migration failure: could not get migration log" logger=migrator error="failed to check table existence: unable to open database file: permission denied"

I don’t undesrtand which db the log refers to (I imagien something sqlite related?) as I gave the right permission to grafana.db

Any hint is higly appreciated!!!

Thanks

Hi there…

Is your /var/lib/grafana/grafana.db owner is grafana:grafana?

It’s clear that the owner of the grafana.db it’s not grafana as per

Regards,
Fadjar Tandabawana

2 Likes