Hi,
I was also facing a similar error on Ubuntu.
With online help, I could figure out that the new cache folder created does not grant access permission to moodle. Setting the ownership and access permissions of your data directory again will resolve the issue.
In my case, the following commands worked (ubuntu):
$ sudo chown -R www-data:www-data /path/to/moodle
$ sudo chown -R www-data:www-data /path/to/moodledata
$ sudo chmod -R 755 /path/to/moodle
$ sudo chmod -R 755 /path/to/moodledata