Install wizard can't create profile file

Hey team, I continue to learn a ton. I have defined as an exercise getting OpenMRS running on a default Debian instance at GCP, it seems like it might be a useful specific unix config for us (me) to test on prior to release.

Default Debian is 10 (Buster) for which default java is 11, @dkayiwa was cool enough to clue me into:

so I grabbed the .war from the 5/17 build which tomcat loads, but I cannot get past the install wizard trying to create the profile file, I get the message:

**Error!** A runtime properties file is needed for OpenMRS to start up consistently. OpenMRS is unable to create this file : /var/lib/tomcat9/openmrs-standalone-runtime.properties Because of this error : Read-only file system

I found:

https://wiki.openmrs.org/display/docs/Overriding+OpenMRS+Default+Runtime+Properties

which was super helpful.

When I look in catalina.out I see:

[2020-05-19 16:19:04] [info] WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2078) |2020-05-19 16:19:04,803| Unable to find a runtime properties file at /var/lib/tomcat9/openmrs-standalone-runtime.properties [2020-05-19 16:19:04] [info] WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2106) |2020-05-19 16:19:04,803| Unable to find properties file: /var/lib/OpenMRS/openmrs-standalone/openmrs-standalone-runtime.properties

but then I get stuck. I made sure /var/lib/tomcat9/ was owned by ‘tomcat9’ and writable.

I created /var/lib/OpenMRS/openmrs-standalone/ owned by ‘tomcat9’ and writable.

I tried putting profile files in both places, always the same message.

I did not yet mess around with defining env variable {WEBAPP NAME}_RUNTIME_PROPERTIES_FILE because I figured that added even more complexity but I will if it’s helpful.

I get that waking up on a random linux platform, running as different users, and finding a consistent place to write files is tough, I’d like to debug further and update the wiki, any suggestions or help appreciated.

Are you still getting this error? Even after restarting OpenMRS?

Hi Daniel, I bounced tomcat then OpenMRS found the profile file I had placed in

/var/lib/tomcat9/

I renamed the profile file, restarted again, and it looked like OpenMRS could not create the file and the original message returned.

Is it possible to share the full log via pastebin.com? You can start by deleting the existing log to get a new and smaller one.

Thanks Daniel:

https://pastebin.com/T0F0BiV7

you can see tomcat starting and trying to load the profile then me running the install wizard and it tries again.

If I drop a profile file in /var/lib/tomcat9 it still does not pick it up, but when I restart tomcat then it seems to see it because I proceed to get a mysql error which I have not yet set up and catalina.out is clean.

The log you have shared means that it is waiting for you to run the setup wizard.

Hi Daniel,

I believe it looks like the wizard didn’t run because the wizard never completes, there are I think two relevant sections in the log.

I started with a clean log, started up tomcat which loaded openmrs-standalone, starting here:

[2020-05-19 19:43:32] [info] WARN - OpenmrsUtil.getApplicationDataDirectory(1044) |2020-05-19 19:43:32,092| Unable to write to users home dir, fallback to: /var/lib

then there are a bunch of messages about not being able to find the profile file in various locations:

[2020-05-19 19:43:32] [info] WARN - OpenmrsUtil.getRuntimeProperties(2039) |2020-05-19 19:43:32,502| Unable to find a runtime properties file. Initial setup is needed. View the webapp to run the setup wizard.

so yeah no wizard had been run yet, but then at 19:48 I run the wizard from a browser, openmrs-standalone can’t find or create the profile:

In the log:

[2020-05-19 19:48:26] [info] WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2078) |2020-05-19 19:48:26,004| Unable to find a runtime properties file at /var/lib/tomcat9/openmrs-standalone-runtime.properties [2020-05-19 19:48:26] [info] WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2106) |2020-05-19 19:48:26,007| Unable to find properties file: /var/lib/OpenMRS/openmrs-standalone/openmrs-standalone-runtime.properties

In the UI:

Error! A runtime properties file is needed for OpenMRS to start up consistently. OpenMRS is unable to create this file : /var/lib/OpenMRS/openmrs-standalone/openmrs-standalone-runtime.properties Because of this error : Read-only file system

You must correct this before continuing.

even though the dir is (I believe) writable.

Is this of any help? https://ar.al/2019/10/24/fixing-read-only-file-system-errors-after-do-release-upgrade-from-ubuntu-14.04-lts-to-16.04-lts/

I don’t think so Daniel, I can write to the directories fine. It’s not a showstopper for me if I can provide the profile file. We should figure out what’s going on I’ll continue to investigate.

I haven’t watched enough of the process/culture to know if I should file a bug, should I? I am happy to take direction on test cases I can spend some time on this like I said I’m learning a ton.

It seems like from talk and the wiki users have issues with this. I am not surprised you are so good about not restricting the configs we support we encounter tons of platform idiosyncrasies.

I wanna go learn more about testing release and QA before getting all excited about making suggestions but maybe we should try to corral folks to a reasonable number of configs that we then aspire/commit to test, could be nice all around.

this is really kind of exciting, we are close to the Debian/Ubuntu install looking like:

  • spin up an instance (or procure a machine)
  • apt-get java, tomcat, mysql
  • download and load .war

from which one could build and operate a production system

For now, can you use the default war file name as openmrs.war? Then the OpenMRS application data folder would be /var/lib/OpenMRS instead of /var/lib/OpenMRS/openmrs-standalone

Of course it could also be /usr/share/tomcat9/.OpenMRS after this: chown -R tomcat9:tomcat9 /usr/share/tomcat9/.OpenMRS/

Hi Daniel,

  • renamed openmrs-standalone.war openmrs.war
  • unloaded openmrs-standalone, loaded openmrs

tomcat log (https://pastebin.com/AVz5qivq) says on startup it’s looking for:

/var/lib/tomcat9/openmrs-runtime.properties then

"Unable to write to users home dir, fallback to: /var/lib"

then it looks for /var/lib/OpenMRS/openmrs-runtime.properties

OK so no problem because we have not yet run the wizard, I point a browser at /openmrs, wizard runs

**Error!** A runtime properties file is needed for OpenMRS to start up consistently. OpenMRS is unable to create this file : /var/lib/OpenMRS/openmrs-runtime.properties Because of this error : Read-only file system

You must correct this before continuing.

Retry

I bounced tomcat and tried again, no luck, all in all it looks like the same behavior except (as you suggested) the expected profile file name changed to openmrs-runtime.properties

What are the attributes of this folder? /var/lib/OpenMRS?

sudo ls /var/lib/OpenMRS -l

drwxrwxrwx 2 tomcat tomcat 4096 May 19 16:14 openmrs-standalone

I think I created it though when I was testing the original .war, it’s way too open :slight_smile: I don’t know else it got there.

I’d love us to be clever enough to not need to the installer to mess with the file system <- constructive suggestion goes here

Does it make any difference if you delete that folder and let the application create it by itself?

OK I am going to rebuild the instance to make sure I have a default config, it makes me nervous that I don’t remember where/how that OpenMRS folder got created, brb.

OK spanking new Debian 10 system I loaded openmrs.war (17-May) into tomcat

log here https://pastebin.com/AQ7dWyej

On both loading the .war and running the wizard openmrs looks for:

/var/lib/tomcat9/openmrs-runtime.properties

then

/var/lib/OpenMRS/openmrs-runtime.properties

the tomcat directory is in /var/lib:

rwxr-xr-x 5 root root 4096 May 20 18:41 tomcat9

/var/lib/OpenMRS/ does not exist

wizard UI complains it cannot create /var/lib/OpenMRS/openmrs-runtime.properties

What is the exact error message in the browser?

**Error!** A runtime properties file is needed for OpenMRS to start up consistently. OpenMRS is unable to create this file : /var/lib/OpenMRS/openmrs-runtime.properties Because of this error : Read-only file system

You must correct this before continuing.

If I drop a openmrs-properties files into the first dir - /var/lib/tomcat9/ and chown it to tomcat:tomcat, then restart tomcat, openmrs sees it.

And does OpenMRS then start successfully?