Fractality (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
|
February 22, 2011, 02:05:21 PM |
|
Hi,
I offer 30BTC if somebody can help me to get poclbm to autostart. I already have bitcoind starting automatically, and poclbm works if I login on the mining computer and start it. Currently the environment variables for the Ati Stream SDK are only set for the user I login with.
However, I want it to run automatically when the PC boots up, without anybody logging in.
I have a Radeon 5970 card (2 GPUs).
Thanks!
|
|
|
|
|
|
|
The grue lurks in the darkest places of the earth. Its favorite diet is adventurers, but its insatiable appetite is tempered by its fear of light. No grue has ever been seen by the light of day, and few have survived its fearsome jaws to tell the tale.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
|
|
gusti
Legendary
Offline
Activity: 1099
Merit: 1000
|
|
February 22, 2011, 02:19:17 PM |
|
I will take the job. Do you wish the solution be posted public or private ?
|
If you don't own the private keys, you don't own the coins.
|
|
|
Mahkul
Sr. Member
Offline
Activity: 434
Merit: 250
Every saint has a past. Every sinner has a future.
|
|
February 22, 2011, 02:25:03 PM |
|
Posted.
|
|
|
|
Raulo
|
|
February 22, 2011, 02:29:30 PM |
|
Any script that sets SDK library paths, DISPLAY=:0 and runs as root should do the trick. edit: export DISPLAY=:0 export LD_LIBRARY_PATH=/path/to/sdk:$LD_LIBRARY_PATH pocmldir/poclbm.py --parametes
Put the script is some file and run it from /etc/rc.local I'll test it and post it after I reboot the machine
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
gusti
Legendary
Offline
Activity: 1099
Merit: 1000
|
|
February 22, 2011, 02:31:12 PM |
|
OK, here we go. You need to add your start command in /etc/init.d/rc.local
rc.local must be :
export LD_LIBRARY_PATH=/usr/lib export LD_LIBRARY_PATH=/ati-stream-sdk-v2.1-lnx32/lib/x86 export DISPLAY=:0 /bitcoin-0.3.19/bin/32/bitcoind >> bitcoind.log 2>&1 & sleep 5 poclbm (options) >> poclbm.log 2>&1 &
If that does not work (as in DiabloMiner) you need to call rc.local from a 2nd machine, like :
ssh 192.168.0.2 /etc/init.d/rc.local
where 192.168.0.2 is your ubuntu machine, and you already have passwordless auth between ubuntu and 2nd machine.
|
If you don't own the private keys, you don't own the coins.
|
|
|
gusti
Legendary
Offline
Activity: 1099
Merit: 1000
|
|
February 22, 2011, 02:32:33 PM |
|
Any script that sets SDK library paths, DISPLAY=:0 and runs as root should do the trick.
Doing that only does not work with e.g. DiabloMiner You need to call the start script from a 2nd. machine
|
If you don't own the private keys, you don't own the coins.
|
|
|
Raulo
|
|
February 22, 2011, 02:56:44 PM |
|
Doing that only does not work with e.g. DiabloMiner You need to call the start script from a 2nd. machine
Original poster asked for poclbm. I can only confirm that a script in /etc/rc.local that sets DISPLAY and SDK paths works. Just tested. For two cores, one has to run each separately in background ./poclbm -d 1 -params > output1 2>&1 & ./poclbm -d 2 -params > output2 2>&1 &
The same script can set fan speed (which resets each Xorg restart).
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Fractality (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
|
February 22, 2011, 03:55:58 PM |
|
Thanks, will try that later. I guess my question was a bit premature, as I had not even really tried a startup script. I first tried to start poclbm via ssh and it failed, so I just assumed the same problem would appear with autostart.
Any ideas what might be causing the problems with ssh?
Anyway, once I got it working (the autostart), I'll send the BTC.
Is there a straightforward way to turn the log file into a rotating log?
|
|
|
|
gusti
Legendary
Offline
Activity: 1099
Merit: 1000
|
|
February 22, 2011, 04:00:45 PM |
|
Thanks, will try that later. I guess my question was a bit premature, as I had not even really tried a startup script. I first tried to start poclbm via ssh and it failed, so I just assumed the same problem would appear with autostart.
Any ideas what might be causing the problems with ssh?
Anyway, once I got it working (the autostart), I'll send the BTC.
Is there a straightforward way to turn the log file into a rotating log?
Surely the "export display" option was missing. You can rotate the logs with logrotate utility.
|
If you don't own the private keys, you don't own the coins.
|
|
|
Raulo
|
|
February 22, 2011, 04:22:43 PM |
|
Any ideas what might be causing the problems with ssh?
DISPLAY and SDK paths are all you need. And if you do not own X screen (i.e., did not logged in via console before), you have to be root. What errors do you have? Is there a straightforward way to turn the log file into a rotating log?
Without killing poclbm, you would have to modify the poclbm source to log into files. If you don't mind killing poclbm, this script would do the trick #!/bin/bash #adjust the step to your needs step=86400 while true; do suffix=`date +%s` name=mininglog.$suffix echo $suffix >$name date >>$name ./poclbm.py -v -f 2 -d 1 -o *** -p 8332 -u **** --pass=**** -w 128 -r 60 >>$name & sleep $step # killing the old miner ps auxw |grep poclbm|grep 8332|awk '{print $2}' |xargs kill # put date date >>$name date +%s >>$name done
It will create a log with Unix time as the suffix and will add starting and ending timestamps to the log. P.S. I don't claim the original bounty. It should go to gusti.
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Fractality (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
|
February 22, 2011, 06:22:12 PM |
|
DISPLAY and SDK paths are all you need. And if you do not own X screen (i.e., did not logged in via console before), you have to be root. Hm, so what is the "own X screen" thing? In fact at least the aticonfig utility worked as root. I tried running poclbm as root, but then of course it failed because root doesn't have the SDK variables set (I suppose). Maybe it would have worked as root. The confusing thing was that if I tried to ssh before logging in on the PC, it wouldn't work (poclbm would only find the CPU), and once I logged in on the PC it would work. So I guess by logging in on the PC directly (without ssh), I got to "own the X screen"? I always used the export DISPLAY=:0 line... Bounty for gusti - OK. I still didn't get round to trying it. My mother just came to visit, so please be patient - might even be a couple of days before I can try it. However, I already sent 10 BTC to Raulo because I promised to send some coins in the other threat about basic setup. I wish I already had more BTC to spend :-)
|
|
|
|
Raulo
|
|
February 22, 2011, 06:46:32 PM |
|
Hm, so what is the "own X screen" thing? In fact at least the aticonfig utility worked as root. I tried running poclbm as root, but then of course it failed because root doesn't have the SDK variables set (I suppose). Maybe it would have worked as root
It would have worked if you had set LD_CONFIG_PATH and DISPLAY variables. The confusing thing was that if I tried to ssh before logging in on the PC, it wouldn't work (poclbm would only find the CPU), and once I logged in on the PC it would work. So I guess by logging in on the PC directly (without ssh), I got to "own the X screen"? I always used the export DISPLAY=:0 line...
X server is what controls the screen. If you do not log in through console and start your gnome session, it is "owned" by gdm, the display that shows login prompt. Since you do not control the screen, you cannot send commands to the graphics card. Either you need to login via console (and then the operating system recognizes that you control the screen), or mine as root that can do anything. However, I already sent 10 BTC to Raulo because I promised to send some coins in the other threat about basic setup.
I wish I already had more BTC to spend :-)
Thanks. I wish you luck.
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Mahkul
Sr. Member
Offline
Activity: 434
Merit: 250
Every saint has a past. Every sinner has a future.
|
|
February 24, 2011, 12:51:25 PM |
|
Is there any way to permanently set the clock (aticonfig --odsc=x,x) and fanspeed values so that they don't change after the reboot?
|
|
|
|
Raulo
|
|
February 24, 2011, 01:03:09 PM |
|
Is there any way to permanently set the clock (aticonfig --odsc=x,x) and fanspeed values so that they don't change after the reboot?
Fanspeed, no: resets after each X restart to auto. Clock, yes: aticonfig --odcc --adapter=all
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Mahkul
Sr. Member
Offline
Activity: 434
Merit: 250
Every saint has a past. Every sinner has a future.
|
|
February 24, 2011, 02:36:52 PM |
|
Thanks Raulo! I logged in via ssh and put in export DISPLAY=:0 (and the library path is in there as well). I am still unable to use aticonfig via ssh: mahkul@szafir:~/Downloads/bitcoin-0.3.19/bin/32$ sudo aticonfig --odgt No protocol specified ERROR - X needs to be running to perform ATI Overdrive(TM) commands mahkul@szafir:~/Downloads/bitcoin-0.3.19/bin/32$
Is sudo access not enough for this? Do I need to be logged in as root himself?
|
|
|
|
Raulo
|
|
February 24, 2011, 02:48:31 PM |
|
mahkul@szafir:~/Downloads/bitcoin-0.3.19/bin/32$ sudo aticonfig --odgt No protocol specified ERROR - X needs to be running to perform ATI Overdrive(TM) commands mahkul@szafir:~/Downloads/bitcoin-0.3.19/bin/32$
Is sudo access not enough for this? Do I need to be logged in as root himself? I guess the environmental variable is not set correctly when sudoing. Try $ sudo bash # export DISPLAY=:0 # aticonfig --odgt
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Fractality (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
|
February 28, 2011, 01:51:48 PM |
|
Hi, I tried to create a script that sets the environment variables and starts the miner. However, it only seems to hang the shell. I tried running it via ssh with sudo. That is the first thing I need to get working before autostart, because the miner will be in a friend's cellar. If anything goes wrong, I have to be able to do stuff with ssh... Besides, I'd like to be able to test the script before I put it on autostart. Any ideas? Here is the script: export ATISTREAMSDKROOT=/home/bjoern/bitcoin/ati-stream-sdk-v2.1-lnx64 export ATISTREAMSDKSAMPLESROOT=/home/bjoern/bitcoin/ati-stream-sdk-v2.1-lnx64
export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86_64/:$LD_LIBRARY_PATH export LIBRARY_PATH=$LIBRARY_PATH:$ATISTREAMSDKROOT/lib/x86_64/ export C_INCLUDE_PATH=$C_INCLUDE_PATH:$ATISTREAMSDKROOT/include/
export DISPLAY=:0
poclbm/poclbm.py -u myuser --pass=notmypwd -d 1 -v -w 128 --verbose > /home/bjoern/bitcoin/poclbm1.log
#poclbm/poclbm.py -u myuser --pass=notmypwd -d 2 -v -w 128 -r 1 --verbose > /home/bjoern/bitcoin/poclbm2.log
What would I have to do to start both miners, btw? Is it sufficient to add a "&" to the end of the line, or does that only work in the shell? Anyway, nothing ever showed up in the log file, and the script wasn't endable with ctrl+c.
|
|
|
|
Mahkul
Sr. Member
Offline
Activity: 434
Merit: 250
Every saint has a past. Every sinner has a future.
|
|
February 28, 2011, 02:47:53 PM |
|
I can't get this to work: mahkul@szafir:~/log$ cat ./bitcoind.log bitcoin server starting Warning: To use bitcoind, you must set rpcpassword=<password> in the configuration file: /.bitcoin/bitcoin.conf If the file does not exist, create it with owner-readable-only file permissions.
Why is it looking for that file in the /.bitcoin/ directory and not in ~/.bitcoin/ (where it acutally is) Also, I have no devices visible in the miner (and I have the DISPLAY=:0 line in /etc/rc.local). mahkul@szafir:~/log$ cat output1.log No protocol specified No device specified or device not found, use -d to specify one of the following
[0] AMD Phenom(tm) II X4 925 Processor
Should LD_LIBRARY_PATH and DISPLAY=:0 lines be in the rc.local itself? Because I have them in my automine script: mahkul@szafir:~$ cat automine export DISPLAY=:0 export LD_LIBRARY_PATH=/opt/ati-stream-sdk-v2.1-lnx32/lib/x86/:$LD_LIBRARY_PATH /home/mahkul/Downloads/bitcoin-0.3.19/bin/32/bitcoind >> /home/mahkul/log/bitcoind.log 2>&1 & sleep 5 cd /home/mahkul/Downloads/poclbm ./poclbm.py --user=user --pass=password -d 1 > /home/mahkul/log/output1.log 2>&1 & ./poclbm.py --user=user --pass=password -d 2 > /home/mahkul/log/output2.log 2>&1 &
Thanks.
|
|
|
|
Raulo
|
|
February 28, 2011, 02:48:48 PM |
|
This script should work provided that you correctly set the paths. I would also give the absolute path for the poclbm.py. What happens if you run the script without redirecting to the log files, i.e. without >/home/bjoern/bitcoin/poclbm1.log . Is it sufficient to add a "&" to the end of the line
Yes, it is.
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Raulo
|
|
February 28, 2011, 02:54:47 PM |
|
Why is it looking for that file in the /.bitcoin/ directory and not in ~/.bitcoin/ (where it acutally is)
Because it doesn't know that you as a user even exists. Try setting HOME to your directory. Should LD_LIBRARY_PATH and DISPLAY=:0 lines be in the rc.local itself? Because I have them in my automine script:
It won't hurt but it should be working within the miner (but try both) What happens if you run this script as root but not in autostart? I have a very similar script that works in autostart.
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Mahkul
Sr. Member
Offline
Activity: 434
Merit: 250
Every saint has a past. Every sinner has a future.
|
|
February 28, 2011, 03:18:18 PM |
|
Why is it looking for that file in the /.bitcoin/ directory and not in ~/.bitcoin/ (where it acutally is)
Because it doesn't know that you as a user even exists. Try setting HOME to your directory. Should LD_LIBRARY_PATH and DISPLAY=:0 lines be in the rc.local itself? Because I have them in my automine script:
It won't hurt but it should be working within the miner (but try both) What happens if you run this script as root but not in autostart? I have a very similar script that works in autostart. Ha! It didn't work as root, but I changed the line in rc.local to: sudo -i -u mahkul /home/mahkul/automine
Works like a charm.
|
|
|
|
Fractality (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
|
February 28, 2011, 05:39:42 PM |
|
What happens if you run the script without redirecting to the log files, i.e. without >/home/bjoern/bitcoin/poclbm1.log . First nothing (no output, no command prompt). If I quit via ctrl+c, and then do ps -a | grep poclbm, it shows a running poclbm process. Somehow I can not kill that one, either (not even with sudo kill -9), how is that? Is that because it belongs to the script? How could I kill it? Should I see the output from poclbm, or is it swallowed by the script? /home/mahkul/Downloads/bitcoin-0.3.19/bin/32/bitcoind >> /home/mahkul/log/bitcoind.log 2>&1 & Just curious, what does the 2>&1 part at the end of the line do?
|
|
|
|
Mahkul
Sr. Member
Offline
Activity: 434
Merit: 250
Every saint has a past. Every sinner has a future.
|
|
February 28, 2011, 05:56:52 PM |
|
/home/mahkul/Downloads/bitcoin-0.3.19/bin/32/bitcoind >> /home/mahkul/log/bitcoind.log 2>&1 & Just curious, what does the 2>&1 part at the end of the line do? The 2>&1 will write standard output and standard errors to a file. While it is processing, the command line will not be available. The shell will wait for the process to complete before letting you enter anything into the command line again. The 2>&1 & will also write standard output and standard errors to a file. The extra & means to execute the process in the background so the command line is still available while it is processing.
|
|
|
|
Raulo
|
|
February 28, 2011, 06:21:52 PM |
|
First nothing (no output, no command prompt). If I quit via ctrl+c, and then do ps -a | grep poclbm, it shows a running poclbm process. Somehow I can not kill that one, either (not even with sudo kill -9), how is that? Is that because it belongs to the script? How could I kill it?
If you cannot kill a process, it means that the fglrx driver messed in kernel memory. I had such behavior only when I overclocked too much. It should not happen. Check if there is a kernel panic in /var/log/messages and look for any problems in /var/log/Xorg.0.log
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Fractality (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
|
February 28, 2011, 06:30:35 PM |
|
Thanks - I now have the script working via ssh (adding the "&" after the line helped, I guess). However, starting it from rc.local it seems the graphics card once again is not visible.
Running it with "sudo myscript" in rc.local works. But is there a way to make it not run as root?
|
|
|
|
Fractality (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
|
February 28, 2011, 06:44:36 PM Last edit: February 28, 2011, 06:55:53 PM by Fractality |
|
Hm, correction - I just rebooted again and it didn't work with sudo. Could it be a random chance, depending on something else already being started or not?
Update: hm, odd, it didn't work wenn I added the -r 60 parameter to poclbm. With -r 10 it works atm.
|
|
|
|
Fractality (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
|
March 03, 2011, 11:24:20 PM |
|
Only got round to testing again today. Now even with -r 10 it was random if autostart would succeed or not. I added a sleep 60 command to the startup script, hopefully that should take care of race conditions.
|
|
|
|
Grinder
Legendary
Offline
Activity: 1284
Merit: 1001
|
|
March 04, 2011, 08:57:15 AM |
|
You can try making a file called /etc/rc5.d/S50bcminer and putting the commands in it. Make sure it is executable (chmod +x /etc/rc5.d/S50bcminer). The GPU miners require the X-server, but it is only started when the computer reaches run level 5. rc.local is executed at run level 3. Putting it in rc5.d with that name makes sure the script isn't run until the server has started and everything else has been loaded. The S50 part is there because the files are executed in sorted order, the rest (bcminer) you can change to whatever you want.
|
|
|
|
dmp1ce
|
|
April 09, 2011, 07:40:14 PM |
|
Another thing you can do is to put the commands into cron so that the applications will keep trying to start if they get closed for whatever reason. I had to write a script to check if poclbm was already running and then run it if it wasn't. #!/bin/bash # poclbm-start.sh
# This script needs to be run as root for me
# Make sure LD_LIBRARY_PATH is available export LD_LIBRARY_PATH=/opt/ati-stream-sdk-v2.1-lnx64/lib/x86_64/
# Look to see if poclbm is already running if [[ $(ps -ef) =~ "python poclbm.py -d $1" ]]; then echo "A program with the same command already seems to be running according to 'ps -ef'" else # poclbm not running so start it. echo "Starting python poclbm.py -d $1 -o yourbitcoindhost -w 128 --pass=pass --user=user --verbose" cd /yourpoclbmdirectory python poclbm.py -d $1 -o yourbitcoindhost -w 128 --pass=pass --user=user --verbose >> /yourlogdirectory/poclbm-$1.log 2>&1 & fi Then I added this to my root cron configuration: * * * * * /scriptlocation/poclbm-start.sh 1 * * * * * /scriptlocation/poclbm-start.sh 2 * * * * * /scriptlocation/poclbm-start.sh 3 * * * * * /scriptlocation/poclbm-start.sh 4
|
|
|
|
Zamicol
Newbie
Offline
Activity: 56
Merit: 0
|
|
April 20, 2011, 12:43:18 AM |
|
export DISPLAY=:0 export LD_LIBRARY_PATH=/path/to/sdk:$LD_LIBRARY_PATH pocmldir/poclbm.py --parametes
Put the script is some file and run it from /etc/rc.local I'm a noob to scripting so I don't understand all of this. I want to be able to press the power button on a machine with no other peripherals (monitor/keyboard) and have it start up and start mining. I have my machine auto-log in, so I don't think I need to worry about the SDK configuration, but I don't quite understand how to get poclbm autostarting: -"Put the script is some file" Huh? -"and run it from /etc/rc.local" Huh again? I'm also using the Ati over clock utility that uses QT, is there any way to set the default gpu/mem speeds? Thanks!
|
|
|
|
Zamicol
Newbie
Offline
Activity: 56
Merit: 0
|
|
April 20, 2011, 06:39:10 AM Last edit: April 20, 2011, 08:27:13 PM by Zamicol |
|
I figured it out Now I will share my knowledge for all future generations. First set a user to auto log in. System->Administration->Login screen Next, make a simple shell script. It needs to be something that will work under the terminal. Example: #!/bin/sh cd /home/zamicol/Bitcoin/poclbm python poclbm.py -u ******** --pass=********** -o ************* -p 8332 -d 1 -v -w 128 You can make this using a text editor like gedit. Save it with the .sh extension. Example: "myBitcoinMiner.sh" Make your script executable. (Right click->Properties->Permissions->Execute). You should now be able to double click your script and have it run under terminal to verify that your script works. Now to have it start up automatically upon login. Go to System->Preferences->Startup Application. On the screen that appears, click "Add" Name it whatever you want. Under the command, type "gnome-terminal -x /home/zamicol/Bitcoin/myBitcoinMiner.sh" and replace that latter part with the path to to script that you made. The -x will put your command in a new terminal window upon startup. You should have a system now that will start up and start mining without any further input from you Good luck! And in case anyone ever feels generous, my address is below.
|
|
|
|
Zamicol
Newbie
Offline
Activity: 56
Merit: 0
|
|
April 20, 2011, 06:52:04 AM |
|
Fanspeed, no: resets after each X restart to auto. Clock, yes: aticonfig --odcc --adapter=all
I type that in and it says "Clocks persisted for Adapter 0 - ATI Radeon HD 5800 Series." When I reboot, the clocks are the same. What am I missing? BTW, you're the man, Raulo.
|
|
|
|
Raulo
|
|
April 20, 2011, 06:55:48 AM |
|
Fanspeed, no: resets after each X restart to auto. Clock, yes: aticonfig --odcc --adapter=all
I type that in and it says "Clocks persisted for Adapter 0 - ATI Radeon HD 5800 Series." When I reboot, the clocks are the same. What am I missing? It makes the clocks set before and printed by aticonfig --odgc --adapter=all
permanent, also after reboot.
|
1HAoJag4C3XtAmQJAhE9FTAAJWFcrvpdLM
|
|
|
Zamicol
Newbie
Offline
Activity: 56
Merit: 0
|
|
April 20, 2011, 10:53:27 PM |
|
It makes the clocks set before and printed by aticonfig --odgc --adapter=all
permanent, also after reboot. You're still the man, but I have difficulty deciphering your manner of speech... but I was able to accomplish setting the default clock/mem speeds using default profiles in AMDOverdiveCtrl and setting it to start at login.
|
|
|
|
|