Mine Litecoin (LTC) with cgminer instructions
This won't use BAMT's startup scripts yet. Actually I know how to make that work, but if you install CGminer 2.6.x on BAMT 0.5c and tell BAMT to load it, it glitches and stops the mining constantly, and we need to update CGminer to run Litecoin, making BAMT work properly requires a bit of extra massaging, but I will try get that perfected this week.
Update! See the new Lazy Litecoin section!For now, this takes BAMT and turns it into a regular linux box, but it does still report somewhat to mgpumon and it is super easy to setup and use. You just have to start it manually.
Let's pretend this is a fresh bamt 0.5c.
login as user
password live
sudo passwd root
[enter your new pass]
[enter your new pass again]
suNow do some fixer!
Update: I discovered that fix #20 is the fix that causes newer-version CGMiner to go into a restart loop. Avoid fix #20 like the plague! But even if you install fix #20, the following script will be unaffected, but it's just knowing this now I can make the bamt scripts to work and the following script will be updated soon enough.
/opt/bamt/fixerNow enter this:
Click here to check out the new script that updates CGMiner and includes a script to start ltc mining by typing "ltc" anywhere in the OS.cd /tmp
wget http://www.bitcointrading.com/files/bamt/updatecgminerlitecoin.sh
chmod u+x updatecgminerlitecoin.sh
./updatecgminerlitecoin.sh
Which contains: (but don't paste this in because it's already in the previous step, i'm just pasting the scripts' contents)
#!/bin/bash
mine stop
cd /usr/share
wget http://ck.kolivas.org/apps/cgminer/2.6/cgminer-2.6.1.tar.bz2
tar xvfj cgminer-2.6.1.tar.bz2
cd cgminer-2.6.1/ADL_SDK
wget http://download2-developer.amd.com/amd/GPU/zip/ADL_SDK_4.0.zip
unzip ADL_SDK_4.0.zip
cd include
mv adl* ..
cd /opt
tar xf /opt/AMD-APP-SDK-v2.4-lnx32/icd-registration.tgz
ln -s /opt/AMD-APP-SDK-v2.4-lnx32/include/CL /usr/include
ln -s /opt/AMD-APP-SDK-v2.4-lnx32/lib/x86/* /usr/lib/
ldconfig
cd /usr/share/cgminer-2.6.1
./autogen.sh
CFLAGS="-O2 -Wall -march=native -I/opt/AMDAPP/include" LDFLAGS="-L/usr/lib" ./configure --enable-scrypt
make
cd /opt/miners
mkdir cgminer_backup
cd cgminer
cp * ../cgminer_backup/
cd /usr/share/cgminer-2.6.1
cp -r * /opt/miners/cgminer
syncNow cgminer is ready to mine Litecoin.
I will update this when I can make BAMT start up cgminer 2.6.x but for now, you can pretty much leave bamt.conf alone for now.
I just noticed that if you enable the cards in bamt.conf (disabled: 0) and put cgminer: 1 on the cards, the # of shares gets passed through to gpumon, even if at the top of your bamt.conf it has cgminer: 0You are going to need a conf for cgminer now. The default location for the conf is /root/.cgminer/cgminer.conf, so creating one there is ideal so you don't need to specify it's location. Apparently nano doesn't like saving to a folder that doesn't exist, so first creating the folder then creating the file works.
cd /root
mkdir .cgminer
nano /root/.cgminer/cgminer.confNow paste in your conf. Here is one to get you started, tune it to your specifications. I'll post confs for different setups in the near future, but this is what I use for 3x 5850s:
{
"pools" : [
{
"url" : "http://litecoinpool.org:9332/",
"user" : "maplesyrupghost.user",
"pass" : "pass"
},{
"url" : "http://lc.ozco.in:9332/",
"user" : "maplesyrupghost.user",
"pass" : "pass"
}
]
,
"intensity" : "15,15,15",
"worksize" : "256,256,256",
"kernel" : "scrypt,scrypt,scrypt",
"gpu-engine" : "620-725,620-725,620-725",
"gpu-fan" : "20-85,20-85,20-85",
"gpu-memclock" : "1000,1000,1000",
"gpu-memdiff" : "0,0,0",
"gpu-powertune" : "0,0,0",
"gpu-vddc" : "0.000,0.000,0.000",
"lookup-gap" : "2,2,2",
"shaders" : "1440,1440,1440",
"temp-cutoff" : "95,95,95",
"temp-overheat" : "85,85,85",
"temp-target" : "82,82,82",
"api-listen" : true,
"api-port" : "4028",
"expiry" : "120",
"gpu-dyninterval" : "7",
"gpu-platform" : "0",
"gpu-threads" : "1",
"log" : "5",
"queue" : "1",
"retry-pause" : "5",
"scan-time" : "60",
"scrypt" : true,
"temp-hysteresis" : "3",
"shares" : "0",
"load-balance" : true,
"kernel-path" : "/usr/local/bin"
}Then hit
CTRL+o to save.
Increase the intensity and see if you can get some more power out of it, but I think 15 you will find yourself pretty close to your maximum. Also some people report higher hashrates when their GPUs are really highly clocked, but absolute bone stock GPUs will definitely maximize your speeds. Litecoin is about memory, not GPU clock.
Now that the conf is in place, you can start the mining. A little advice on screen, you can just type "
screen" and it starts a screen session, or if you use the -q flag it starts it quietly (doesn't show the message screen), so "
screen -q" is key. Then in screen, you can type "
exit" to leave screen or do
CTRL+a,d (hold CTRL, press "a", let go of CTRL, press "d" and it will take that screen session and detach from it, so you can start cgminer and then close your window without the mining stopping.
So when you boot up your rig and it's just sitting there waiting idle, you can paste in this:
cd /opt/miners/cgminer
export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
screen -q
./cgminer --auto-fan --auto-gpuNow that we have it running.
Press
CTRL+a,d to detach from your screen.
If you want to reattach, press
screen -r, if there are more than one screens running, you need to specify the PID. To find the PID, enter:
screen -lsThis shows you if there are any screens running, if you see one like 13091.cgminer, then type:
screen -r 13091And it will tell you what cgminer is up to.
Type 'gpumon' and you should see it start mining. If the api fails to connect to BAMT, sometimes it takes a minute for it to show up.
Refer to the
official cgminer scrypt readme for more tuning advice.
Update For The Lazy!
I'm too lazy to make BAMT work the way we want, but I can make our lives easier.
We will make a Litecoin mining startup script and alias it.
Edit Jan 5th 2013: I did some work and made this even lazier. I'm new to linux (1 year) but damn, I love how simple and effective bash scripting is. This is the most lazy I could make it:
Do this:
wget http://www.bitcointrading.com/files/bamt/lazy_litecoin_lazier.sh
chmod u+x lazy_litecoin_lazier.sh
./lazy_litecoin_lazier.shThat will grab this fancy new script and execute it. It will set up the aliases and put the mining starter in the directories. Now, if you want to customize the script instead of running it at defaults, simply
wget it and then
nano edit it and make the changes you desire. I made the script have all the variables at the top so you can easily change them without even looking at the rest of the code.
This is the contents of the script (but don't execute this if you already ran it in the previous step!):
#!/bin/bash
#
# BitcoinTrading.com Lazy Litecoin Script January 5th 2013 Edition
#
# If you want to change the paths of the scripts, you can do so by changing
# the variables at the start, as well as your cgminer options and directory.
#
# Yo dawg, I hear you like scripts so we put a script in your script
# so you can script while you script!
#
# You can just leave this at default settings, it'll work great, but I made it
# easier to customize.
#
echo '
***** Starting the BitcoinTrading.com Lazy Litecoin script! *****'
scriptfolder="/opt/bamt/"
script1="start_mining_litecoin.sh"
script2="litecoin_starter.sh"
cgmineropts="--auto-fan --auto-gpu --api-listen"
cgminerdir="/opt/miners/cgminer"
echo '#!/bin/bash' >> $scriptfolder$script1
echo '# BitcoinTrading.com Lazy Litecoin Start Script' >> $scriptfolder$script1
echo "cd $cgminerdir" >> $scriptfolder$script1
echo 'export DISPLAY=:0' >> $scriptfolder$script1
echo 'export GPU_USE_SYNC_OBJECTS=1' >> $scriptfolder$script1
echo 'export GPU_MAX_ALLOC_PERCENT=100' >> $scriptfolder$script1
echo "./cgminer $cgmineropts" >> $scriptfolder$script1
chmod u+x $scriptfolder$script1
echo '#!/bin/bash' >> $scriptfolder$script2
echo '# BitcoinTrading.com Lazy Litecoin Start Script' >> $scriptfolder$script2
echo 'echo "Litecoin screen about to start."' >> $scriptfolder$script2
echo "screen -dmS LTCScreen $scriptfolder$script1" >> $scriptfolder$script2
echo 'echo "Litecoin screen session started."' >> $scriptfolder$script2
chmod u+x $scriptfolder$script2
# Put our aliases in bashrc...
echo "# Start of lines added by BitcoinTrading.com Lazy Litecoin Script:" >> /root/.bashrc
echo "alias ltc='cd $scriptfolder;./$script2'" >> /root/.bashrc
echo "alias noltc='killall screen'" >> /root/.bashrc
echo "# End of lines." >> /root/.bashrc
echo '
***** All done! Yay! *****
'Isn't that pretty? I am going to throw a few more comments in there but right now it does exactly what it did before except instead of you doing 10 steps to make your life easier, you now only have to do 1 step. You will need to restart your computer for the aliases to take effect.
Update! I conjoined the previous 'updatecgminerlitecoin' script with the lazy Litecoin script into one easy script!
To install it all at once:
cd /tmp
wget http://www.bitcointrading.com/files/bamt/updatecgminerlitecoinandlazy.sh
chmod u+x updatecgminerlitecoinandlazy.sh
./updatecgminerlitecoinandlazy.sh And it will do everything.
Now when you type '
ltc' anywhere, it will start the starter in a screen session silently. You'll hear your cards spin up, but it's all you need to know. That will also alias '
noltc' to kill all screens. Not pretty but it works. You will have to restart the system for it to take effect.
Want to see how things are doing?
screen -r would work, if there are multiple screens, use:
screen -r LTCScreenand of course, use CTRL+a,d to exit that screen.
If there are multiple LTCScreens... Kill them all!!!
noltc and start over. It works pretty responsively, actually I find it works better than bamt taking care of things.
You could also have multiple cgminers installed in different directories, say if you wanted a different setup for mining solo, you could alias that differently with a separate command.
Okay I think I have solved both the init problems and the system dying after awhie.
I don't know exactly why, but sometimes my cgminer dies. On all my systems. Like it just straight up shuts off, then the system is sitting idle for who knows how long. And with Litecoin difficulty so low, and my equipment so crazy, a day of downtime hurts!
So here's what I have come up with.
1.) A script to check if cgminer is working every X minutes, if it is, exit, if not, start cgminer.
2.) A script to restart cgminer every Y minutes, in case it is running but not functional.
Okay, so, assuming you have installed the Lazy stuff above, you have 2 scripts there, litecoin_starter.sh and start_mining_litecoin.sh (I should REALLY get some different names for those but meh, seems to do the trick!).
So litecoin_starter.sh starts start_mining_litecoin.sh (cgminer) in a screen silently. So we need something to start litecoin_starter.sh for us.
So we have a third script.
I'll integrate this into the lazy thing later, right now you have to create it.
Make a new file:
cd /opt/bamt/
nano iscgminerrunning.shPaste in:
#!/bin/bash
if pidof -x cgminer > /dev/null
then
echo "cgminer already running."
exit 1
fi
screen -dmS LTCScreen /opt/bamt/litecoin_starter.sh(this is assuming you kept your paths at the default settings in my above script)
Then chmod it:
chmod u+x iscgminerrunning.shNow when you run that script, it will say cgminer is running or it will start cgminer. Pretty snazzy.
Make sure you are logged in as root, then execute:
crontab -eThen it brings up the cron editor, paste in this line after all the comments:
*/2 * * * * /opt/bamt/iscgminerrunning.sh >/dev/null 2>&1This will check every 2 minutes (change the '/2' to whatever you want for minutes) if cgminer is running.
The >/dev/null part of it will write the echoing to nowhere, so you don't end up with 10 million lines of errors in unsent mail queue!
Now what about restarting cgminer once in awhile?
I think we can just use our 'killall screen' command from earlier, since it is a built-in function.
So edit the crontab again (crontab -e) and paste in (at the end):
* */6 * * * killall screenWill kill cgminer every 6 hours. Then your other cron will restart it automatically. You could use:
* * */2 * * killall screen # kill it every 2 days
* * */1 * * killall screen # kill it every day
Pretty sure that would work out okay. Will let you know!

Last update: Feb 2nd, '13