Problem with db permissions

hello,

In the last month I’ve been having a rather annoying problem that I can’t identify the cause of.

Basically, after a few hours that the grafana pod is online and the dashboard is working, some users get an error “cannot log in for this user”, in reality no user can log in and this is due to the fact that the pod user can no longer write to the database file since from “grafana” he became “root” without any action from my side.

logger=context userId=0 orgId=0 uname= t=2025-06-23T13:29:44.594832503Z level=error msg=“Error while signing in user” error=“failed to create auth token: attempt to write a readonly database” remote_addr=xx.xx.xx.xx traceID=
logger=context userId=0 orgId=0 uname= t=2025-06-23T13:29:44.594875199Z level=error msg=“Request Completed” method=POST path=/login status=500 remote_addr=10.45.86.126 time_ms=12 duration=12.014313ms size=54 referer=https://xxxxxxl/login handler=/login

If I restart the pods, the problem is solved temporarily, otherwise after a few hours or days the directory and file return to root ownership and the login is blocked again.

has anyone had the same problem or knows how to solve it?

We just had a similar issue yesterday. We are running a docker compose server with all our datasources on the same server. We have had permissions issues in the passed so we have a script to reset all the folder ownerships on the server. We have had this pop up when doing upgrades or changes to the instances. However yesterday out of the blue our grafana went off line completely with no one touching the server.

logger=user.sync t=2025-07-07T16:38:16.734449244Z level=error msg=“Failed to update last_seen_at” err=“attempt to write a readonly database” userId=3

we were completely locked out until we did a full restart and changed permissions. We could see the logs after the fact but at the time we had no access.

Still doing a follow up on this to see how it can be prevented in the future