Grafana-server Init Failed - Ubuntu 20.04

Hi,

Using Grafana 8.3 in Ubuntu 20.04. When I went to the desktop environment to use Grafana, it wouldn’t connect. In the command line, when I type:

sudo netstat -lp

I noticed port 3000 wasn’t listed anymore.

starting the grafana server i get this below

a@a:~$ grafana-server
Grafana-server Init Failed: Could not find config defaults, make sure homepath command line parameter is set or working directory is homepath

when checking the status, I get this:

● grafana-server.service - Grafana instance
     Loaded: loaded (/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2022-01-05 16:06:11 MST; 11min ago
       Docs: http://docs.grafana.org
    Process: 4621 ExecStart=/usr/sbin/grafana-server --config=${CONF_FILE} --pidfile=${PID_FILE_DIR}/grafana-server.pid --packaging=deb cfg:default.paths.lo>
   Main PID: 4621 (code=exited, status=1/FAILURE)

Jan 05 16:06:11 antonio-GC676AA-ABA-m8150n systemd[1]: grafana-server.service: Scheduled restart job, restart counter is at 5.
Jan 05 16:06:11 antonio-GC676AA-ABA-m8150n systemd[1]: Stopped Grafana instance.
Jan 05 16:06:11 antonio-GC676AA-ABA-m8150n systemd[1]: grafana-server.service: Start request repeated too quickly.
Jan 05 16:06:11 antonio-GC676AA-ABA-m8150n systemd[1]: grafana-server.service: Failed with result 'exit-code'.
Jan 05 16:06:11 antonio-GC676AA-ABA-m8150n systemd[1]: Failed to start Grafana instance.

thte only way I can get grafana to work in the desktop envionment is if I use and keep this open in the terminal:

$ sudo grafana-server -homepath /usr/share/grafana

Why has this happened and how can I use grafana without have to do this terminal step everytime?

Normally I would issue:

sudo service grafana-server start
or the same but with restart or stop or status at the end depending on what I want to do.

Try that and if it’s failing look at your grafana log file for the reason/s, for me it’s:
/var/log/grafana/grafana.log

1 Like

thanks, I basically solved the problem by not solving the problem.

sudo apt-get purge grafana
sudo apt-get remove grafana
sudo apt-get remove --auto-remove grafana

then I deleted the config folder (contains the config file)

rm -R /etc/grafana/

then I reinstalled grafana

$ sudo apt-get install -y gnupg2 curl
$ curl https://packages.grafana.com/gpg.key | sudo apt-key add -
$ sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
$ sudo apt-get update
$ sudo apt-get -y install grafana
$ sudo systemctl start grafana-server

Now its running as before, with default port 3000 on startup