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: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

– 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: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

– 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)