Pages:
Author

Topic: debug.log runCommand error - page 2. (Read 3366 times)

jlp
sr. member
Activity: 266
Merit: 264
March 14, 2015, 11:03:50 AM
#24
Ahem:

  • Stop bitcoind.
  • Configure it again to run /bin/true.
  • Run bitcoind with strace, eg. 'strace -o mytrace -s 99 -ff bitcoind &'. This assumes you usually run bitcoind by simply typing 'bitcoind'. If you run it some other way (for example './bitcoind' or '/path/to/bitcoind', substitute the "bitcoind" at the end accordingly. You may have to install strace first.
  • Wait for the next block. Find the error in the log.
  • Stop bitcoind.
  • Run bitcoind as usual (without strace) so you contribute to the network.
  • Examine the mytrace.* files you'll find in the current directory. A quick way is 'grep -C 2 bin/true mytrace*'. Post your findings/the output of the grep.
Here it is:

Code:
$ ls
bitcoin.conf    debug.log      mytrace.5729  mytrace.5741  mytrace.5746  mytrace.5751  peers.dat
debug.log.save     mytrace.5730      mytrace.5742  mytrace.5747  mytrace.5752  tempcron
blocks    debug.log.save.1  mytrace.5731  mytrace.5743  mytrace.5748  mytrace.5753
chainstate    mytrace.5727      mytrace.5732  mytrace.5744  mytrace.5749  mytrace.5754
db.log    mytrace.5728      mytrace.5733  mytrace.5745  mytrace.5750  mytrace.5773
$ grep -C 2 bin/true mytrace.*
mytrace.5773-rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
mytrace.5773-write(4, "2015-03-14 15:45:51 ", 20)    = 20
mytrace.5773:write(4, "runCommand error: system(/bin/true) returned -1\n", 48) = 48
mytrace.5773-madvise(0x7fe25effe000, 8368128, MADV_DONTNEED) = 0
mytrace.5773-_exit(0)                                = ?
$ bitcoind -daemon
Bitcoin server starting
$

I am still running bitcoind version 0.9.0.  Will this be a factor?  Do I need to upgrade to 0.10.0?

legendary
Activity: 1974
Merit: 1029
March 13, 2015, 05:15:47 PM
#23
Ahem:

  • Stop bitcoind.
  • Configure it again to run /bin/true.
  • Run bitcoind with strace, eg. 'strace -o mytrace -s 99 -ff bitcoind &'. This assumes you usually run bitcoind by simply typing 'bitcoind'. If you run it some other way (for example './bitcoind' or '/path/to/bitcoind', substitute the "bitcoind" at the end accordingly. You may have to install strace first.
  • Wait for the next block. Find the error in the log.
  • Stop bitcoind.
  • Run bitcoind as usual (without strace) so you contribute to the network.
  • Examine the mytrace.* files you'll find in the current directory. A quick way is 'grep -C 2 bin/true mytrace*'. Post your findings/the output of the grep.
jlp
sr. member
Activity: 266
Merit: 264
March 13, 2015, 02:27:20 PM
#22

In this thread:
https://bitcointalksearch.org/topic/m.4154179

there was an error elsewhere in the config file that was messing things up.  Perhaps this is a symptom of a different problem that is manifesting itself in an odd way?


Thanks for your suggestion.

Automatic had the following in his bitcoin.conf.  However, he stated that the notify commands randomly started working and randomly stopped working.

Code:
rpcuser=no.
rpcpassword=no.
maxconnections=1000
checklevel=4
keypool=10000
rpcallowip=127.0.0.1
server=1
blocknotify=/home/bitcoin/block.sh %s
walletnotify=/home/bitcoin/wallet.sh %s
alertnotify=/home/bitcoin/alert.sh %s

I tried the following configs in my bitcoin.conf:

Code:
rpcuser=XXXXXXXXXX
rpcpassword=XXXXXXXXXX
maxconnections=1000
checklevel=4
keypool=10000
rpcallowip=127.0.0.1
server=1
blocknotify=/bin/true
walletnotify=/bin/true
alertnotify=/bin/true

and

Code:
rpcuser=XXXXXXXXXX
rpcpassword=XXXXXXXXXX
blocknotify=/bin/true
walletnotify=/bin/true

After restarting bitcoind each time, I'm still getting the same error in .bitcoin/debug.log:

Code:
2015-03-13 18:45:17 runCommand error: system(/bin/true) returned -1

Any other suggestions that I can try?

legendary
Activity: 4228
Merit: 1313
March 13, 2015, 11:34:57 AM
#21

That has nothing to do with the result of the program. The error means that bitcoin core is unable to run /bin/true and that's the problem you have to tackle.

Thanks for your help.  Do you have any ideas on what I can try next?



In this thread:
https://bitcointalksearch.org/topic/m.4154179

there was an error elsewhere in the config file that was messing things up.  Perhaps this is a symptom of a different problem that is manifesting itself in an odd way?
jlp
sr. member
Activity: 266
Merit: 264
March 13, 2015, 10:57:57 AM
#20

That has nothing to do with the result of the program. The error means that bitcoin core is unable to run /bin/true and that's the problem you have to tackle.

Thanks for your help.  Do you have any ideas on what I can try next?

legendary
Activity: 1974
Merit: 1029
March 13, 2015, 02:20:13 AM
#19
I'm still getting the following in /home/username/.bitcoin/debug.log:

Code:
2015-03-13 00:41:32 runCommand error: system(/bin/true) returned -1


That has nothing to do with the result of the program. The error means that bitcoin core is unable to run /bin/true and that's the problem you have to tackle.
jlp
sr. member
Activity: 266
Merit: 264
March 12, 2015, 07:56:49 PM
#18

Code:
 
me@mine:~# /bin/true
me@mine:~# echo $?
0
me@mine:~# /bin/false
me@mine:~# echo $?
1
As dserrano5 said, it seems that "not even a simple /bin/true works."

Try what I have as code above.  Do you get something similar to the output above?


/bin/true and /bin/false are useful for testing your logic when needed since you always know the result.

I got the same output as you did:

Code:
$ /bin/true
$ echo $?
0
$ /bin/false
$ echo $?
1
$

I'm still getting the following in /home/username/.bitcoin/debug.log:

Code:
2015-03-13 00:41:32 runCommand error: system(/bin/true) returned -1
jlp
sr. member
Activity: 266
Merit: 264
March 12, 2015, 07:49:19 PM
#17

Interesting. So you had this working for a year, then it suddenly broke "a few months ago" (as per the OP) to the point that not even a simple /bin/true works. Are you using apparmor o something similar?

I just checked my system and I have it:

/etc/apparmo
/etc/appmor.d

However, I have never seen it anywhere before you mentioned it.  Should I try changing something in it?

legendary
Activity: 4228
Merit: 1313
March 12, 2015, 06:39:24 PM
#16

Try the curl command on one line, then the echo command on a second line as it was in grue's example.  

It appears from the above that you did it all on one line.

Thanks for your keen observation.  I indeed entered both commands on one line.  Here's what I got now:

Code:
$ curl https://mydomain.com/blocknotify.php/?blockhash=1
$ echo $?
0
$

What does the 0 mean?  Should I try putting back the following into bitcoin.conf?:

Code:
blocknotify=curl https://mydomain.com/blocknotify.php/?blockhash=%s


Just to respond once more to this, the 0 should indicate that it returned success (like /bin/true), or no error, which is a good thing.

legendary
Activity: 4228
Merit: 1313
March 12, 2015, 06:37:05 PM
#15
You can try "blocknotify=/bin/true". Nothing should happen, not even an error in your log Wink.

Then copy /bin/true to your home. "blocknotify=/home//true". Nothing should happen again, no errors either.

Another thing worth trying is "blocknotify=/bin/touch /tmp/foo" to weed out problems with spaces and that. After the next block /tmp/foo should exist, and of course no errors in the log.

Thanks for your suggestions.

I tried "blocknotify=/bin/true".  I got the following in /home/username/.bitcoin/debug.log:

Code:
2015-03-12 22:12:47 runCommand error: system(/bin/true) returned -1

What does this error mean?

I'm not exactly sure what you mean by "Then copy /bin/true to your home".  I assume that you simply want me to try "blocknotify=/home//true".  I haven't tried this nor your suggestion with /tmp/foo, as I assumed that I'll get the runCommand error again.  Let me know if I should anyways or if there isn't else I can try.  Thanks.



/bin/true   should return a 0
/bin/false  should return a non-zero, typically 1  (or -1)
e.g.
Code:
 
me@mine:~# /bin/true
me@mine:~# echo $?
0
me@mine:~# /bin/false
me@mine:~# echo $?
1
As dserrano5 said, it seems that "not even a simple /bin/true works."

Try what I have as code above.  Do you get something similar to the output above?


/bin/true and /bin/false are useful for testing your logic when needed since you always know the result.
legendary
Activity: 1974
Merit: 1029
March 12, 2015, 05:54:31 PM
#14
I tried "blocknotify=/bin/true".  I got the following in /home/username/.bitcoin/debug.log:

Code:
2015-03-12 22:12:47 runCommand error: system(/bin/true) returned -1

Interesting. So you had this working for a year, then it suddenly broke "a few months ago" (as per the OP) to the point that not even a simple /bin/true works. Are you using apparmor o something similar?
jlp
sr. member
Activity: 266
Merit: 264
March 12, 2015, 05:26:03 PM
#13
You can try "blocknotify=/bin/true". Nothing should happen, not even an error in your log Wink.

Then copy /bin/true to your home. "blocknotify=/home//true". Nothing should happen again, no errors either.

Another thing worth trying is "blocknotify=/bin/touch /tmp/foo" to weed out problems with spaces and that. After the next block /tmp/foo should exist, and of course no errors in the log.

Thanks for your suggestions.

I tried "blocknotify=/bin/true".  I got the following in /home/username/.bitcoin/debug.log:

Code:
2015-03-12 22:12:47 runCommand error: system(/bin/true) returned -1

What does this error mean?

I'm not exactly sure what you mean by "Then copy /bin/true to your home".  I assume that you simply want me to try "blocknotify=/home//true".  I haven't tried this nor your suggestion with /tmp/foo, as I assumed that I'll get the runCommand error again.  Let me know if I should anyways or if there isn't else I can try.  Thanks.

legendary
Activity: 1974
Merit: 1029
March 12, 2015, 04:02:02 PM
#12
You can try "blocknotify=/bin/true". Nothing should happen, not even an error in your log Wink.

Then copy /bin/true to your home. "blocknotify=/home//true". Nothing should happen again, no errors either.

Another thing worth trying is "blocknotify=/bin/touch /tmp/foo" to weed out problems with spaces and that. After the next block /tmp/foo should exist, and of course no errors in the log.
jlp
sr. member
Activity: 266
Merit: 264
March 12, 2015, 12:26:53 PM
#11

If dserrano5's changes didn't create files in /tmp, that is odd unless there are permission problems there.

I got the following:

Code:
$ ls -ld /tmp
drwxrwxrwt 4 root root 4096 Mar 12 17:17 /tmp
$

Am I correct to assume that the permissions for /tmp are fine?

Do I need to change something in ~/myscript.sh in order to enable it to write to /tmp ?

legendary
Activity: 4228
Merit: 1313
March 12, 2015, 12:03:39 PM
#10

Try the curl command on one line, then the echo command on a second line as it was in grue's example.  

It appears from the above that you did it all on one line.

Thanks for your keen observation.  I indeed entered both commands on one line.  Here's what I got now:

Code:
$ curl https://mydomain.com/blocknotify.php/?blockhash=1
$ echo $?
0
$

What does the 0 mean?  Should I try putting back the following into bitcoin.conf?:

Code:
blocknotify=curl https://mydomain.com/blocknotify.php/?blockhash=%s


0 should mean it returned successfully.

If dserrano5's changes didn't create files in /tmp, that is odd unless there are permission problems there.
jlp
sr. member
Activity: 266
Merit: 264
March 11, 2015, 07:15:16 PM
#9

Try the curl command on one line, then the echo command on a second line as it was in grue's example.  

It appears from the above that you did it all on one line.

Thanks for your keen observation.  I indeed entered both commands on one line.  Here's what I got now:

Code:
$ curl https://mydomain.com/blocknotify.php/?blockhash=1
$ echo $?
0
$

What does the 0 mean?  Should I try putting back the following into bitcoin.conf?:

Code:
blocknotify=curl https://mydomain.com/blocknotify.php/?blockhash=%s
legendary
Activity: 4228
Merit: 1313
March 11, 2015, 07:04:59 PM
#8
Yes, I have SSH.  Sorry, I didn't understand what you meant.  I tried your suggestion and I can tell that it executed my PHP program, as I have code in it that sends me an email.  However, SSH outputted the following:

$ curl https://mydomain.com/blocknotify.php/?blockhash=1 echo $?
curl: (6) Couldn't resolve host 'echo'


302 Found

Found


The document has moved https://0/">here.



$

I don't know what that output means.  Do you?  Does this mean everything went as planned?


Try the curl command on one line, then the echo command on a second line as it was in grue's example.  

It appears from the above that you did it all on one line.
jlp
sr. member
Activity: 266
Merit: 264
March 11, 2015, 07:00:16 PM
#7
Code:
cat >~/myscript.sh <#!/bin/bash
echo hi there, starting >/tmp/log
curl https://mydomain.com/blocknotify.php/?blockhash=42 >>/tmp/log 2>>/tmp/err
echo exit code is $? >>/tmp/log
EOF
$ chmod +x myscript.sh

Then "blocknotify=/home//myscript.sh" in bitcoin.conf. After the next block, take a look to /tmp/log and /tmp/err.

Next step: feed the 42 from the "blocknotify=" line, use $@ in the script. Next step: call curl directly with no wrapper.

Thanks for your suggestions.  I created myscript.sh and changed bitcoin.conf as per your suggestions.  Then I did this:

Code:
$ bitcoind stop
Bitcoin server stopping
$ bitcoind -daemon
Bitcoin server starting

$ bitcoind getinfo
{
    "version" : 90000,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : X.XXXXXX,
    "blocks" : 347231,
    "timeoffset" : 0,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 47427554950.64830017,
    "testnet" : false,
    "keypoololdest" : 1396812248,
    "keypoolsize" : 84,
    "paytxfee" : 0.00000000,
    "unlocked_until" : 0,
    "errors" : ""
}

When I noticed that "blocks" (from bitcoind getinfo) increased, I checked the /tmp folder.  But this folder only had cookies.txt, but log and err do not exist.

I checked /home/myusername/.bitcoin/debug.log and saw this:

Code:
23:35:05 runCommand error: system(/home/myusername/myscript.sh) returned -1

Is it possible that there is something wrong in myscript.sh that is causing the runCommand error?

When you say "call curl directly with no wrapper", are you saying to call curl directly from bitcoin.conf without using myscript.sh?
legendary
Activity: 1974
Merit: 1029
March 11, 2015, 05:09:54 PM
#6
Code:
cat >~/myscript.sh <#!/bin/bash
echo hi there, starting >/tmp/log
curl https://mydomain.com/blocknotify.php/?blockhash=42 >>/tmp/log 2>>/tmp/err
echo exit code is $? >>/tmp/log
EOF
$ chmod +x myscript.sh

Then "blocknotify=/home//myscript.sh" in bitcoin.conf. After the next block, take a look to /tmp/log and /tmp/err.

Next step: feed the 42 from the "blocknotify=" line, use $@ in the script. Next step: call curl directly with no wrapper.
jlp
sr. member
Activity: 266
Merit: 264
March 11, 2015, 04:07:21 PM
#5
Yes, I have SSH.  Sorry, I didn't understand what you meant.  I tried your suggestion and I can tell that it executed my PHP program, as I have code in it that sends me an email.  However, SSH outputted the following:

$ curl https://mydomain.com/blocknotify.php/?blockhash=1 echo $?
curl: (6) Couldn't resolve host 'echo'


302 Found

Found


The document has moved https://0/">here.



$

I don't know what that output means.  Do you?  Does this mean everything went as planned?
Pages:
Jump to: