I was originally going to suggest that maybe we edit the algorithm here so that it could fallback to one of the directories Tomcat can write to, but I don’t think it’s feasible to do so (none of the directories it can write to are really intended to store long-term application-specific data like we need). The fix proposed here (create a $HOME directory for the Tomcat user and modify the default service configuration to allow Tomcat to write files to it) would resolve the issue.
It turns out there’s an easier way to do steps 5 & 6 in the above:
- Run
sudo systemctl edit tomcat9.service - Set the contents to the below and save the file:
[Service]
ReadWritePaths=/var/lib/openmrs