Grafana config file installing with snap

Hey everyone,

I’m an electronics engineer, so please bear with me if I’m doing something comp sci obvious!

I’ve installed grafana on Linux Mint, using snap. From what I can understand, this means that it’s somewhat sandboxed.

I can’t edit the config file that’s in /snap/grafana/current/conf/defaults.ini as it’s read only - from what I understand, I shouldn’t be editing this one anyway, I should be editing grafana.ini - but it’s not in the dir I’m told “/etc/grafana/grafana.ini” as the grafana dir doesn’t exist.

I’d like to edit the config to setup the smtp settings.

Can anyone offer any help? I’ve been looking all day for it, to no avail. I’ve been trying to use grep to locate it too, but no luck!

Thanks

Based on grafana.wrapper\bin - grafana-snap - [no description], the config file $SNAP_DATA/conf/grafana.ini is used by the snap.

According to Environment variables | Snapcraft documentation, in your case $SNAP_DATA will be /var/snap/grafana/<the-snap-revision-you-installed>. You should be able to edit that file with sudo (or create it if it doesn’t already exist).

Hope that helps point you in the right direction!

2 Likes

Ah thank you so much!!!

So, I had tried making a grafana.ini file in /var/snap/grafana/<the-snap-revision-you-installed, I copied the config file from /snap/grafana/36/conf to the above directory, renamed it to grafan.ini (it was previously defaults.ini), changed the ‘app_mode’ to development (just so I could see in /admin/settings on grafana web page whether it was reading the config) but nothing was working.

However, after you explained that it’s looking in $SNAP_DATA/conf/grafana.ini , I can see I should have also made a dir called conf. I did that, and it’s working! Thank you so much, I don’t think I’d ever have figured it out haha!

3 Likes

Glad you got it sorted! Yeah the snap documentation is sometimes lacking, partly because many snaps are packaged by individuals rather than the software publishers themselves. But it’s often reasonably easy to work out what’s going on by looking at the snap repo.