-
What Grafana version and what operating system are you using?
Version 8.3.6 (commit: bf8766bbf2, branch: HEAD) -
What are you trying to achieve?
I’m trying to change grafana’s folder. I’m using a raspberry pi and SD card is prone to fail. So I’ve bought a SSD and just want to change the folder. -
How are you trying to achieve it?
I’m using a raspberry pi, which uses a service to monitor grafana
$ cat /usr/lib/systemd/system/grafana-server.service
[Unit]
Description=Grafana instance
Documentation=http://docs.grafana.org
Wants=network-online.target
After=network-online.target
After=postgresql.service mariadb.service mysql.service
[Service]
EnvironmentFile=/etc/default/grafana-server
User=grafana
Group=grafana
Type=simple
Restart=on-failure
WorkingDirectory=/usr/share/grafana
#WorkingDirectory=/home/pi/External/grafana_root/usr/share/grafana
RuntimeDirectory=grafana
RuntimeDirectoryMode=0750
ExecStart=/usr/sbin/grafana-server \
--config=${CONF_FILE} \
--pidfile=${PID_FILE_DIR}/grafana-server.pid \
--packaging=deb \
cfg:default.paths.logs=${LOG_DIR} \
cfg:default.paths.data=${DATA_DIR} \
cfg:default.paths.plugins=${PLUGINS_DIR} \
cfg:default.paths.provisioning=${PROVISIONING_CFG_DIR}
LimitNOFILE=10000
TimeoutStopSec=20
CapabilityBoundingSet=
DeviceAllow=
LockPersonality=true
MemoryDenyWriteExecute=false
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectProc=invisible
ProtectSystem=full
RemoveIPC=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
UMask=0027
[Install]
WantedBy=multi-user.target
Since config files are defined at EnvironmentFile=/etc/default/grafana-server
, I just edit the file.
$ cat /etc/default/grafana-server
GRAFANA_ROOT=/home/pi/External/grafana_root
GRAFANA_USER=grafana
GRAFANA_GROUP=grafana
GRAFANA_HOME=/home/pi/External/grafana_root/usr/share/grafana
LOG_DIR=/var/log/grafana
DATA_DIR=/home/pi/External/grafana_root/var/lib/grafana
MAX_OPEN_FILES=10000
CONF_DIR=/home/pi/External/grafana_root/etc/grafana
CONF_FILE=/home/pi/External/grafana_root/etc/grafana/grafana.ini
RESTART_ON_UPGRADE=true
PLUGINS_DIR=/home/pi/External/grafana_root/var/lib/grafana/plugins
PROVISIONING_CFG_DIR=/home/pi/External/grafana_root/etc/grafana/provisioning
# Only used on systemd systems
PID_FILE_DIR=/run/grafana
After rsync all the files, the system doesn’t start.
- What happened?
$ sudo service grafana-server stop
$ sudo service grafana-server start
$ sudo service grafana-server status
● grafana-server.service - Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-02-15 15:27:33 -03; 4s ago
Docs: http://docs.grafana.org
Process: 26207 ExecStart=/usr/sbin/grafana-server --config=${CONF_FILE} --pidfile=${PID_FILE_DIR}/grafana-server.pid --packaging=deb cfg:default.paths.logs=${LOG_DIR} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.plugins=${PLUGI
Main PID: 26207 (code=exited, status=1/FAILURE)
fev 15 15:27:33 nodered systemd[1]: grafana-server.service: Service RestartSec=100ms expired, scheduling restart.
fev 15 15:27:33 nodered systemd[1]: grafana-server.service: Scheduled restart job, restart counter is at 5.
fev 15 15:27:33 nodered systemd[1]: Stopped Grafana instance.
fev 15 15:27:33 nodered systemd[1]: grafana-server.service: Start request repeated too quickly.
fev 15 15:27:33 nodered systemd[1]: grafana-server.service: Failed with result 'exit-code'.
fev 15 15:27:33 nodered systemd[1]: Failed to start Grafana instance.
When I check the log:
fev 15 15:27:32 nodered systemd[1]: Started Grafana instance.
fev 15 15:27:32 nodered grafana-server[26207]: t=2022-02-15T15:27:32-0300 lvl=eror msg="failed to parse \"/home/pi/External/grafana_root/etc/grafana/grafana.ini\": open /home/pi/External/grafana_root/etc/grafana/grafana.ini: permission d
fev 15 15:27:32 nodered systemd[1]: grafana-server.service: Main process exited, code=exited, status=1/FAILURE
fev 15 15:27:32 nodered systemd[1]: grafana-server.service: Failed with result 'exit-code'.
fev 15 15:27:33 nodered systemd[1]: grafana-server.service: Service RestartSec=100ms expired, scheduling restart.
fev 15 15:27:33 nodered systemd[1]: grafana-server.service: Scheduled restart job, restart counter is at 5.
fev 15 15:27:33 nodered systemd[1]: Stopped Grafana instance.
fev 15 15:27:33 nodered systemd[1]: grafana-server.service: Start request repeated too quickly.
fev 15 15:27:33 nodered systemd[1]: grafana-server.service: Failed with result 'exit-code'.
fev 15 15:27:33 nodered systemd[1]: Failed to start Grafana instance.
It is complaining about grafana.ini permissions.
$ ll -a /etc/grafana/grafana.ini
-rw-r----- 1 root grafana 43490 fev 7 18:03 /etc/grafana/grafana.ini
$ ll -a /home/pi/External/grafana_root/etc/grafana/grafana.ini
-rw-r--r-- 1 root grafana 43490 fev 7 18:03 /home/pi/External/grafana_root/etc/grafana/grafana.ini
-
What did you expect to happen?
No permission error. -
Can you copy/paste the configuration(s) that you are having problems with?
Filled above. -
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
Grafana doesn’t start. -
Did you follow any online instructions? If so, what is the URL?
I read the Grafana doc.rsync -a
all the folders and changed the permissions.
Not sure what is going on.