Litecoin

From r00tedvw.com wiki
Jump to: navigation, search

Contents

Disclaimer

The below guide is for personal reference. If anyone other than the author uses it, it is at their own risk. Nothing in here describes anything about security, so that's up to you to figure out and prevent all your virtual currency from being stolen.

You've been warned

Install OS and software

If this is a dedicated mining box, install Ubuntu Server 12.04 LTS (latest LTS version at the time of this writing, supported until 04/2017)

http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso

Install ssh during the Operating system install

update and upgrade all packages on your system

sudo apt-get update && sudo apt-get upgrade -y

install needed tools

sudo apt-get install -y build-essential gcc make cmake mc python-dev subversion git bzip2 unzip xorg

xorg needs to be installed before the amd packages are downloaded and installed otherwise you will get errors citing that apt-get cannot create symlinks to files that dont exist
install the AMD/ATI drivers and software

sudo apt-get install -y fglrx-updates fglrx-amdcccle-updates fglrx-updates-dev

Begin Configuration

configure xorg for the video cards

sudo aticonfig --lsa
sudo aticonfig --adapter=all --initial

reboot for settings to apply

sudo reboot


xinit script

On the server edition if you try to run sudo aticonfig --adapter=all --odgt at this point, you'll get an error:

ERROR - X needs to be running to perform AMD Overdrive(TM) commands

To correct this, we need to create a startup script to get X initialized. I did the following:

1. create a file in my mining folder and paste the script
~$sudo mkdir /etc/mining
~$nano /etc/mining/xinit

#!/bin/bash
# standard functions library
. /lib/lsb/init-functions
# Start the xinit
start() {
        # Start xinit on background and redirect stdout and stderr to log file
        echo "Starting xinit"
        xinit &> /var/log/xinit.log &
}
# Restart the xinit
stop() {
        echo "Stopping xinit"
        killall xinit
}
### main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status xinit
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac
exit 0
2. with the script created, next is to set executable permissions and add it to init.d for easy auto start and managing
sudo chmod +x /etc/mining/xinit
sudo ls -s /etc/mining/xinit /etc/init.d/
sudo update-rc.d xinit defaults 90
sudo /etc/init.d/xinit start
While the above works, I have not found it to be 100% reliable. Sometimes I will still get the error about X not running, so I added a line to launch it during the litecoin mining script we'll create later.
3. run a couple more config settings which will also be present in the litecoin mining script we'll create later
export DISPLAY=:0
echo export DISPLAY=:0 >> ~/.bashrc
4. test to see if aticonfig now shows card results without complaining about X not running
[email protected]:/etc/mining$ sudo aticonfig --adapter=all --odgt
[sudo] password for r00t: 

Adapter 0 - AMD Radeon HD 6800 Series 
            Sensor 0: Temperature - 89.00 C

Adapter 1 - AMD Radeon HD 6800 Series 
            Sensor 0: Temperature - 73.00 C

Test to see if the video adapters are properly initialized

[email protected]:/etc/mining$ fglrxinfo
display: :0  screen: 0
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon HD 6800 Series 
OpenGL version string: 4.2.12217 Compatibility Profile Context 12.104



display: :0  screen: 1
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon HD 6800 Series 
OpenGL version string: 4.2.12217 Compatibility Profile Context 12.104

CGMiner download and config

Before I could run cgminer, I was getting errors that I had to fix:

./cgminer: error while loading shared libraries: libudev.so.1: cannot open shared object file: No such file or directory

Added the following symlinks to fix it:

sudo ln -s /usr/local/lib/libjansson.so.4 /usr/lib/libjansson.so.4
sudo ln -s /lib/x86_64-linux-gnu/libudev.so.0 /lib/x86_64-linux-gnu/libudev.so.1

Download cgminer 3.7.2 and unzip (last version that has GPU support since the author says GPU mining is dead due to ASIC miners and such)

wget http://ck.kolivas.org/apps/cgminer/3.7/cgminer-3.7.2-x86_64-built.tar.bz2
if the above link is dead cgminer-3.7.2.tar.bz2 may work, but you will need to make it yourself.
alternatively, grab a copy from another trustworthy source (i did from an old mining setup)
tar jxvf cgminer-3.7.2-x86_64-built.tar.bz2

Check to see if cgminer can see your video cards, should be an output like such

[email protected]:/etc/mining$ cd cgminer-3.7.2-x86_64-built
[email protected]:/etc/mining/cgminer-3.7.2-x86_64-built$ ./cgminer -n
./cgminer: /lib/x86_64-linux-gnu/libudev.so.1: no version information available (required by ./cgminer)
 [2014-01-13 01:44:11] CL Platform 0 vendor: Advanced Micro Devices, Inc.                    
 [2014-01-13 01:44:11] CL Platform 0 name: AMD Accelerated Parallel Processing                    
 [2014-01-13 01:44:11] CL Platform 0 version: OpenCL 1.2 AMD-APP (1124.2)                    
 [2014-01-13 01:44:11] Platform 0 devices: 2                    
 [2014-01-13 01:44:11] 	0	Barts                    
 [2014-01-13 01:44:11] 	1	Barts                    
 [2014-01-13 01:44:11] GPU 0 AMD Radeon HD 6800 Series  hardware monitoring enabled                    
 [2014-01-13 01:44:11] GPU 1 AMD Radeon HD 6800 Series  hardware monitoring enabled                    
 [2014-01-13 01:44:11] 2 GPU devices max detected                    
 [2014-01-13 01:44:11] USB all: found 2 devices - listing known devices                    
 [2014-01-13 01:44:11] No known USB devices

Create a litecoin mining script

Now we create the litecoin mining script that I mentioned earlier. This section will probably change as right now I have it relying on sudo to start, which I dont want and would rather it start automatically with the system boot. However, it's functional.
In your CGMiner directory, create a script. Keep in mind, my script is for Dual (2) 6870s, you may need to adjust your cgminer settings to get the best results. In this, you see that I call upon the xinit script we created earlier, this is because I've launched the xinit script 10 minutes prior to mining and had issues because it had stopped running by then. Figured I'd just add this to make sure it's running before I start mining.

nano mine_litecoins.sh
#!/bin/sh
export DISPLAY=:0
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
/etc/init.d/xinit start
cd /etc/mining/cgminer-3.7.2-x86_64-built
#./cgminer --scrypt -I 18,18 -w 64,64 --thread-concurrency 6720,6720 --gpu-engine 900 --gpu-memclock 1050 --auto-fan --temp-target 60 -o stratum+tcp://america.mine-litecoin.com -u [username] -p [password]
#./cgminer --scrypt --worksize 256,256 --thread-concurrency 7040,7040 --vectors 4,4 --gpu-threads 2 -I 18,18 -g 1 --auto-fan --auto-gpu --temp-target 60 -o stratum+tcp://usa-1.liteguardian.com:3334  -u [username] -p [password]
./cgminer --scrypt -I 18,18 -w 64,64 --thread-concurrency 6720,6720 --gpu-engine 900 --gpu-memclock 1050 --auto-fan --temp-target 60 -o stratum+tcp://usa-1.liteguardian.com:3334 -u [username] -p  [password] --failover-only -o stratum+tcp://eu-1.liteguardian.com:3334 -u [username] -p [password]

Make the script executable

sudo chmod +x mine_litecoins.sh

Mine Coins!

Here's the moment of truth:

sudo /etc/mining/cgminer-3.7.2-x86_64-built/mine_litecoins.sh

You should be presented with a screen that looks like this:

cgminer version 3.7.2 - Started: [2014-01-13 00:46:57]
--------------------------------------------------------------------------------
 (5s):587.8K (avg):602.7Kh/s | A:23392  R:128  HW:0  WU:521.3/m
 ST: 2  SS: 0  NB: 24  LW: 346  GF: 0  RF: 0
 Connected to usa-1.liteguardian.com diff 128 with stratum as user atlantonius.2
 Block: c44b4804...  Diff:3.89K  Started: [01:31:37]  Best share: 51.8K
--------------------------------------------------------------------------------
 [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit
 GPU 0:  90.0C 4806RPM | 301.4K/301.7Kh/s | A:11744 R:128 HW:0 WU: 277.4/m I:18
 GPU 1:  73.0C 4410RPM | 301.4K/301.7Kh/s | A:11648 R:  0 HW:0 WU: 243.9/m I:18
--------------------------------------------------------------------------------

 [2014-01-13 01:30:28] Accepted 01451766 Diff 202/128 GPU 0 pool 0
 [2014-01-13 01:30:35] Accepted 910756d9 Diff 452/128 GPU 0 pool 0
 [2014-01-13 01:30:48] Accepted 0169793a Diff 181/128 GPU 1 pool 0
 [2014-01-13 01:31:02] Accepted 011779fb Diff 234/128 GPU 0 pool 0
 [2014-01-13 01:31:08] Accepted 58b80493 Diff 739/128 GPU 0 pool 0
 [2014-01-13 01:31:10] Stratum from pool 0 detected new block
 [2014-01-13 01:31:28] Accepted 01bded65 Diff 147/128 GPU 0 pool 0
 [2014-01-13 01:31:32] Accepted 013a06f3 Diff 209/128 GPU 0 pool 0
 [2014-01-13 01:31:37] Stratum from pool 0 detected new block
 [2014-01-13 01:32:19] Accepted 0242037e Diff 29K/128 GPU 0 pool 0

Closing

I'll be updating this with more information in the future, like how to autostart everything upon system boot, how to ssh in and check to see how its doing, etc. All that information is already out there, but I haven't done it yet so I know nothing about it.

In the examples above, you'll notice that the GPU temps are pretty high, 90C. As a rule of thumb both for performance and longevity, you don't want your GPUs surpassing 70-75C. This will generally require you to do a few things, especially if you're running the multiple video cards in one system, directly in their slots (not using risers), and have the case closed. I'm not entire sold on the open air design that most go with as I think I can get results that as just as good if I design the airflow properly and with positive pressure (which forces the heat out).

  • closed case needs positive pressure
  • Good thermal paste - stock thermal paste always sucks (if you think otherwise, you're fooling yourself)
  • lapped heatsink - if you have the time, allows better contact and likewise heat transfer.
  • airflow within case should be thought out and have the least amount of obstructions as possible.


At the time of this writing, the case I had the cards in was not thought out at all, I was just trying to get everything working. It's currently in a 4U case sitting in a 42U rack on the bottom with nothing below it. just by taking the case cover off, temps drop to 65C - 75C, so there is definite room for improvement.

References

http://www.cryptobadger.com/2013/04/build-a-litecoin-mining-rig-linux/
http://infi.wikidot.com/blog:1
https://www.weminecryptos.com/forum/topic/1024-cgminer-error-while-loading-shared-libraries-libudevso1-cannot-open-shared-object-file-no-such-file-or-directory/

Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Ubuntu
Oracle Linux
AWS
Windows
OpenVPN
Grafana
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
MetaSploit
Zoneminder
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
Toolbox