ibmdb / vscode-extension

vscode extenstion for db2 as db2connect
7 stars 2 forks source link

"Failed to create controller for extension" error on RHEL 8.9 #71

Closed AaronMossIBM closed 7 months ago

AaronMossIBM commented 8 months ago

Type: Bug

  1. Install Db2 Connect plugin on system spec'd below.
  2. Restart VS Code.
  3. See status message about "setting up native modules".
  4. See "Failed to create controller for extension" error.
  5. Nothing in the extension works.

I see from browsing the closed bugs that the native extensions breaking on updates is fairly common on VS Code, but given that this is my first installation and I'm not running an M-series Mac, I don't think the usual fix advice applies.

Extension version: 2.3.1 VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:14:59.643Z) OS version: Linux x64 4.18.0-513.18.1.el8_9.x86_64 Modes:

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 3000)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|1, 1, 1| |Memory (System)|31.09GB (24.18GB free)| |Process Argv|--unity-launch| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|gnome| |XDG_CURRENT_DESKTOP|GNOME| |XDG_SESSION_DESKTOP|gnome| |XDG_SESSION_TYPE|x11|
bimalkjha commented 8 months ago

@AaronMossIBM Please use option 'View ->Command Pallette -> Db2: Rebuild Native Module". It it fails, manually delete the file rebuilt_dont_delete from extension directory, restart the vscode and try using the extension. It will try to rebuild the native module now again. Open "View -> Output" and select Db2Connect under Task. Copy all output and paste here. Thanks.

AaronMossIBM commented 8 months ago

Output from initial run of Db2: Rebuild Native Module:

Intellisense Activated
[01/04/2024 09:11:23] Proceeding to rebuild native modules
[01/04/2024 09:11:23] Cleaning up the current ibm_db
Downloading node ibm_db Driver from https://github.com/ibmdb/node-ibm_db/archive/master.zip ...
[01/04/2024 09:11:23] Proceeding to rebuild native modules
Error: ENOENT: no such file or directory, access '/home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db'
[01/04/2024 09:11:23] No ibm_db found...
Downloading node ibm_db Driver from https://github.com/ibmdb/node-ibm_db/archive/master.zip ...
Downloading and extraction of node ibm_db Driver completed successfully.
Downloading took 3.1 seconds.
Successfully renamed the directory.
platform = linux, arch = x64, node.js version = v18.17.1
Electron Version = 27.3.2
Downloading DB2 ODBC/CLI Driver ...
0.01% | 1378 bytes downloaded out of 25388860 in 0.7 seconds.
10.06% | 2555001 bytes downloaded out of 25388860 in 1 seconds.
20.07% | 5094521 bytes downloaded out of 25388860 in 1.2 seconds.
30.07% | 7634041 bytes downloaded out of 25388860 in 1.4 seconds.
40.01% | 10157177 bytes downloaded out of 25388860 in 1.6 seconds.
50.01% | 12696697 bytes downloaded out of 25388860 in 1.8 seconds.
60.01% | 15236217 bytes downloaded out of 25388860 in 2 seconds.
70.01% | 17775737 bytes downloaded out of 25388860 in 2.2 seconds.
80.02% | 20315257 bytes downloaded out of 25388860 in 2.4 seconds.
90.02% | 22854777 bytes downloaded out of 25388860 in 2.6 seconds.
100.00% | 25388860 bytes downloaded out of 25388860 in 2.8 seconds.
Downloading took 2.8 seconds.
Downloading and extraction of DB2 ODBC CLI Driver completed successfully ...
ODBC Driver path = /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/clidriver
Extraction of build.zip completed successfully... 

Successfully extracted Electron binary.
Error: libdb2.so.1: cannot open shared object file: No such file or directory

I couldn't find a rebuilt_dont_delete file in ~/.vscode/extensions/ibm.db2connect-2.3.1/, but I got the same final error when I restarted VS Code and tried to use the extension.

bimalkjha commented 8 months ago

@AaronMossIBM Thanks for sharing the details. The error Error: libdb2.so.1: cannot open shared object file: No such file or directory seems problematic. We need few more info. From your terminal, run below commands and share complete output:

/home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/clidriver/scripts
source ./setenv.sh
node -v
uname -a
db2level
db2cli validate

If db2level and db2cli commands fail, then share result of below commands:

cd /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/clidriver/lib
ls -l
ldd libdb2.so.1

If db2level works, then close vscode and run below commands:

cd /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db
npm install --vscode
cd /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1
echo "" > rebuilt_dont_delete

Now, open VSCode and test. Thanks.

AaronMossIBM commented 8 months ago

Output from the first batch of commands (I needed to install nodejs, I'm on the standard Linux@IBM RHEL build):

amoss:scripts$ node -v
v10.24.0
amoss:scripts$ uname -a
Linux li-da0dad4c-319d-11b2-a85c-f070f16b9db8.ibm.com 4.18.0-513.18.1.el8_9.x86_64 #1 SMP Thu Feb 1 03:51:05 EST 2024 x86_64 x86_64 x86_64 GNU/Linux
amoss:scripts$ db2level
DB21085I  This instance or install (instance name, where applicable: "*") uses 
"64" bits and DB2 code release "SQL11059" with level identifier "060A010F".
Informational tokens are "DB2 v11.5.9.0", "special_36648", 
"DYN2311160803AMD64_36648", and Fix Pack "0".
Product is installed at 
"/home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/instal
ler/clidriver/scripts/..".

amoss:scripts$ db2cli validate

===============================================================================
Client information for the current copy:
===============================================================================

Client Package Type       : IBM Data Server Driver For ODBC and CLI
Client Version (level/bit): DB2 v11.5.9.0 (special_36648/64-bit)
Client Platform           : Linux/X8664
Install/Instance Path     : /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/clidriver/scripts/..
DB2DSDRIVER_CFG_PATH value: <not-set>
db2dsdriver.cfg Path      : /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/clidriver/scripts/../cfg/db2dsdriver.cfg
DB2CLIINIPATH value       : <not-set>
db2cli.ini Path           : /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/clidriver/scripts/../cfg/db2cli.ini
db2diag.log Path          : /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/clidriver/scripts/../db2dump/db2diag.log

===============================================================================
db2dsdriver.cfg schema validation for the entire file:
===============================================================================

Note: The validation utility could not find the configuration file 
db2dsdriver.cfg. The file is searched at 
"/home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/clidriver/scripts/../cfg/db2dsdriver.cfg".

===============================================================================
The validation is completed.
===============================================================================

Output of the second batch of commands:

amoss:lib$ ls -l
total 41812
drwxr-xr-x. 4 amoss amoss     4096 Nov 16 12:02 icc
lrwxrwxrwx. 1 amoss amoss       19 Apr  1 09:17 libdb2clixml4c.so -> libdb2clixml4c.so.1
-rwxr-xr-x. 1 amoss amoss    41064 Nov 16 11:58 libdb2clixml4c.so.1
lrwxrwxrwx. 1 amoss amoss       11 Apr  1 09:17 libdb2.so -> libdb2.so.1
-rwxr-xr-x. 1 amoss amoss 38506464 Nov 16 11:59 libdb2.so.1
lrwxrwxrwx. 1 amoss amoss       17 Apr  1 09:17 libDB2xml4c.so -> libDB2xml4c.so.58
lrwxrwxrwx. 1 amoss amoss       19 Apr  1 09:17 libDB2xml4c.so.58 -> libDB2xml4c.so.58.0
-rwxr-xr-x. 1 amoss amoss  4259416 Nov 16 11:32 libDB2xml4c.so.58.0
amoss:lib$ ldd libdb2.so.1
    linux-vdso.so.1 (0x00007ffe8ef42000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f4235fa0000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f4235d9c000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4235b7c000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f4235974000)
    libpam.so.0 => /lib64/libpam.so.0 (0x00007f4235764000)
    libxml2.so.2 => /lib64/libxml2.so.2 (0x00007f42353fc000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f4235067000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f4234ce5000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f4234acd000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f4234708000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f42385d6000)
    libaudit.so.1 => /lib64/libaudit.so.1 (0x00007f42344d7000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f42342bf000)
    liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f4234098000)
    libcap-ng.so.0 => /lib64/libcap-ng.so.0 (0x00007f4233e92000)

Output from the third batch of commands:

amoss:ibm_db$ npm install --vscode
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@3. I'll try to do my best with it!

> ibm_db@3.2.4 install /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db
> node installer/driverInstall.js

/home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/node_modules/axios/index.js:1
import axios from './lib/axios.js';
       ^^^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/installer/driverInstall.js:12:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ibm_db@3.2.4 install: `node installer/driverInstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ibm_db@3.2.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/amoss/.npm/_logs/2024-04-01T15_06_56_850Z-debug.log
amoss:ibm_db$ cd ../..
amoss:ibm.db2connect-2.3.1$ echo "" > rebuilt_dont_delete
bimalkjha commented 8 months ago

@AaronMossIBM It seems you are hitting this axios issue: It comes with different version of node.js time to time. First of all, VSCode is using node v18.17.1 and you installed node v10.24.0 which is quite old. So, I would suggest to download https://nodejs.org/dist/v18.17.1/node-v18.17.1-linux-x64.tar.gz and replace your existing nodejs install directory with this one. Then run npm install --vscode which may fix the axios issue. If issue still exists, then run below commands:

cd /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/
npm install axios@0.21
npm install --vscode

Thanks.

bimalkjha commented 8 months ago

@AaronMossIBM Any update about this issue? Thanks.

AaronMossIBM commented 8 months ago

I tried installing a Node 18 version using my system package manager, but was not able to fix the bug. To the best of my understanding of corporate IT security policy, I am not allowed to install software from sources other than approved package-management repositories on my development machine, so am still blocked on this.

bimalkjha commented 8 months ago

@AaronMossIBM If you are able to install Node18, please share complete output of below commands from terminal to understand the problem, like you shared before:

cd /home/amoss/.vscode/extensions/ibm.db2connect-2.3.1/node_modules/ibm_db/
npm install axios@0.21
node -e "var ax = require('axios'); console.log(ax.VERSION);"
node --version
npm install --vscode

Also, let me know which package you are not allowed to install due to corporate IT policy? The Node or VSCode or axios? The ibm_db and axios are dependent package of db2connect extension and it get installed when you install db2connect extension. Do you mean, your corporate policy tells to install a package without installation of its dependency! Thanks.

AaronMossIBM commented 7 months ago

Sorry for the delay, I wasn't able to resolve this issue but I found another tool that worked for my use-case.