What Grafana version and what operating system are you using?
grafana 8.5.9 and OS centos 7
Linux gec-co-graf01 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 30 14:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
What are you trying to achieve?
upgrade to version 9.2.5
How are you trying to achieve it?
we are using a grafana docker container with sqlite database
we are trying to run another container with image 9.2.5 with same database
What happened?
migration fails with following logs
logger=migrator t=2022-12-16T11:52:11.641947998Z level=warn msg="alert linked to obsolete notification channel, ignoring" alert="glc-dsb-redis01 - Redis Uptime alert" uid=ZCyZgxfMz
logger=migrator t=2022-12-16T11:52:11.641955625Z level=warn msg="alert linked to obsolete notification channel, ignoring" alert="gdc-als-re03 - SWAP Usage alert" uid=5
logger=migrator t=2022-12-16T11:52:11.64196354Z level=warn msg="alert linked to obsolete notification channel, ignoring" alert="gdc-als-re03 - SWAP Usage alert" uid=8
logger=migrator t=2022-12-16T11:52:12.481690314Z level=info msg="Executing migration" id="update dashboard_uid and panel_id from existing annotations"
logger=migrator t=2022-12-16T11:52:12.713124885Z level=info msg="Executing migration" id="dashboard permissions"
logger=migrator t=2022-12-16T11:52:12.738219442Z level=error msg="Executing migration failed" id="dashboard permissions" error="failed to migrate permissions: failed to create permissions for role: UNIQUE constraint failed: permission.role_id, permission.action, permission.scope"
logger=migrator t=2022-12-16T11:52:12.738258674Z level=error msg="Exec failed" error="failed to migrate permissions: failed to create permissions for role: UNIQUE constraint failed: permission.role_id, permission.action, permission.scope" sql="code migration"
Failed to start grafana. error: migration failed (id = dashboard permissions): failed to migrate permissions: failed to create permissions for role: UNIQUE constraint failed: permission.role_id, permission.action, permission.scope
migration failed (id = dashboard permissions): failed to migrate permissions: failed to create permissions for role: UNIQUE constraint failed: permission.role_id, permission.action, permission.scope
What did you expect to happen?
succesful migration to 9.2.5
Can you copy/paste the configuration(s) that you are having problems with?
standard config with 8.5.9, Please let me know if want to know specific values
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
UI couldn’t come up
Thanks for the information, before raising the issue, i saw this issue and tried this solution, but it doesn’t help. also as i see the that issue not resolved yet.
the above problem i stated is with a sqlite based grafana.
we today tried on a mysql based grafana too, and it also fails while migrating with following logs. this also is a 8.5.9 to 9.2.5 upgrade.
I reviewed your case with my team and it seems you would need to address the error you first reported failed to create permissions for role: UNIQUE constraint failed: permission.role_id, permission.action, permission.scope"
There were no custom roles created in the past, and i think with v8.5, RBAC was not there, and i dont see any options even now in grafana v8.5.9 with legacy alerting for creating roles.
Hi @usman.ahmad
My problem is about migrating from legacy alerting to unified alerting. Please check above comments for errors faced.
The link you have sent is for migrating with the same config and version. it doesn’t help.
Thanks
Copy your sqllite db elsewhere and query the alerts table wherein one of the columns has a value of 1-ZpF-i_cVz and see what is so odd/peculiar about that/those rows
Hello @yosiasz
This error was from our another env, which is running grafana 8.5.9 with mysql. in the comment i just gave an example that this is also failing to migrate.
for the sake solving this issue, i would still like to stick the error i have specified in problem statement, which is grafana 8.5.9 witih sqlite db.
i have pasted the content of tables here