Grafana failed to start after upgrade to 13.2

OS: Debian 13 Trixie
Grafana: version 13.2.0
Postgresql: PostgreSQL 17.11 (Debian 17.11-0+deb13u1)

Grafana failed to start after upgrade to 13.2 from 13.1.1.

2026-08-20T07:33:47.775444-04:00 raspberry05 systemd[1]: Started grafana-server.service - Grafana instance.
2026-08-20T07:33:48.675592-04:00 raspberry05 grafana[115709]: Error: ✗ pq: duplicate key value violates unique constraint "role_pkey" (23505)
2026-08-20T07:33:48.681000-04:00 raspberry05 systemd[1]: grafana-server.service: Main process exited, code=exited, status=1/FAILURE
2026-08-20T07:33:48.682598-04:00 raspberry05 systemd[1]: grafana-server.service: Failed with result 'exit-code'.
2026-08-20T07:33:48.683345-04:00 raspberry05 systemd[1]: grafana-server.service: Consumed 1.000s CPU time.
2026-08-20T07:33:48.906476-04:00 raspberry05 systemd[1]: grafana-server.service: Scheduled restart job, restart counter is at 1.

Had to update the sequence using.

SELECT setval(pg_get_serial_sequence('role', 'id'), COALESCE(MAX(id), 1)) FROM role;

Restarted Grafana. So far everything seems to be working.

These are the records created today in the role table.

id  |       created       |          updated          |        description

-----+---------------------+---------------------------+-----------------------------------------------------------
 131 | 2026-08-20 07:42:58 | 2026-08-20 07:42:58       | Read advisor UI translations.
 130 | 2026-08-20 07:42:58 | 2026-08-20 07:42:58       | Read and update the Grafana instance's SMTP configuration.

pq: duplicate key value violates unique constraint "role_pkey" indicates that PostgreSQL attempted to insert a role row with an ID that already existed. This is consistent with the role.id sequence being out of sync with the table’s actual maximum id.

Your setval() command resynchronized the sequence with the highest existing ID. It doesn’t modify or delete existing rows; it only changes the sequence state.

The two new rows you posted (IDs 130 and 131) were created successfully after the correction, which is a good indication that the sequence is now working correctly.