Grafana installed with snap store, where is the grafana.ini file?

Good evening. I have been using Grafana with prometheus on CentOS. Well considering the fate of CentOS I recently rebuilt the box running grafana with Ubuntu 20.04. So I ended up installing prometheus and grafana via the snap store. Everything works great. Minus one thing. I cannot find out where I should configure grapfana.ini and or custom.ini in the case of a snap store install.

If someone could just point me in the right direction with this rookie question it would be appreciated.

Thank you.

I don’t know for sure on CentOS but on Ubuntu linux snap config usually lives in ~/snap (the snap directory in the users home dir). So probably somewhere in ~/snap/grafana at a guess.

But to find out for sure you should be able to run:
snap run --shell SNAP_NAME_HERE

Then within the snap shell run env |grep SNAP to see the snap environment variables like SNAP_USER_DATA etc. Then exit to exit the snap shell.

Snaps are sandboxed so they can generally only read/write within the the home dir

1 Like

Thanks for the information. So I was able to see the env variables. But I am unsure which one points to where the config file should be.

The confusing part about the snap install with grafana is there are pieces/parts in several different directories it looks like. I am about to just uninstall and run a typical install via apt.

Here are the variables. Can you point out which one is the right directory for the config files?

SNAP_USER_DATA=/root/snap/grafana/36
SNAP_REVISION=36
SNAP_ARCH=amd64
SNAP_INSTANCE_KEY=
SNAP_REAL_HOME=/root
SNAP_USER_COMMON=/root/snap/grafana/common
SNAP=/snap/grafana/36
SNAP_COMMON=/var/snap/grafana/common
SNAP_NAME=grafana
SNAP_INSTANCE_NAME=grafana
SNAP_DATA=/var/snap/grafana/36
SNAP_VERSION=6.7.4
SNAP_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void

I don’t know much about snaps really but it looks like SNAP_USER_DATA=/root/snap/grafana/36 but as this is not your home dir it’s probably only present/available within the snap shell. So you probably won’t be able to see or edit the contents of /root/snap/grafana/36 outside of the snap shell. When a snap runs it has a sort of virtual sandboxed environment.

So you may be able to start the snap shell and see/edit .ini files within the snap shell itself. But I am only guessing…