Bitcoin Forum
November 02, 2024, 03:34:25 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 »  All
  Print  
Author Topic: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog  (Read 20746 times)
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 15, 2011, 08:00:42 AM
Last edit: July 27, 2011, 03:49:47 AM by Yanz
 #1

All my mining rigs were running Windows 7 but they kept BSODing and crashing and I got tired of reseting them so I tried Linux. It kicked my butt the first day or so but in the end I got it to do my bidding Smiley

So in this guide I'll show you how to setup LinuxCoin to
  • run off a USB thumb drive
  • automatically boot and start mining unattended
  • automatically set overclocks and load fan speed profiles
  • setup a software watchdog to automatically kill and restart crashed miners
  • Huh
  • Profit


Credit: Most of this is based off a post by kjj http://forum.bitcoin.org/index.php?topic=7374.msg248025#msg248025
I couldn't get it to work for me so it's heavily modified by me to run on a stock LinuxCoin 0.2.1b install.

I'm using a 4GB flash drive I had laying around. I recommend good quality high speed flash drive. I'm using one of these http://www.newegg.com/Product/Product.aspx?Item=N82E16820220251

Rest of my Hardware
Two Sapphire 5850 Xtremes, Asus M4A79XTD EVO, 2GB RAM, Sempron 140 processor, 550W CoolerMaster PSU

OK let's get started.

1. Grab a copy of LinuxCoin 0.2.1b http://www.linuxcoin.co.uk/
2. Download Unetbootin http://unetbootin.sourceforge.net/
3. Download the persistence file. I got the 2GB (2048.zip) but I think the others would work too http://linuxcoin.co.uk/downloads/persistence/
4. Run unetbootin and select the LinuxCoin iso you just downloaded. Let it do it's thing. When it's done click exit but don't remove your flash drive yet.
5. Extract the persistence file to the root of your flash drive.
6. Open syslinux.cfg and replace it with this:
Code:
default menu.c32
prompt 0
menu title LinuxCoin
timeout 2

label linuxcoin
menu label LinuxCoin Persistent (flash only)
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live config quiet splash persistent rw vga=791 noprompt
This let will make it autoboot into persistence mode. The noprompt disables the press ENTER to reboot/shutdown message at the end.

7. Plug the flash drive into your mining rig and boot it off the USB. Setup networking/wallpaper/whatever else you want to do. You might want to test out mining/connecting to the net/etc. Assuming you have no problems booting and running LinuxCoin...proceed.

8. Make the file and/or folders /home/user/.config/autostart/auto.desktop and add the following contents:
Code:
[Desktop Entry]
Encoding=UTF-8
Name=coin
Exec=lxterminal --command "sh /home/user/start.sh"
Terminal=true

9. Open up terminal run AMDOverdriveCtrl -h | grep active. (Hint type AMD and press tab to autocomplete) Note the index number of your active adapters. If you only have one then it is 0. Mine are 0 and 3.

10. Now run AMDOverdriveCtrl -i 0. This opens up AMDOverdriveCtrl GUI for card 0. Overclock your card and setup your fan profiles. Export it as a file called gpu0.ovdr. Repeat for each card you have and change index numbers accordingly (ie AMDOverdriveCtrl -i 3)

11. Make the file /home/user/start.sh and put paste in the following:
Code:
#!/bin/bash
sleep 20
xhost +
echo $DISPLAY > /home/user/.display
AMDOverdriveCtrl -i 0 -b gpu0.ovdr
AMDOverdriveCtrl -i 3 -b gpu3.ovdr
lxterminal --title miner1 --command "sh /home/user/miner1.sh"
lxterminal --title miner2 --command "sh /home/user/miner2.sh"
This will make the computer wait 20 seconds to loadup/connect to the network/etc. Then it will load the overclock and fan profiles for each GPU and then start your miners.

12. Make the files /home/user/miner1.sh and /home/user/miner2.sh and fill in:
Code:
#!/bin/bash
cd /opt/miners/phoenix
./phoenix.py -u http://yanz_1:pass@uswest.btcguild.com:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=0
Modify accordingly to mine for yourself.

13. Make the file /home/user/restart.sh and fill it with these magical lines:
Code:
#!/bin/bash
export DISPLAY=`cat /home/user/.display`
pc=`ps waxuf | grep miner1.sh -c`
ld=`aticonfig --odgc --adapter=0 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
 kill `ps -ef | grep miner1 | grep -v grep | awk '{print $2}'`
 lxterminal --title miner1 --command sh /home/user/miner1.sh &
 date +"%D %r miner1 restarted" >> /home/user/cron_job.log
fi
pc=`ps waxuf | grep miner2.sh -c`
ld=`aticonfig --odgc --adapter=1 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
 kill `ps -ef | grep miner2 | grep -v grep | awk '{print $2}'`
 lxterminal --title miner2 --command sh /home/user/miner2.sh &
 date +"%D %r miner2 restarted" >> /home/user/cron_job.log
fi
This will check the each GPU to make sure the load is greater than 50% and check to see that the process miner1 and miner2 exist. If not it will kill and restart the appropriate miner. It also logs it to /home/user/cron_job.log

14. Run sudo crontab -e -u user and add this line after the last line:
Code:
0-59 * * * * sh /home/user/restart.sh
This runs the restart miner script every minute.

15. Reboot

16.  Huh

17. Profit

18. Donate to 1LeLE4PP72CNfHDmT3JyFUQehZ4i41LxPz if this helped you.  Tongue

Comments and improvements welcome.

With great video cards comes great power consumption.
tysat
Legendary
*
Offline Offline

Activity: 966
Merit: 1004


Keep it real


View Profile
July 15, 2011, 08:08:19 AM
 #2

Sexy guide!

I assume for more than 2 cards all you would do is add to the end of restart.sh?

Code:
pc=`ps waxuf | grep miner3.sh -c`
ld=`aticonfig --odgc --adapter=1 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
 kill `ps -ef | grep miner3 | grep -v grep | awk '{print $2}'`
 lxterminal --title miner3 --command sh /home/user/miner3.sh &
 date +"%D %r miner3 restarted" >> /home/user/cron_job.log
fi

Just want to make sure I'm not being dumb as I'm tired...
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 15, 2011, 08:17:53 AM
 #3

Close... Wink
You forgot to change the adapter number.
change line 2 to:
Code:
ld=`aticonfig --odgc --adapter=2 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
Other than that looks like your all set.

With great video cards comes great power consumption.
evlew
Sr. Member
****
Offline Offline

Activity: 406
Merit: 250



View Profile
July 15, 2011, 04:27:39 PM
 #4

DrGr33n really came through with linux coin
KJJ really came through with those scripts.
You came through with this guide for those who have a hard time with this sort of stuff.
I can confirm this setup works great.  Although I am still on old version of linuxcoin I have been running stable and overclocked for a couple weeks now since implementing.

Maybe you should add a section for SmartCoin for the benefit of redundancy of pools.  That's something I haven't gotten around to yet, and would love a cut and dry guide for it.  I'm sure it's not hard, but I'm sure it can be cleaned up a bit.


Thanks to DrGr33n, KJJ, and Yanz
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 16, 2011, 01:27:15 AM
 #5

I actually haven't tried SmartCoin yet but if I do I'll make another guide too.

With great video cards comes great power consumption.
tysat
Legendary
*
Offline Offline

Activity: 966
Merit: 1004


Keep it real


View Profile
July 16, 2011, 03:20:39 AM
 #6

Quote
user@linuxcoin:/opt/miners/phoenix$ ./phoenix.py -u http://my_user:my_pass@pit.deepbit.net:8332 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=0 WORKSIZE=256
Traceback (most recent call last):
  File "./phoenix.py", line 123, in <module>
    miner.start(options)
  File "/opt/miners/phoenix/Miner.py", line 75, in start
    self.kernel = self.options.makeKernel(KernelInterface(self))
  File "./phoenix.py", line 112, in makeKernel
    self.kernel = kernelModule.MiningKernel(requester)
  File "kernels/phatk/__init__.py", line 132, in __init__
    platforms = cl.get_platforms()
pyopencl.LogicError: clGetPlatformIDs failed: platform not found khr

So when I try to start my miners I get the above error.  Any ideas?
triforcelink
Member
**
Offline Offline

Activity: 112
Merit: 10



View Profile
July 16, 2011, 03:52:30 AM
 #7

Oh wow, just in time! I'm moving all my mining gear to another room and in the process i wanted to make it all headless. thanks for this!

max in montreal
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500


View Profile
July 16, 2011, 07:04:58 AM
 #8

Quote
8. Make the file and/or folders /home/user/.config/autostart/auto.desktop and add the following contents:


Code:
[Desktop Entry]
Encoding=UTF-8
Name=coin
Exec=lxterminal --command "sh /home/user/start.sh"
Terminal=true
when doing this step and saving the file as auto.desktop and closing leafpad, the file is now called coin. Is this how it is supposed to be?
checkmate
Newbie
*
Offline Offline

Activity: 57
Merit: 0


View Profile
July 16, 2011, 09:06:51 AM
 #9

I have a question, since you seem to have some knowledge about Linux:

Are there noticeable differences in speed to Win7?
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 16, 2011, 09:31:52 AM
 #10

Quote
user@linuxcoin:/opt/miners/phoenix$ ./phoenix.py -u http://my_user:my_pass@pit.deepbit.net:8332 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=0 WORKSIZE=256
Traceback (most recent call last):
  File "./phoenix.py", line 123, in <module>
    miner.start(options)
  File "/opt/miners/phoenix/Miner.py", line 75, in start
    self.kernel = self.options.makeKernel(KernelInterface(self))
  File "./phoenix.py", line 112, in makeKernel
    self.kernel = kernelModule.MiningKernel(requester)
  File "kernels/phatk/__init__.py", line 132, in __init__
    platforms = cl.get_platforms()
pyopencl.LogicError: clGetPlatformIDs failed: platform not found khr

So when I try to start my miners I get the above error.  Any ideas?
Hmm... Seems like something isn't installed right. Is this a stock LinuxCoin install? Mine worked right away

With great video cards comes great power consumption.
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 16, 2011, 09:33:25 AM
 #11

Quote
8. Make the file and/or folders /home/user/.config/autostart/auto.desktop and add the following contents:


Code:
[Desktop Entry]
Encoding=UTF-8
Name=coin
Exec=lxterminal --command "sh /home/user/start.sh"
Terminal=true
when doing this step and saving the file as auto.desktop and closing leafpad, the file is now called coin. Is this how it is supposed to be?

I made mine using nano and I didn't notice. Now that I check apparently that's how it's supposed to be.

With great video cards comes great power consumption.
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 16, 2011, 09:35:12 AM
 #12

I have a question, since you seem to have some knowledge about Linux:

Are there noticeable differences in speed to Win7?
I'm not sure, I moved to Linux because it's so much more reliable. My windows machines kept crashing/BSODing. Like twice a day. It got really annoying. Ask around on the forum I guess.

With great video cards comes great power consumption.
jondecker76
Full Member
***
Offline Offline

Activity: 238
Merit: 100


View Profile
July 16, 2011, 03:11:39 PM
 #13

I think the watchdog may need a little work.

The most common lockup that you will find is when a card locks up due to instability from too aggressive of an overclock.  When this happens, aticonfig will return 99% load, even though the card is essentially dead and not doing anything

(in fact, I don't think I've ever seen a GPU go below 50% in any case other than A) purposefully  throttling the card or B) when the card hits high temperature limit and throttles its self down for protection. - in either case, a restart of the miner wouldn't really be doing much)

RollerBot Advanced Trading Platform
https://bitcointalk.org/index.php?topic=447727.0
BTC Donations for development: 1H36oTJsi3adFh68wwzz95tPP2xoAoTmhC
evlew
Sr. Member
****
Offline Offline

Activity: 406
Merit: 250



View Profile
July 16, 2011, 09:05:36 PM
 #14

I think the watchdog may need a little work.

The most common lockup that you will find is when a card locks up due to instability from too aggressive of an overclock.  When this happens, aticonfig will return 99% load, even though the card is essentially dead and not doing anything

(in fact, I don't think I've ever seen a GPU go below 50% in any case other than A) purposefully  throttling the card or B) when the card hits high temperature limit and throttles its self down for protection. - in either case, a restart of the miner wouldn't really be doing much)

simple solution.  Back your overclocks to a stable speed and reap the reward and not worrying about your rigs.  the benefit of rigs not locking up is well worth the 2-5% performance hit from an extreme overclock.

I run a pretty decent overclock (past bios limit) and this config works great for me.  results may vary for others, but i suggest trying it before presenting hypothetical situations.

besides when one of my cards locks up it freezes the whole machine, in which case i doubt the script is of any use.  point being... find a stable overclock.
checkmate
Newbie
*
Offline Offline

Activity: 57
Merit: 0


View Profile
July 17, 2011, 11:02:03 AM
 #15

I have a question, since you seem to have some knowledge about Linux:

Are there noticeable differences in speed to Win7?
I'm not sure, I moved to Linux because it's so much more reliable. My windows machines kept crashing/BSODing. Like twice a day. It got really annoying. Ask around on the forum I guess.

Well, then there's no need for me to switch, since my Win7 rig is working for five days already and never crashed so far...
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 17, 2011, 01:10:38 PM
 #16

I have a question, since you seem to have some knowledge about Linux:

Are there noticeable differences in speed to Win7?
I'm not sure, I moved to Linux because it's so much more reliable. My windows machines kept crashing/BSODing. Like twice a day. It got really annoying. Ask around on the forum I guess.

Well, then there's no need for me to switch, since my Win7 rig is working for five days already and never crashed so far...
Lucky you.

With great video cards comes great power consumption.
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 17, 2011, 01:14:42 PM
 #17

I think the watchdog may need a little work.

The most common lockup that you will find is when a card locks up due to instability from too aggressive of an overclock.  When this happens, aticonfig will return 99% load, even though the card is essentially dead and not doing anything

(in fact, I don't think I've ever seen a GPU go below 50% in any case other than A) purposefully  throttling the card or B) when the card hits high temperature limit and throttles its self down for protection. - in either case, a restart of the miner wouldn't really be doing much)
yeah, pretty much what evlew said: unstable is...well not stable. I think you get better returns from a stable overclock.
Though I am working on a hardware watch dog to monitor my machines. I'll post a guide once I get it working..

With great video cards comes great power consumption.
jondecker76
Full Member
***
Offline Offline

Activity: 238
Merit: 100


View Profile
July 17, 2011, 02:36:02 PM
 #18

Oh, don't worry about me -  I personally don't overclock to the point of instability. But, as a software author, a majority of my support questions and problems revolve around users that overclock too aggressively, which is why I know quite a bit about the problem.
My only point was, that the software watchdog really doesn't do much, as it A) doesn't help a system made unstable from aggressive overclocking, and B) I know of no reasons other than what I posted that would cause a GPU to go below 50% load. (I.e. restarting a miner that is purposely throttled will have no positive outcome, restarting a miner that went low load because of overtemp will have no positive outcome, and restarting a miner pointed to a ddos'd pool will have no positive outcome)
Perhaps there is more reasons to have a software watchdog than I'm thinking of?

RollerBot Advanced Trading Platform
https://bitcointalk.org/index.php?topic=447727.0
BTC Donations for development: 1H36oTJsi3adFh68wwzz95tPP2xoAoTmhC
Yanz (OP)
Full Member
***
Offline Offline

Activity: 133
Merit: 100


View Profile
July 18, 2011, 07:27:12 AM
 #19

Oh, don't worry about me -  I personally don't overclock to the point of instability. But, as a software author, a majority of my support questions and problems revolve around users that overclock too aggressively, which is why I know quite a bit about the problem.
My only point was, that the software watchdog really doesn't do much, as it A) doesn't help a system made unstable from aggressive overclocking, and B) I know of no reasons other than what I posted that would cause a GPU to go below 50% load. (I.e. restarting a miner that is purposely throttled will have no positive outcome, restarting a miner that went low load because of overtemp will have no positive outcome, and restarting a miner pointed to a ddos'd pool will have no positive outcome)
Perhaps there is more reasons to have a software watchdog than I'm thinking of?
Well it's not designed to solve problem A so its moot. Problem B: Solves "Miner is idle" messages, and miner crashing (ie command window disappears, process dies)

With great video cards comes great power consumption.
digger
Sr. Member
****
Offline Offline

Activity: 322
Merit: 250


View Profile WWW
July 18, 2011, 10:59:12 PM
 #20

can the cron job work?


when I setup the cronjob  and added a debug info

echo "miner1->$pc $ld" >>  /home/user/cron_job.log

the $ld always be blank,  it seems "aticonfig --odgc --adapter=1" can;t been run at cronjob?

doge pool: http://dog.ltcoin.net ,yac pool: http://yac.ltcoin.net ,bbq pool: http://bbq.ltcoin.net ,Litecoin pool, http://ltcoin.net dig feathercoin , http://fc.ltcoin.net bitbar pool: http://btb.ltcoin.net wdc pool: http://wdc.ltcoin.net
Pages: [1] 2 3 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!