ot-node icon indicating copy to clipboard operation
ot-node copied to clipboard

ERROR: Module initialization failed. Error message: Module is required but got error during initialization

Open Valcyclovir opened this issue 3 years ago • 6 comments

Issue description

Module initialization fails and node doesn't start when a sql repository password is not used during installation.

Expected behavior

Node starts after installation completes.

Actual behavior

Node does not start and remains in a reboot loop.

Steps to reproduce the problem

  1. Run the installer.sh on a fresh server
  2. Press Enter (no password) when prompted for sql repository password
  3. Node does not start and remains in a reboot loop

Specifications

  • Node version: OriginTrail Node v6.0.0-beta.2.0
  • Platform: Ubuntu 20.04
  • Node wallet: 0x1ec3b45A5f744C338a8501c4C477b71594BF8e34
  • Node libp2p identity: QmVQKLHVTwwrHXkkY7YykrZMoJSQT3Fn8X7betQu7VfrDr

Contact details

Error logs

ERROR: Module initialization failed. Error message: Module is required but got error during initialization - Access denied for user 'root'@'localhost' (using password: YES)

Screenshot_20220823_110407

Disclaimer

Please be aware that the issue reported on a public repository allows everyone to see your node logs, node details, and contact details. If you have any sensitive information, feel free to share it by sending an email to [email protected].

Valcyclovir avatar Aug 23 '22 15:08 Valcyclovir

Hey @Valcyclovir, what is the content of /root/current/.env ?

zeroxbt avatar Aug 23 '22 17:08 zeroxbt

/root/current/.env contains this:

REPOSITORY_PASSWORD= NODE_ENV=testnet

Valcyclovir avatar Aug 23 '22 17:08 Valcyclovir

Both completely removing

REPOSITORY_PASSWORD=

or adding ""

REPOSITORY_PASSWORD=""

Would generate the same error

Valcyclovir avatar Aug 23 '22 17:08 Valcyclovir

@djordjekovac I think this is the issue. If password is empty in .env file, node will get default password from config, which is set to "password"

zeroxbt avatar Aug 23 '22 17:08 zeroxbt

I confirm that removing "password" from ot-node/current/config/config.json "testnet" object allows the node to start.

Valcyclovir avatar Aug 23 '22 18:08 Valcyclovir

Now that mainnet is launched, I suggest finding a better way to secure our assets by assigning a configuration file with the MySQL password, rather than using .env file, which is deemed as extremely unsafe.

We can create a file ~/ot-node/current/.mysql.cnf

with the following:

[client] password=<mysql_password_here>

apply permissions chmod 600 ~/ot-node/current/.mysql.cnf

then every time we need to interact with mysql, we use the option --defaults-file=~/ot-node/current/.mysql.cnf

Thoughts ?

As for the empty sql password problem, for security reasons, perhaps it is not safe to leave the option to not have a sql password on the installer. I could "force" the node runner to apply a sql password.

Valcyclovir avatar Dec 16 '22 17:12 Valcyclovir