Problem when installing grafana: chown: cannot access '/etc/grafana/*': No such file or directory

When I install grafana on Ubuntu 18.04.3 I encountered this issue.
I installed it to use for Zabbix.

(Reading database ... 168760 files and directories currently installed.)
Preparing to unpack grafana_6.4.0_amd64.deb ...
Unpacking grafana (6.4.0) over (6.4.4) ...
Setting up grafana (6.4.0) ...
chown: cannot access '/etc/grafana/*': No such file or directory
dpkg: error processing package grafana (--install):
installed grafana package post-installation script subprocess returned error exit status 1
Processing triggers for systemd (237-3ubuntu10.31) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
  grafana

These directories are created:
/etc/grafana
/var/log/grafana
/var/lib/grafana
/usr/share/grafana (only directory with contents)

These are not created:
/usr/sbin/grafana-server
/etc/init.d/grafana-server
/etc/default/grafana-server

Any idea what is happening here? Or where this error comes from?
I tried to manually add permissions to the /etc/grafana directory but it didn’t work.

What can I do to solve these issue?

I use grafana version 6.4.0 and Ubuntu 18.04.3.

I have found a solution. The problem was that my VM didn’t had the permissions to create the missing configuration files.

I have solved it with the --force flag of dpkg. My command was:

dpkg --force-all -i grafana_6.0.0_amd64.deb

1 Like