Litecoin
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 && apt-get upgrade
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 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
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/xinit 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
r00t@miner1:/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
r00t@miner1:/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 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
r00t@miner1:/etc/mining$ cd cgminer-3.7.2-x86_64-built r00t@miner1:/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.
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/