Installing OpenMRS on Arch Linux

I had some trouble installing OpenMRS platform 2.8 on Arch Linux.

I tried the Standalone, didn’t work, gave up on it.

My problem came after deploying the .war. OpenMRS wouldn’t start. The logs say:

org.openmrs.api.APIException: '{0}' should be a directory but it is not
org.openmrs.util.OpenmrsUtil.getDirectoryInApplicationDataDirectory(OpenmrsUtil.java:1111)

I tried everything I could find all over the internet, including what I found at deployment issue - #16 by ibacher . In the end, I decided to try making up a /home/tomcat9 directory and assign it to the user, and it magically worked.

I think it would make more sense to allow /var/lib/openmrs to be the application data directory. I wanted to file a bug report, but after creating a user I would get a blank page at https:// home.attlasian .com/projects/ all I get is a blank page.

So this is the bug report.

Edit: for clarity.

The error from OpenmrsUtil.getDirectoryInApplicationDataDirectory() is the same root cause as the Ubuntu thread, but Arch configures Tomcat differently so that fix doesn’t translate directly.

Your /home/tomcat9 workaround makes sense when you look at the actual fallback logic in OpenmrsUtil on Unix systems, OpenMRS first tries user.home/.OpenMRS, and if that’s not writable, falls back to APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX. On Arch, the Tomcat user’s home directory exists in /etc/passwd but is never actually created on disk, so both paths fail and OpenMRS crashes. You can confirm this mismatch with

# Check system home
getent passwd tomcat

# Check if it actually exists (it likely won't)
ls -d $(getent passwd tomcat | cut -d: -f6)

The cleaner fix is to explicitly set the application data directory so OpenMRS never has to guess. Use a systemd override since it survives package updates:

sudo systemctl edit tomcat9

In the editor, add

[Service]
Environment="CATALINA_OPTS=-DOPENMRS_APPLICATION_DATA_DIRECTORY=/var/lib/openmrs"
ReadWritePaths=/var/lib/openmrs

Then initialize the directory and ensure Tomcat can write there

sudo mkdir -p /var/lib/openmrs
sudo chown tomcat:tomcat /var/lib/openmrs
sudo chmod 755 /var/lib/openmrs

Finally reload and restart:

sudo systemctl daemon-reload
sudo systemctl restart tomcat9