Bahmni 0.92 Install on CentOS 7.6 Minimal Fails

Hi, New user here.

I wanted to test Bahmni 0.92 on a CentOS 7.6 minimal, however I keep running into the same issue while following the guide. The only change I made is disabling selinux.

https://pastebin.com/LizTAiej

Seems to be issues with PID files too, as I’m not a linux user I am unsure how to fix this, I have created the files but still failing. Hopefully someone can advise on this :slight_smile:

The workaround for this issue was to downgrade from Systemd to old sysvinits. The dirty workaround that I use (since I like to keep systemd arround), was edit the inits script to remove the line that cause errors in /etc/init.d directory. There’s at least 3 files that need to edit: openmrs, bahmni-erp-connect, and bahmni-reports.

Can u please explain the edited inits scripts line in openmrs, bahmni-erp-connect and bahmni-reports. Thank You…

@eddyprasetyo I’d like to know the edits too please :slight_smile:

Hello, I am having the exact same issue as reported by @mstreeton, i.e., CentOS 7.6 1810 build minimal. I have tried with CentOS 7.6 1810 build DVD and the same issue arises.

I tried to fire the installation modifying the local inventory without the ERP as in here https://pastebin.com/SLTcb6MS . In this case everything run without any problems. @mstreeton it would be interesting if you could try and see if you get the same result as me when installing without the ERP.

  1. Downgrade systemd to sysvinits seems not to be a good approach in my opinion. Is there any other version of CentOS you could recommend in order to surpass this and in case this is caused by that?

  2. As this happens only when installing ERP (Odoo in this case), could it be caused by it?

I would love to explore Bahmni and I hope someone can help on this.

1 Like

Just to confirm the install inventory you used does work, obviously without Odoo. I still cannot locate the lines to remove that @eddyprasetyo mentioned, will have to wait until someone comes up with a proper solution for this.

@mddubey @bhiravabhatla I see you are involved in some development on this board, is this issue above known about/raised and is someone actually looking into it? As right now clean installs using CentOS 7.6 minimal are not working for those of us wanting to try this.

1 Like

Hello Everyone.

Actually there’s someone who created patch for this. I’ll point out later.

Basically when you run the inventory, and it’s stop at task starting the service (openmrs, bahmni-erp-connect, bahmni-reports, I don’t include elis and dcm4chee so I don’t know if it face the same problems). Open the files in init.d directory, and search for line that contain "su " That’s was the one that create the problems. SysvInit run as root user, and use “su” command to switch user and run the services. This will fail when it’s already run as the designed user, and that was Sysmted does to the service that imported from sysvinit.

The “su” command exist in if-fi conditional block in the script. As far as I know there’s two of them in those 3 init script. This is the first :

You can either remove just the “su” part, or you can modify the conditional block to just run the “else” part. This means to remove the line start with if, then, su, else, fi in those block, and leave the line “sh $OPENMRS_SERVER_RUN” line.

This is the 2nd.

The same goes to the 2nd part, and for other two services (bahmni-erp-connect and bahmni-reports).

For odoo start service error, it’s different problem. As far as I know, for fresh centos 7.6 installing bahmni 0.92, its the problems with python binnary that connect with postgres. This will solve with installing “psycopg2-binary” package through pip install

sudo pip install psycopg2-binary

Hope this will help.

Best regards,

Eddy

As I mentioned earlier, theres someone who made a patch about this problem, on this tread post number 3.

Credit goes to original poster @yeowsen

It’s look like openelis service have the same problems.

Hi Mark,

There would be an official patch out for this from product soon. But until then - we have two work arounds.

a) Downgrade systemd and use yum version lock to freeze the version. [ Temporary work around ]
b) Change su -s /bin/bash to runuser -u . [ Patch version would have this as a fix]

Details below :

a) Downgrade systemd

Below steps are tested on Centos Version - CentOS Linux release 7.7.1908 (Core)

Systemd on Centos 7.6/7 has version of 219-67.el7_7.2 or 219-67.el7_7.1. Downgrade it to 219-67.el7. You might have to run dowgrade twice to get to the version 219-67.el7

yum downgrade systemd.x86_64 systemd-libs.x86_64 systemd-sysv.x86_64

Install yum version lock plugin

yum install yum-plugin-versionlock

Lock systemd and libgudev1 [ needed for odoo deployment]

yum versionlock systemd*
yum versionlock libgudev1-219-67.el7

yum versionlock list should show below output:

0:systemd-sysv-219-67.el7.*
0:systemd-219-67.el7.*
0:systemd-libs-219-67.el7.*
0:libgudev1-219-67.el7.*

Then run the installer - Everything should run properly.

b) Change su -s /bin/bash to runuser -u

The root cause of this issue lies around how we start the bahmni services or how we create pid files for the bahmni services.

In the LSB script files of respective services ( ex- /etc/init.d/openmrs) - We would need to replace su -s /bin/bash with runsuser -u in the start() and debug() methods.

Shortcut to do that in all the service configuration files is as belows:

sed -i 's:su -s /bin/bash:runuser -u:g' /etc/init.d/*
systemctl daemon-reload

Note - This has to be done during the installation whenever the installation fails after a service is installed and fails to start/stop. Rerun the installation after changing init script. The service configs come as part of respective rpms - so we cant alter them before running the installer.

1 Like

Hi Santosh,

Thanks for the reply. I just tried option a and that failed on a 7.7 install. Here is the error I got: https://pastebin.com/gXAPuKMk

Hi @bhiravabhatla , thanks for the detailed reply. I tried workaround a) in centOS 7.6 with defaults and I get the same error as described by @mstreeton above. Furthermore, I tried to stop and start the services using bahmni command line, and I get the following error:

TASK [bahmni-odoo : Start Odoo and enable at boot] ***************************** task path: /opt/bahmni-installer/bahmni-playbooks/roles/bahmni-odoo/tasks/main.y ml:112 fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Could not find the req uested service odoo: host”} to retry, use: --limit @/opt/bahmni-installer/bahmni-playbooks/all.retry

Although all bahmni services (openmrs, open-elis, mysql, postgres, httpd) are running, the page of bahmni, openmrs and openelis do not open in the browser after we stop and start service using bahmni command line. Tried to reboot and I had the same problem, i.e. those services are running but I cannot open the pages in the browser.

Regarding the services of odoo , bahmni-erp-connect and atomfeed-console, they are not found since installation:

[root@localhost ~]# service odoo status Redirecting to /bin/systemctl status odoo.service Unit odoo.service could not be found.

Hi,

My bad, Yum versionlock would not take multiple arguments. We would have to run the command twice to lock the versions of systemd and libgudev1 to respective versions.

I have corrected my response.

Lock systemd and libgudev1 [ needed for odoo deployment]

yum versionlock systemd*
yum versionlock libgudev1-219-67.el7

yum versionlock list should show below output:

0:systemd-sysv-219-67.el7.*
0:systemd-219-67.el7.*
0:systemd-libs-219-67.el7.*
0:libgudev1-219-67.el7.*

1 Like

Can we add ansible task to patch inits files before starting the services?

I was successfully able to use option a after the changes you provided :slight_smile:

1 Like

I guess we could. Just before each service is started. It would require changes in tasks for all the services.

I think we would receive a patch from product by doing exactly that or changing it in the rpms soon enough.

I got the error on downgrade of systemd on Centos 7.6 yum downgrade systemd.x86_64 systemd-libs.x86_64 systemd-sysv.x86_64 --skip-broken Skip-broken could not solve problems Error: Package: libgudev1-219-67.el7_7.2.x86_64 (@updates) Requires: systemd-libs = 219-67.el7_7.2 Removing: systemd-libs-219-67.el7_7.2.x86_64 (@updates) systemd-libs = 219-67.el7_7.2 Downgraded By: systemd-libs-219-67.el7_7.1.x86_64 (updates) systemd-libs = 219-67.el7_7.1 Available: systemd-libs-219-67.el7.i686 (base) systemd-libs = 219-67.el7 You could try running: rpm -Va --nofiles --nodigest

Use centOS version 7.7 build 1908 instead and follow instructions described by @bhiravabhatla post above. I used option a) Downgrade systemd and it worked fine.

Blockquote @bhiravabhatla @angshuonline I install successfully the bahmni 92 on both Centos 7.6 and 7.7. But while I try to run to bahmni -i local start I got the error on services start.The log shown on journalctl -xe…

Nov 12 13:17:25 localhost.localdomain su[2783]: (to bahmni) root on none Nov 12 13:17:25 localhost.localdomain systemd[1]: Started Session c16 of user bahmni. – Subject: Unit session-c16.scope has finished start-up – Defined-By: systemd – Support: systemd-devel Info Page

– Unit session-c16.scope has finished starting up.

– The start-up result is done. Nov 12 13:17:25 localhost.localdomain su[2783]: pam_unix(su:session): session opened for user bahmni by (uid=0) Nov 12 13:17:25 localhost.localdomain su[2783]: pam_unix(su:session): session closed for user bahmni Nov 12 13:17:25 localhost.localdomain systemd[1]: New main PID 2785 does not belong to service, and PID file is not owned by Nov 12 13:17:25 localhost.localdomain systemd[1]: New main PID 2785 does not belong to service, and PID file is not owned by Nov 12 13:17:25 localhost.localdomain systemd[1]: Failed to start LSB: start and stop openmrs system,. – Subject: Unit openmrs.service has failed – Defined-By: systemd – Support: systemd-devel Info Page

– Unit openmrs.service has failed.

– The result is failed. Nov 12 13:17:25 localhost.localdomain systemd[1]: Unit openmrs.service entered failed state. Nov 12 13:17:25 localhost.localdomain systemd[1]: openmrs.service failed. Nov 12 13:18:49 localhost.localdomain su[2937]: (to bahmni) root on pts/0 Nov 12 13:18:49 localhost.localdomain su[2937]: pam_unix(su:session): session opened for user bahmni by root(uid=0) Nov 12 13:18:49 localhost.localdomain su[2937]: pam_unix(su:session): session closed for user bahmni Nov 12 13:18:52 localhost.localdomain su[2980]: (to bahmni) root on pts/0 Nov 12 13:18:52 localhost.localdomain su[2980]: pam_unix(su:session): session opened for user bahmni by root(uid=0) Nov 12 13:18:52 localhost.localdomain su[2980]: pam_unix(su:session): session closed for user bahmni lines 1510-1538/1538 (END)

Greetings,

Here is the result of installing today on a digitalocean Image. This was without making the adjustments that I hadn’t yet read about to Downgrade systemd.

Centos 7.6 x64   
4 vCPUs
8GB / 160GB Disk 

Working

  • https:///:8069
  • https:///bahmni

404

  • https:///dcm4chee-web3
  • https:///event-log-service
  • https:///openelis

Please advise next steps I should take.

Thank you

Jahtoe

TASK [bahmni-erp-connect : Start bahmni-openerp-connect and enable at boot] ******************************************************************
task path: /opt/bahmni-installer/bahmni-playbooks/roles/bahmni-erp-connect/tasks/main.yml:55
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to start service bahmni-erp-connect: Job for bahmni-erp-connect.service failed because a configured resource limit was exceeded. See \"systemctl status bahmni-erp-connect.service\" and \"journalctl -xe\" for details.\n"}
    to retry, use: --limit @/opt/bahmni-installer/bahmni-playbooks/all.retry

PLAY RECAP ***********************************************************************************************************************************
localhost                  : ok=257  changed=168  unreachable=0    failed=1   

Traceback (most recent call last):
  File "/usr/bin/bahmni", line 9, in <module>
    load_entry_point('bahmni==0.1', 'console_scripts', 'bahmni')()
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "build/bdist.linux-x86_64/egg/bahmni.py", line 79, in install
  File "/usr/lib64/python2.7/subprocess.py", line 542, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'ansible-playbook -i /etc/bahmni-installer/local all.yml -vv  --extra-vars '@/etc/bahmni-installer/rpm_versions.yml' --extra-vars '@/etc/bahmni-installer/setup.yml'' returned non-zero exit status 2
bahmni-emr.noarch                      0.92-183                      @bahmni    
bahmni-erp.noarch                      0.92-133                      @bahmni    
bahmni-erp-connect.noarch              0.92-133                      @bahmni    
bahmni-implementer-interface.noarch    0.92-30                       @bahmni    
bahmni-installer.noarch                0.92-142                      installed  
bahmni-lab.noarch                      0.92-54                       @bahmni    
bahmni-lab-connect.noarch              0.92-183                      @bahmni    
bahmni-reports.noarch                  0.92-25                       @bahmni    
bahmni-web.noarch                      0.92-183                      @bahmni    


[root@GHOMM ~]# systemctl status bahmni-erp-connect.service
â—Ź bahmni-erp-connect.service - (null)
   Loaded: loaded (/etc/rc.d/init.d/bahmni-erp-connect; bad; vendor preset: disabled)
   Active: failed (Result: resources) since Mon 2019-12-02 15:02:15 IST; 3min 9s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3487 ExecStart=/etc/rc.d/init.d/bahmni-erp-connect start (code=exited, status=0/SUCCESS)

Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:20 PM org.apache.catalina.core.ApplicationContext log
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: INFO: No Spring WebApplicationInitializer types detected on classpath
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:20 PM org.apache.catalina.core.ApplicationContext log
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: INFO: Initializing log4j from [/opt/bahmni-erp-connect/bahmni-erp-connect/WEB-INF/cl...4j.xml]
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:20 PM org.apache.catalina.core.ApplicationContext log
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: INFO: Initializing Spring root WebApplicationContext
Dec 02 15:02:23 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:23 PM org.apache.catalina.core.ApplicationContext log
Dec 02 15:02:23 GHOMM bahmni-erp-connect[3487]: INFO: Initializing Spring FrameworkServlet 'openerp-feed-service'
Dec 02 15:02:23 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:23 PM org.apache.coyote.AbstractProtocol start
Dec 02 15:02:23 GHOMM bahmni-erp-connect[3487]: INFO: Starting ProtocolHandler ["http-nio-8053"]
Hint: Some lines were ellipsized, use -l to show in full.


[root@GHOMM ~]# journalctl -xe
Dec 02 15:02:15 GHOMM systemd[1]: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain: /var/run/bah
Dec 02 15:02:15 GHOMM systemd[1]: Failed to start (null).
-- Subject: Unit bahmni-erp-connect.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit bahmni-erp-connect.service has failed.
--
-- The result is failed.
Dec 02 15:02:15 GHOMM systemd[1]: Unit bahmni-erp-connect.service entered failed state.
Dec 02 15:02:15 GHOMM systemd[1]: bahmni-erp-connect.service failed.
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:16 PM org.apache.coyote.AbstractProtocol init
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: INFO: Initializing ProtocolHandler ["http-nio-8053"]
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:16 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: INFO: Using a shared selector for servlet write/read
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:16 PM org.apache.catalina.core.StandardService startInternal
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: INFO: Starting service Tomcat
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:16 PM org.apache.catalina.core.StandardEngine startInternal
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: INFO: Starting Servlet Engine: Apache Tomcat/8.0.12
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:16 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
Dec 02 15:02:16 GHOMM bahmni-erp-connect[3487]: INFO: No global web.xml found
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:20 PM org.apache.catalina.core.ApplicationContext log
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: INFO: No Spring WebApplicationInitializer types detected on classpath
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:20 PM org.apache.catalina.core.ApplicationContext log
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: INFO: Initializing log4j from [/opt/bahmni-erp-connect/bahmni-erp-connect/WEB-INF/classes/log4
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:20 PM org.apache.catalina.core.ApplicationContext log
Dec 02 15:02:20 GHOMM bahmni-erp-connect[3487]: INFO: Initializing Spring root WebApplicationContext
Dec 02 15:02:23 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:23 PM org.apache.catalina.core.ApplicationContext log
Dec 02 15:02:23 GHOMM bahmni-erp-connect[3487]: INFO: Initializing Spring FrameworkServlet 'openerp-feed-service'
Dec 02 15:02:23 GHOMM bahmni-erp-connect[3487]: Dec 02, 2019 3:02:23 PM org.apache.coyote.AbstractProtocol start
Dec 02 15:02:23 GHOMM bahmni-erp-connect[3487]: INFO: Starting ProtocolHandler ["http-nio-8053"]
Dec 02 15:02:29 GHOMM odoo[2917]: Warn: Can't find .pfb for face 'Times-Roman'
Dec 02 15:02:47 GHOMM sshd[3584]: Did not receive identification string from 45.119.212.105 port 59732
Dec 02 15:05:43 GHOMM sshd[4859]: Received disconnect from 45.119.212.105 port 51000:11: Normal Shutdown, Thank you for playing [preauth]
Dec 02 15:05:43 GHOMM sshd[4859]: Disconnected from 45.119.212.105 port 51000 [preauth]
1 Like