# Grafana migration

**URL:** <https://community.grafana.com/t/grafana-migration/54055>\
**Category:** Configuration\
**Created:** [October 1, 2021, 11:05am UTC](https://community.grafana.com/t/grafana-migration/54055 "2021-10-01T11:05:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fed](https://avatars.discourse-cdn.com/v4/letter/f/ed8c4c/32.png) [@fed](https://community.grafana.com/u/fed)\
**Post date:** [October 1, 2021, 11:05am UTC](https://community.grafana.com/t/grafana-migration/54055/1 "2021-10-01T11:05:21Z")

</div>

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:

```auto
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:

```auto
$ 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:

```auto
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

---

<div class="post-metadata">

**Author:** ![fadjar340](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/fadjar340/32/10236_2.png) [@fadjar340](https://community.grafana.com/u/fadjar340)\
**Post date:** [October 2, 2021, 11:59am UTC](https://community.grafana.com/t/grafana-migration/54055/2 "2021-10-02T11:59:20Z")

</div>

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

> [@fed](#):
>
> ```auto
> 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"
> 
> ```

Regards,  
Fadjar Tandabawana
