Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when installing with no internet connection #436

Closed
vincenthodicq opened this issue Jul 31, 2018 · 14 comments
Closed

Problem when installing with no internet connection #436

vincenthodicq opened this issue Jul 31, 2018 · 14 comments

Comments

@vincenthodicq
Copy link

vincenthodicq commented Jul 31, 2018

Hi,

this issue is related to #424 issue that was closed a few weeks back. With advices from @bimalkjha, installation of ibm_db is succesful on a server without internet connection using following commands:
export IBM_DB_INSTALLER_URL=
export IBM_DB_HOME=/opt/clidriver/
npm install --nodedir=/home/myuser/.node-gyp/6.9.5/

No error after npm install commands. But when launching our application, there are some missing files from ibm_db install directory:

[myuser@myserver myapp]$ node app.js
[2018-07-31 14:24:19.328] [WARN] log4js - Ignoring configuration reload parameter for "object" configuration.
/opt/myapp/node_modules/ibm_db/node_modules/bindings/bindings.js:83
        throw e
        ^

Error: libdb2.so.1: cannot open shared object file: No such file or directory
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at bindings (/opt/myapp/node_modules/ibm_db/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/opt/myapp/node_modules/ibm_db/lib/odbc.js:27:31)
    at Module._compile (module.js:570:32)

When installing ibm_db on a server with internet connection, no issue, no missing file.

Thanks in advance for your help.

@bimalkjha
Copy link
Member

@vincenthodicq Seems, few system environment variables not get updated. Do you see file ibm_db/installer/clidriver/lib/lidb2.so.1 after installation? If yes, source ibm_db/installer/setenv.sh and then try. Thanks.

@vincenthodicq
Copy link
Author

In ibm_db/installer folder, there is no clidriver folder.

You find in the screenshot below the content of ibm_db/installer folder
image

@bimalkjha
Copy link
Member

@vincenthodicq Please share the output of echo $IBM_DB_HOME.
If it is not set, then you need to copy clidriver too from other folder. ibm_db do not work without clidriver. Open this link and download the clidriver in a system that has internet access and then move to new folder. For linux, you should download linuxx64_odbc_cli.tag.gz file. After untar, you'll get clidriver folder.
Move clidriver on new system where you need to install ibm_db, set environment variable using export IBM_DB_HOME=<absolute/path/of/clidriver> and then install ibm_db. It should work. Thanks.

@vincenthodicq
Copy link
Author

Hi @bimalkjha ,

sorry for the delay but issue must not be closed. Like your comment saying that some variables were not updated, my problem was fixed by executing source ibm_db/installer/setenv.sh

As said in previous posts, there is no clidriver in ibm_db/installer directory. Only on the path that I manually configured using IBM_DB_HOME.
When sourcing the setenv script, it uses IBM_DB_HOME var to update PATH var and everything is fine. But If i disconnect or server get rebooted (or with a new install of ibm_db), all variables are unset and ibm_db is no longer working with the error detailed in first post.

When doing an online installation, clidriver folder is copied to ibm_db/installer directory; when doing an offline installation with IBM_DB_HOME var, clidriver is not copied, only referenced to the path of IBM_DB_HOME. Why clidriver directory is not copied in ibm_db/installer directory with an offline one? It would have fixed everything.

I know I can set automatically my variables in my linux to be loaded after a reboot or connection. But I still have to source setenv file manually after each install. This must be avoided, module must work after a npm install directly. I must not script some steps to make it work, if there is a future release with rework on installation scripts, my setup would not be working anymore...

@rhtpandeyIN
Copy link
Contributor

Hi @vincenthodicq ,

When doing an online installation, clidriver folder is copied to ibm_db/installer directory; when doing an offline installation with IBM_DB_HOME var, clidriver is not copied, only referenced to the path of IBM_DB_HOME. Why clidriver directory is not copied in ibm_db/installer directory with an offline one? It would have fixed everything.

Well, Let me try to clear the scenario:

  1. While doing online installation - it's working because ibm_db module downloads "clidriver" and sets the IBM_DB_HOME env variable to downloaded "clidriver" directory's path.
  2. You are trying to install ibm_db in such system where there is no internet, and to download "clidriver" you will need internet connection (as it does not comes with the module).
  3. In no internet case, you need to download "clidriver" manually and set the IBM_DB_HOME env variable to pre-downloaded "clidriver" directory path, that's how ibm_db module gets to know that - there is already a "clidriver" stored into the system so no need to download it further at the time of installation.
  4. So, in case if there is no IBM_DB_HOME env variable set in your system (even if clidriver is somewhere in your system), there is no way to recognize if "clidriver" is already stored in your system or not.

I hope this clarifies.
Thanks.

@vincenthodicq
Copy link
Author

Hi Rohit,

thanks for the interest of my problem ;-) My goal is to install ibm_db on an offline server, let's call it DEV.
So I downloaded clidriver from another server and I transferred this clidriver to DEV server. I configured two variables on my DEV server:
export IBM_DB_INSTALLER_URL=
export IBM_DB_HOME=/opt/clidriver/
Installation, with node-gyp header file, is a success on the offline DEV server. IBM_DB_HOME is still set to the path of clidriver.

But when running my application, it is failing as it is looking for clidriver files inside the node_modules/ibm_db/installer directory. If it was using path of IBM_DB_HOME variable (that was correctly set on my server), it would not have failed as this var is pointing to the location of clidriver. This is the problem.

I have to explicitly invoke setenv.sh script located at node_modules/ibm_db/installer to make it work. Whereas, with an online install, no need to do anything after the install.

@rhtpandeyIN
Copy link
Contributor

What platform you are using?

@vincenthodicq
Copy link
Author

Linux RHEL 7.3

@rhtpandeyIN
Copy link
Contributor

rhtpandeyIN commented Oct 8, 2018

And what all environment variables are set in your system related to this module?

Why you are setting IBM_DB_INSTALLER_URL if you are already setting IBM_DB_HOME?

I mean both are for same purpose but works differently (you need to use just one):

  • When you are using any alternate URL (not provided by ibm_db) to download "clidriver" or when you have downloaded the "zip/tar" file of "clidriver" and want to use it without unzipping/untar it then use : IBM_DB_INSTALLER_URL
  • And when you don't want to download it at the installation time and you have already downloaded it from ibm_db hosted URL and stored it in your system (untar/unzipped version), in that case use IBM_DB_HOME env variable.

Check this link for reference: env variables

So, let me get back to the problem. Can you please check if there is any "LD_LIBRARY_PATH" env variable set or not? (- in those cases when you are getting above error. I am sure at the time of online installation ibm_db is setting this variable but not sure about offline installation - you will need to set that manually)

@vincenthodicq
Copy link
Author

I was setting IBM_DB_INSTALLER_URL to void to be sure to use IBM_DB_HOME var.

LD_LIBRARY_PATH is not set after installation of ibm_db. After running setenv.sh script, variable is set.

@rhtpandeyIN
Copy link
Contributor

Yes, so you will need to set LD_LIBRARY_PATH env variable to --> $IBM_DB_HOME/lib

for ex:
export LD_LIBRARY_PATH=$IBM_DB_HOME/lib:$LD_LIBRARY_PATH

I think that should work and you will not get any further error.

@rhtpandeyIN
Copy link
Contributor

Thanks for notifying it, I will update this information (about LD_LIBRARY_PATH) in the README doc.

@vincenthodicq
Copy link
Author

Thanks Rohit,

setting both IBM_DB_HOME & LD_LIBRARY_PATH before offline installation of ibm_db makes it work.

@vincenthodicq
Copy link
Author

vincenthodicq commented Oct 16, 2018

Hi @rhtpandeyIN ,

With your explanations, everything is working perfectly on 1 server: I added IBM_DB_HOME & LD_LIBRARY_PATH as env variables and my app with ibm_db is working nice.

I had to deploy to another environment where I reproduced the same configuration. And this time, even with IBM_DB_HOME & LD_LIBRARY_PATH present as env vars, my app is failing with:

`/opt/myapp/node_modules/bindings/bindings.js:83
throw e
^

Error: libdb2.so.1: cannot open shared object file: No such file or directory
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at bindings (/opt/myapp/node_modules/bindings/bindings.js:76:44)
at Object. (/opt/myapp/node_modules/ibm_db/lib/odbc.js:31:31)
at Module._compile (module.js:570:32)`

I used ldd command to find if all libraries were found for /opt/myapp/node_modules/ibm_db/build/Release/odbc_bindings.node file:

ldd /opt/myapp/node_modules/ibm_db/build/Release/odbc_bindings.node linux-vdso.so.1 => (0x00007ffd7698a000) **libdb2.so.1 => /opt/lib/clidriver/lib/libdb2.so.1 (0x00007fbc70deb000)** libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fbc70ae4000) libm.so.6 => /lib64/libm.so.6 (0x00007fbc707e2000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fbc705cc000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fbc703b0000) libc.so.6 => /lib64/libc.so.6 (0x00007fbc6ffe3000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fbc6fdac000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fbc6fba8000) librt.so.1 => /lib64/librt.so.1 (0x00007fbc6f9a0000) libpam.so.0 => /lib64/libpam.so.0 (0x00007fbc6f791000) libxml2.so.2 => /lib64/libxml2.so.2 (0x00007fbc6f427000) /lib64/ld-linux-x86-64.so.2 (0x00007fbc73204000) libfreebl3.so => /lib64/libfreebl3.so (0x00007fbc6f224000) libaudit.so.1 => /lib64/libaudit.so.1 (0x00007fbc6effc000) libz.so.1 => /lib64/libz.so.1 (0x00007fbc6ede6000) liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fbc6ebc0000) libcap-ng.so.0 => /lib64/libcap-ng.so.0 (0x00007fbc6e9ba000)

libdb2.so.1 is found by the system. But when running node application, it fails. Do you have an idea?

Thanks again for your help

PS: I removed LD_LIBRARY_PATH from my system and re-launch ldd command. It shows:
ldd /opt/myapp/node_modules/ibm_db/build/Release/odbc_bindings.node linux-vdso.so.1 => (0x00007ffd4453b000) **libdb2.so.1 => not found** libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f0e543f4000) libm.so.6 => /lib64/libm.so.6 (0x00007f0e540f2000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f0e53edc000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0e53cc0000) libc.so.6 => /lib64/libc.so.6 (0x00007f0e538f3000) /lib64/ld-linux-x86-64.so.2 (0x00007f0e5491b000)
So LD_LIBRARY_PATH seems to be correctly configured on the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants