EOS Nodeos & Cleos Setup

OK, I installed again the Debian Package on Ubuntu 18.04 with v2.0.5 (as v1.8.1 is not available anymore) from the link you provided me with:
wget https://github.com/EOSIO/eos/releases/download/v2.0.5/eosio_2.0.5-1-ubuntu-18.04_amd64.deb
and followed other instructions: Setup Directory, Get Absolute Path and Install CDT (v1.6.1).

It worked, I could install them.

Then, in the Start Nodeos lesson, I wanted to execute the Nodeos Start Command:

nodeos -e -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_plugin --plugin eosio::history_api_plugin --access-control-allow-origin='*' --contracts-console --http-validate-host=false >> nodeos.log 2>&1 &

I also tried with --plugin eosio::state_history_plugin instead of --plugin eosio::history_plugin which is deprecated (https://developers.eos.io/manuals/eos/latest/nodeos/plugins/history_plugin/index).

But when I try to execute it, the terminal is returning something weird:

[1] 9473

I guess it is some place in the code where the process is terminated?

So it is not properly installed, because if I type then tail -f nodeos log, I am getting a bunch of lines and then the process ends:

$ tail -f nodeos.log
info 2020-05-14T15:54:33.793 nodeos chain_plugin.cpp:412 operator() ] Support for builtin protocol feature ‘ONLY_BILL_FIRST_AUTHORIZER’ (with digest of ‘8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405’) is enabled with preactivation required
info 2020-05-14T15:54:33.793 nodeos chain_plugin.cpp:412 operator() ] Support for builtin protocol feature ‘RESTRICT_ACTION_TO_SELF’ (with digest of ‘ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43’) is enabled with preactivation required
info 2020-05-14T15:54:33.793 nodeos chain_plugin.cpp:412 operator() ] Support for builtin protocol feature ‘FIX_LINKAUTH_RESTRICTION’ (with digest of ‘e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526’) is enabled with preactivation required
info 2020-05-14T15:54:33.793 nodeos chain_plugin.cpp:412 operator() ] Support for builtin protocol feature ‘GET_SENDER’ (with digest of ‘f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d’) is enabled with preactivation required
info 2020-05-14T15:54:33.793 nodeos chain_plugin.cpp:908 plugin_initialize ] Starting fresh blockchain state using genesis state extracted from blocks.log.
warn 2020-05-14T15:54:33.793 nodeos chain_plugin.cpp:1093 plugin_initialize ] 13 St13runtime_error: “state” database dirty flag set
rethrow “state” database dirty flag set:
{“what”:"“state” database dirty flag set"}
nodeos chain_plugin.cpp:1093 plugin_initialize
error 2020-05-14T15:54:33.794 nodeos main.cpp:121 main ] database dirty flag set (likely due to unclean shutdown): replay required
^C
[2]+ Termine 2 nodeos -e -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::state_history_plugin --plugin eosio::history_api_plugin --access-control-allow-origin=’*’ --contracts-console --http-validate-host=false >> nodeos.log 2>&1

(“Termine” means “ends the process” in French, I need to switch my terminal into English…)

Your help would be appreciated! @thecil @filip

Thanks!

well thats weird, i install the same version that i advice you and it’s running good for me, please try to do this little tweak for the nodeos command and let me know.

Tweak for NODEOS

after creating that little script, you can use the “tail -f nodeos.log” and you should see something like this over and over (it means thats blocks are being produce).

#490 @ 2020-05-14T20:06:00.500 signed by eosio [trxs: 0, lib: 489, confirmed: 0]
info  2020-05-14T20:06:00.900 nodeos    producer_plugin.cpp:2093      produce_block        ] Produced block 6aae739ed2dfe1c2... #491 @ 2020-05-14T20:06:01.000 signed by eosio [trxs: 0, lib: 490, confirmed: 0]
info  2020-05-14T20:06:01.400 nodeos    producer_plugin.cpp:2093      produce_block        ] Produced block 961ec63c9dc01054... #492 @ 2020-05-14T20:06:01.500 signed by eosio [trxs: 0, lib: 491, confirmed: 0]
info  2020-05-14T20:06:01.900 nodeos    producer_plugin.cpp:2093      produce_block        ] Produced block 093d77a86344ec2b... #493 @ 2020-05-14T20:06:02.000 signed by eosio [trxs: 0, lib: 492, confirmed: 0]
info  2020-05-14T20:06:02.400 nodeos    producer_plugin.cpp:2093      produce_block        ] Produced block b366033a95cdd9e2... #494 @ 2020-05-14T20:06:02.500 signed by eosio [trxs: 0, lib: 493, confirmed: 0]

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

thanks a lot.
I had so many issues with nodeos in my VM crashing unexpectedly and bieng unable to restart it properly.

JJ.

1 Like

I ran your script on my VM Lubuntu 18.04 ( with EOSIO 2.0.0.1 ) and I have no issue .

[1] 9473
[1] is job iD because of '&'at the end of the command line.
9473 probably the process of nodeos ( ps aux | grep nodeos ).

I will try later on with eosio 2.0.0.5 and let you know.

2 Likes

Thanks for the tweak.

I followed your instructions. The terminal says Nodeos started, but when I check status on tail -f nodeos.log, I get the following:

info  2020-05-15T09:16:38.431 nodeos    chain_plugin.cpp:412          operator()           ] Support for builtin protocol feature 'ONLY_BILL_FIRST_AUTHORIZER' (with digest of '8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405') is enabled with preactivation required
info  2020-05-15T09:16:38.431 nodeos    chain_plugin.cpp:412          operator()           ] Support for builtin protocol feature 'RESTRICT_ACTION_TO_SELF' (with digest of 'ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43') is enabled with preactivation required
info  2020-05-15T09:16:38.431 nodeos    chain_plugin.cpp:412          operator()           ] Support for builtin protocol feature 'FIX_LINKAUTH_RESTRICTION' (with digest of 'e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526') is enabled with preactivation required
info  2020-05-15T09:16:38.431 nodeos    chain_plugin.cpp:412          operator()           ] Support for builtin protocol feature 'GET_SENDER' (with digest of 'f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d') is enabled with preactivation required
info  2020-05-15T09:16:38.445 nodeos    chain_plugin.cpp:908          plugin_initialize    ] Starting fresh blockchain state using genesis state extracted from blocks.log.
warn  2020-05-15T09:16:38.449 nodeos    chain_plugin.cpp:1093         plugin_initialize    ] 13 St13runtime_error: "state" database dirty flag set
rethrow "state" database dirty flag set: 
    {"what":"\"state\" database dirty flag set"}
    nodeos  chain_plugin.cpp:1093 plugin_initialize
error 2020-05-15T09:16:38.450 nodeos    main.cpp:121                  main                 ] database dirty flag set (likely due to unclean shutdown): replay required

Any thought?

I found this on Nodeos Troubleshooting:

“Database dirty flag set (likely due to unclean shutdown): replay required”

nodeos needs to be shut down cleanly. To ensure this is done, send a SIGTERM , SIGQUIT or SIGINT and wait for the process to shutdown. Failing to do this will result in this error. If you get this error, your only recourse is to replay by starting nodeos with --replay-blockchain

Is it what I need to do?

Ok, lets create another tweak for that issue. :grin:

There are 2 ways that we can use in order to restar our blockchain to get rid of that issue.

1. Create another script to use it when we have a corrupted blockchain:

in ubuntu terminal , after properly apt-get update and upgrade.

Install nano if dont have it.

sudo apt-get install nano

Navigate to your contract folder.
Run command:

sudo nano nodeos_replay

inside black interface of nano, copy/paste this:

nodeos --replay-blockchain -e -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_plugin --plugin eosio::history_api_plugin --access-control-allow-origin='*' --contracts-console --http-validate-host=false >> nodeos.log 2>&1 &
echo "Nodeos REPLAY BLOCKCHAIN started, check status on 'tail -f nodeos.log'"
echo " "
echo "IMPORTANT: Remember to close proprely with command 'pkill nodeos'"

Ctrl+S to save on nano.
Ctrl+X to leave nano editor.

Run Command to make nodeos_start file executable:

sudo chmod +x nodeos_replay

Start command by:

./nodeos_replay

This will rebuild all the blockchain from scratch, so if you have some accounts or tokens created, you probably are going to lose them, so be sure to always use the “pkill nodeos” command in order to properly close the nodeos process to avoid a corrupted blockchain issue.

2. Manually deleting the eosio blockchain data folder.

Open a Terminal window, we have to navigate to the “.local” folder

cd ~/.local/share/eosio/nodeos/

Manually delete the “data” folder

sudo rm -vrf data

rm is the command to delete any file/folder on linux, -vrf means [v = verbose to explain what is being done, r= remove directory and content recursively, f= force to ignore nonexistent files and arguments]

You will be promted with somethin like this thanks to the verbose option:

removed 'data/somethingFile'
removed 'data/otherFile'
removed directory 'data'

Now you can close this terminal window and start again the blockchain with the script “nodeos_start” that you have created before.

Be aware that both methods will probably make you loose any account or token that you have created in the past, so have to restart all the accounts and smart contracts deployment from scratch. In both cases, to avoid this issue, you have to be sure to use the “pkill nodeos” command in order to properly close the nodeos process to avoid a corrupted blockchain issue.

Remember you can check here my personal (now public) library that i have to do to save me some time to learn and run a lot of commands.

  1. EOS Coding: this is a list of tutorials i made for myself to save a lot of time on the way.
  2. EOS Dog Contract Improvements: you can find here my own improvements on the Dog Contract has an example for the Academy.
  3. Issues & Fixes i found in the path.
  4. Linux tweaks for nodeos.
  5. EOS Developers portal.
  6. EOS functions index.

Hope you find this useful! :slight_smile:

If you have any doubt, please let us know so we can help you!

Carlos Z.

3 Likes

I was not allowed to do that:

ok this is easy, “permission denied” means that you have to run the command has a root user. Because the user that you are using at the moment it is not allow to start process or files.
Each time you get that message, just use the root user to start it

sudo ./nodeos_replay

You could try to research more about the permissions for files/foldes/process/script to get a better understanding of the subject!

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

I did it this time with sudo, but now the nodeos_replay command is not found:

However, the nodeos_replay file is in my contracts directory. Was it successfully made executable?

1 Like

ok sorry my bad, you forgot to make the “nodeos_replay” executable, i misstype it on the little guide.

you need to make it executable with:

sudo chmod +x nodeos_replay

after that, has you can see, it will change the color from gray to green, green color is made for executable files.

try again to run it with:

sudo ./nodeos_replay

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

Great, now it’s working! The node is running :grinning:

Is pkill nodeos fine when I need to shut dow Nodeos?

OK, I will continue the course and create a wallet.

Thanks a lot @thecil, this was very helpful! :+1:

1 Like

Great! happy to know that you made it work! be proud of it!
Also yes, everytime you want to shutdown the Nodeos process correctly, you have to use “pkill nodeos”, by doing it you will avoid to get the last issue (corrupted blockchain).

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

Hi guys,

Everytime I restart nodeos I have to re-deploy the contract and I have no data persistence for the table dog.

$ cat ~/stop_nodeos.sh
pkill nodeos
sleep 2
ps aux | grep nodeos | grep -v “grep” || echo “nodeos stopped”
grep “nodeos successfully exiting” /home/jj/nodeos.log | tail -2

cat ~/start_nodeOS.sh
nodeos -e -p eosio
–plugin eosio::producer_plugin
–plugin eosio::producer_api_plugin
–plugin eosio::chain_api_plugin
–plugin eosio::http_plugin
–plugin eosio::history_plugin
–plugin eosio::history_api_plugin
–filter-on=""
–access-control-allow-origin=’
’
–contracts-console
–http-validate-host=false
–verbose-http-errors >> nodeos.log 2>&1 &

Any clues ?

Thanks .

JJ.

1 Like

Hello sir, try this command instead for your “start_nodeOS.sh” (remember to backup it first)

nodeos -e -p eosio 
--plugin eosio::producer_plugin 
--plugin eosio::chain_api_plugin 
--plugin eosio::http_plugin 
--plugin eosio::history_plugin 
--plugin eosio::history_api_plugin 
--access-control-allow-origin='*' 
--contracts-console 
--http-validate-host=false >> nodeos.log 2>&1 & 
echo "Nodeos started, check status on 'tail -f nodeos.log'"
echo " "
echo "IMPORTANT: Remember to close proprely with command 'pkill nodeos'"

Also, which folder is your nodeos.log located? and the contract? Operating system that you are using?

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

Is it possible to delete a default cleos wallet?
I don’t see this possibility in cleos wallet subcommands.

Likewise, is it possible to delete an account?

1 Like

2. Manually deleting the eosio blockchain data folder.

Open a Terminal window, we have to navigate to the “.local” folder

cd ~/.local/share/eosio/nodeos/

Manually delete the “data” folder

sudo rm -vrf data

rm is the command to delete any file/folder on linux, -vrf means [v = verbose to explain what is being done, r= remove directory and content recursively, f= force to ignore nonexistent files and arguments]

You will be promted with somethin like this thanks to the verbose option:

removed 'data/somethingFile'
removed 'data/otherFile'
removed directory 'data'

Now you can close this terminal window and start again the blockchain with the script “nodeos_start” that you have created before.

Be aware that both methods will probably make you loose any account or token that you have created in the past, so have to restart all the accounts and smart contracts deployment from scratch. In both cases, to avoid this issue, you have to be sure to use the “pkill nodeos” command in order to properly close the nodeos process to avoid a corrupted blockchain issue.

Hope you find this useful! :slight_smile:

If you have any doubt, please let us know so we can help you!

Carlos Z.

2 Likes

Yes, the sudo rm -vrf data command in the local folder deletes the eosio blockchain data folder, but by doing so, do I delete the wallet? What I see in the data directory from the command line is three directories: blocks, state and snapshots. Where is stored the wallet?

But isn’t it possible to specifically delete only a wallet, or only an account, and not other directories or files?

1 Like

oook thats even easy, at your “home” folder in ubuntu: using the command “ls” will show you all the files, you should be able to see a folder with the name “eosio-wallet”, i would not suggest to delete the folder, just the content inside of it, so you can go with:

navigate into the folder:

cd ~/eosio-wallet

ask to see all files: with "ls"

use this command to delete all the files (please redesign the command if you don’t have any of the files that i mention)

sudo rm -v config.ini default.wallet keosd.sock wallet.lock

after that, you have delete all the files that are inside the “eosio-wallet” folder.

Here is an example that i have done: (I’m not deleting my eosio-wallet folder, i create a copy just to show you an example of it :grimacing:)
image

Hope you find this useful! :slight_smile:

If you have any doubt, please let us know so we can help you!

Carlos Z.

1 Like

Thank you, this is useful! :+1:

Gracias Carlos.
It works like a charm !
I have data persistence on my dogs table after stop|restart nodeos.
Just wondering the differences between your script and the one in the course