Monday, September 26, 2011

Finally, cgminer install tutorial

I think that cgminer is the most advanced miner to date.  It doesn't push the hardware as far as I would like (it doesn't use 100% of the GPU) but it can manage multiple pool and use the longpoll from the fastest pool, so you will have a better mining uptime with this miner than with the other! I never experienced any "queue empty, miner is idle" with this miner.  Today the bitcoin value is 5$ so you need to get every hash as possible! The little drawback is that I was not yet successfull to make cgminer to use 99% of each gpu.

But, cgminer can set the fan, the clock and even overclock your GPU.  This is very nice!

So let's begin!

1. To manage your gpu fanspeed and clocking, you will need the ADL SDK (AMD Display Library)
- http://developer.amd.com/sdks/adlsdk/pages/default.aspx


2. Install missing softwares
$ sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm libtool

3. get the latest cgminer sourcecode :
$ git clone git://github.com/ckolivas/cgminer.git cgminer

4. enable ADL (control of the inner functions of the gpu like clocking, voltage, fan speed...)
$ mkdir ADL_SDK
$ cd ADL_SDK
$ mv ../ADL_SDK_3.0.zip .
$ unzip ADL_SDK_3.0.zip
$ cp include/* ../cgminer/ADL_SDK

5. Compilation
$ cd cgminer

$ ./autogen.sh
$ CFLAGS="-O2 -Wall -march=native -I /opt/AMDAPP/include/" LDFLAGS="-L/opt/AMDAPP/lib/x86_64" ./configure

if you get the following error :
/usr/bin/ld: cgminer-adl.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: note: 'dlclose@@GLIBC_2.2.5' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libdl.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libdl.so: could not read symbols: Invalid operation

remove the ADL directory, you must disable ADL.


! be sure the GPU and ADL are enabled !

$ make

6. Testing (to see the number of gpu the software sees)
$ export DISPLAY=:0   #(use this command only if you have more than one card)
$ ./cgminer -n


If the number does not represent the number of gpu you own, there is a problem, you should have miss a step.  Or the git repository could be broken.  Try an older tag here : https://github.com/ckolivas/cgminer/tags

7. be up to date!
$ stop the miner
$ cd ~/cgminer
$ git pull
and then recompile (follow the step 5)


There is a lot of commands for this software.  The best way to learn is to read the documentation from the git repository, it is one of the best documentation I've read!

Monday, September 12, 2011

the server hang very often. SSH server ok, but no screen

On one of my rig, I experienced failure and a lot of hang.

Everytime, running top on the computer showed me that xorg was taking 100% cpu.

After seeking on the web, I've found a workaround :-) and it fixed the case :

edit the file /etc/X11/xorg.conf

$ sudo /etc/X11/xorg.conf

in the section device of all of your adapters add the line :


Option "UseEvents" "on"
this solved my problem :-)

update : this helped my system to be more reliable, but hanged each two to three days. 
update:  as the 1st of december 2011, my three rigs have 15, 15, 35 days of uptime (one is ups backed).  The problem was the cpu clocking... I would advice to start low and increase until you get unreliability, then decrease to get reliability!

Saturday, September 3, 2011

tried a new miner (cgminer) one word to describe, WOW!

Today, I tried another miner, I liked the phoenix-miner, but this miner is way better!  This miner test different algorithms to see which is better for your hardware, the miner supports multiple card (in the same instance!) is able to wake up an hanged thread, uses multi pool ( round robin, %, fail over ) ...  the only thing I can say is WOW!  The software is written in C and asm and does not need python-pyopencl ! Good new!

The miner is built from the same guy that did the linux scheduler.  cgminer is my new main miner!

Today, following an ubuntu update, one of my mining rig died (xorg hanged 10 times) I will do some manipulation tomorrow to correct this.  I don't know if I will have to reinstall ubuntu (probably not but I don't know!)  Keep that in mind if you plan to start mining...  You will encounter bugs, and each bugs mean downtime and less bitcoin in your wallet!

Tomorrow I will write a small tutorial to install cgminer from the git directory.

Stay tuned :-)

Monday, August 29, 2011

ubuntu 11.04/12.04/12.10/13.04 x86_64 dedicated crypto currency (bitcoin, i0coins, solidcoins, namecoins, ixcoins) mining rig using ATI RADEON GPU

update see post : for an update on this procedure, it will be easier for you and it will talk about the newest *buntu releases (13.04)

Yesterday Irene (28 august 2011) came in my region and after a power outage, I have lost an hard disk drive.  Fortunately, the drive is under warranty, but I had to reinstall my mining rig.

Today, I will place each steps to have a mining rig that will start and mine automatically.  Hope you will find this helpfull!  If it was, please consider sending me a small contributions to my bitcoin address : 13sRUwHbmv5ewLjQkKabDTsyPQEDD4v6mx !

It took me 2 days to finally being able to mine. I had to reinstall linux at least 15 times (passing from ubuntu to centos and finally to ubuntu).  But now everything is going fine!

Before starting, I have some comments :
1. remove the more hardware you can from the computer. Anything not used is power loss! Each watt count!
I mean:
- memory (you don't need 2-4gb!)
- cd drive, floppy drive, card reader
- sound card, io cards ...
- some people use a usb key instead a hard disk.  It is a great idea!  I will give it a try some day (linux coins and linux bamt are designed for that).
2. You will need good ventilation, so clean the wiring, add fans and don't forget the air must come in the case, so don't put 3 fans pushing the air outside of the case and leave free air space around the computer (I usually put the computer face against the wall so the hot air will get to the middle of the room).  Some people don't use a case to store their mining rig. One case I like, is the antec three hundred I have 3 5850 and the heat is acceptable inside.  Be carefull when you buy your motherboard, there is chances the last slot won't be available since the power supply is the end of the card (a simple height is OK, but dual height is not).
3. Have a very good power supply!  Pay to get a 80 plus gold rating and get enough wattage (I use the OCZZ850M for my rigs).

You will install the following tools :
- webmin
- apcupsd
- sshd
- pyopencl
- phoenix miner
- poclbm
- x11vnc

So, lets begin and download the ubuntu 11.04 CD. It is a live CD and an installation CD!  I'm a centos fan, but had some issue to mine using it, so now I use ubuntu and it works great, and it is easy to configure. update, I have tried kubuntu. Is is very very very nice. Easier to use than ubuntu with the unity gui. I recommand to switch to kubuntu !

Here is the download link : http://www.ubuntu.com/start-download?distro=desktop&bits=64&release=latest
You only have to burn the iso on a CD.

Then, you start your computer with the CD (boot from the CD) and you select to install.

The install process is very straight forward, so, you only have to press next...

When you will create your user, use a generic user of your choice and select login automatically.

Finish the install and reboot.

Lets begin!

1. Create a password for the root user, I know it is bad, but needed to use Webmin.

Open a terminal and type :
$ sudo passwd root

You will write your user password, then the root password for the root.  Please use a very long password ( a phrase).

2. Install VIM
$ sudo apt-get install vim

3. One ubuntu update seems to break the grub2 (bootloader) timeout, so the computer wait forever for the "enter" key to boot.

$ sudo vi /etc/default/grub
change GRUB_TIMEOUT=10 for GRUB_TIMEOUT="10"
$ sudo update-grub

This solved my problem on 2 computers. But on another, the bootloader does not get displayed and I don't know what is the problem yet.

4. Install missing packages

$ sudo apt-get install subversion git-core

4.1 Install ATI Catalyst

first, start synaptic package manager and remove every ati packages (unless the package is important for ubuntu like ubuntu-desktop) then remove every nvidia packages and finally fglrx.


Download : http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx?type=2.4.1&product=2.4.1.3.42&lang=English


Note:  I already tried the ati catalyst version 11.7 (100%cpu while GPU mining only) and 11.8 (better than 11.7 but high cpu usage (30%-50%)). So I suggest using 11.6.
update: 1st december 2011, I tried the version 11.11, not sure yet for mining, but for everyday usage, this version is VERY NICE!  Every single bug I've found for this usage have been solved! Finally, I have to say: Great job AMD! I will post a new entry for the new version for mining.
Update (2nd august 2012) : The catalyst version 12.3 is incredible ! every single bug were again solved :-)

$ sudo chmod +x amd-driver-installer-12.3-x86.x86_64.run
$ sudo ./amd-driver-installer-12.3-x86.x86_64.run
- select install driver (1)
- agree to the licence (y)
- automatic (y)

if you have multiple adapter, you have to export DISPLAY=:0
$ echo 'export DISPLAY=:0' >> ~/.bashrc

$ sudo aticonfig --initial --adapter=all
This command configure the file /etc/x11/xorg.conf

At this point, you should restart your computer (probably a logout is sufficient) I reboot to be sure the previous step was successfull.

to test, you can : $ aticonfig --list-adapter
moreover you could wish to try: $ fglrxinfo

4.2 ATI Stream install (OpenCL Driver)


You can find the latest driver here :

I recommend downloading the version 2.4 since I did not tested the 2.5.
Update (2nd august 2012), the new version 2.7 rocks!  Low cpu usage and nothing wrong found :-) the best version since version 2.3!

http://developer.amd.com/sdks/AMDAPPSDK/downloads/Pages/default.aspx#one
$ mkdir amdapp_2-7

$ cd amdapp_2-7
$ tar -zxvf ../AMD-APP-SDK-v2.7-lnx64.tgz

$ sudo ./Install-AMD-APP.sh

These steps are no more needed since version 2.5

You have to export an environment variable in your .bashrc
$ echo 'export LD_LIBRARY_PATH=/opt/AMDAPP/lib/x86_64/:$LD_LIBRARY_PATH' >> ~/.bashrc
(everything on the same line)
Then add the library to the ld.so.conf
$ sudo vi /etc/ld.so.conf
add the following line:
/opt/AMDAPP/lib/x86_64
$ sudo ldconfig

reboot :-)

The steps from the point 4 are no more needed if you plan to use cgminer to mine. I strongly suggest to use cgminer, it is the best miner I saw.  It support multiple miner, can do round robin, switch to another pool when the main one fails ...

4.3 python pyopencl

$ wget http://pypi.python.org/packages/source/p/pyopencl/pyopencl-0.92.tar.gz
$ sudo apt-get install libboost-all-dev python-twisted*
$ tar -zxvf pyopencl-0.92.tar.gz
$ cd pyopencl-0.92.tar.gz
$ sudo python ./configure.py --cl-inc-dir=/opt/AMDAPP/include/ --cl-lib-dir=/opt/AMDAPP/lib/x86_64/
$ sudo make
$ sudo make install


4.4 m0mchild's poclbm (facultative step)
$ cd BTC_BASE
$ git clone git://github.com/m0mchil/poclbm.git
$ cd poclbm
$ python poclbm.py
you will see the device available to mine (CPU and GPU)

4.5 my preferred miner, phoenix-miner
$ cd BTC_BASE
$ git clone git://github.com/jedi95/Phoenix-Miner.git

5. Starting to mine!
You will have to chose if you do solo mining or will join a pool.  There is plenty of pool available and you can choose to mine several  crypto currency.  The only thing you have to do is to point to the pool with phoenix.

here is a small list of pool :


Follow the pool documentation for the correct command line.  In the version 1.6.X of phoenix, you can specify the option -b to add a failover pool so if the main pool is hanged, you will switch to another one which is very nice!


6. ATI overdrive
Most (if not all) Radeon have user configurable clock speeds.  Be carefull by doing this, the heat will increase a lot, the power consumption too!

6.1 enable overdrive
$ aticonfig --od-enable --adapter=0

6.2 get current clock
$ aticonfig --odgc --adapter=0


6.3 set new clock
$ aticonfig --odsc=875,900 --adapter=0

6.4 commit changes (if not, the default value will be effective on the next reboot)
$ aticonfig --odcc --adapter=0

6.5 get core temperature
$ aticonfig --odgt --adapter=0

6.6 set fanspeed
$ aticonfig --pplib-cmd "set fanspeed 0 56"


6.6.1 if you have more than one adapter 
$ export DISPLAY=:0.1; aticonfig --pplib-cmd "set fanspeed 0 56"
$ export DISPLAY=:0

note : Adapter mean the adapter chosen. You can use "all"



7. Environment setting for headless mining
7.1 OpenSSH install
$ sudo apt-get install openssh-server openssh-client

7.2 webmin install
add the following lines in the file sources.list
$ sudo vi /etc/apt/sources.list
# webmin
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

add the key from webmin
$ wget http://www.webmin.com/jcameron-key.asc
$ sudo apt-key add jcameron-key.asc
$ rm jcameron-key.asc

$ sudo apt-get update
$ sudo apt-get install webmin

webmin will run on the port 10000, so you only have to point to your ip address with your preferred web browser (probably firefox)

you will use the root username with the password you chose.

7.3 apcupsd
If you plan to add a ups to your rig (which is a very good idea since you paid a lot for those GPU!).  First, before buying the ups, look at the power needed to power up your rig.  One of mine needs 600W, buy a good ups which will be able to give you 2-3 minutes of battery life.

$ sudo apt-get install apcupsd apcupsd-cgi

You have to configure the file apcupsd.conf
$sudo vi /etc/apcupsd/apcupsd.conf
Follow the guide on the apcupsd website.
$sudo vi /etc/default/apcupsd
change ISCONFIGURED to true

$ sudo service apcupsd start

there is an apcupsd module for webmin

open webmin, go to webmin->webmin configuration->webmin modules1
paste the following link : http://diego.caravana.to/wp-content/apcupsd0.812.wbm.gz in the "from ftp or http URL"

The module is in the section other. You have to change some directory, go to the module configuration

change the path for each CGI to : /usr/lib/cgi-bin/apcupsd/*.cgi

7.4 VNC server  (to see the screen for your rig)
$ sudo apt-get install x11vnc vnc-java
$ x11vnc -storepasswd

You can point any java enabled web browser to your ip:5800 to access the computer!

7.5 Remove your screen saver
If you want to have more power to mine :-)

7.6 shutdown on power button
since the computer is headless, it may be necessary to close the computer easily.

7.7 Mining on start
At the startup, you will have to setup the fanspeed and start your miner on each GPU.

I use the following scripts :
#!/bin/sh

cpufreq-selector -g ondemand -c 0
cpufreq-selector -g ondemand -c 1
cpufreq-selector -g ondemand -c 2
cpufreq-selector -g ondemand -c 3

/bitcoin/setfanspeed.sh
gnome-terminal --command "/bitcoin/phoenix-miner/pool.sh" &



#start java vnc
gnome-terminal --command "x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800" &


Go to the gnome menu preferences->startup application and add your script (remove not needed applications!)

8. shutdown
shutdown your computer
8.1 Enter the bios and configure your computer to power on after power failure

8.2 unplug the power cord and plug it in the computer and validate the computer starts
8.3 look to see if your computer mine and PROFIT!

You are done! Happy mining !

If you want to exchange your bitcoins against other currency (US, EUR...) , I suggest you to use tradehill ( http://www.tradehill.com/ ). I tried other exchange site and the only exchange I got real money was tradehill.  Please use my reference number TH-R112979 (you will get 10% lifetime discount on your trade !)

Later, I will procede to update the ATI Catalyst and OpenCL driver, so keep reading to see how we do it!

I'm looking for your comments!

I accept contributions at my address : 13sRUwHbmv5ewLjQkKabDTsyPQEDD4v6mx !
----------
I'm looking for supervision software for headless server, if you can suggest some...
I used part of the following threads :
http://bitcointalk.org/?topic=3356.msg47489#msg47489
http://lifehacker.com/317125/set-up-vnc-on-ubuntu-in-four-steps

Thursday, January 6, 2011

Mediatomb installation

Mediatomb is a very good dnla media server wich works very well with the PS3.

Be sure to have the EPEL and rpmforge repo installed ( view other post )

then, yum install mediatomb

 Edit /etc/mediatomb.conf and place the network interface mediatomb will listen.  ( you will know by doing ifconfig )  Usually, it will be eth0

using ntsysv select the service mediatomb to start on startup.

 then, " service mediatomb start " you should see [ok] .  Else something is wrong.  Google the error message to understand what is going on.

 If you want to load mkv file ( HD ) PS3 won't recognize this format, so mediatomb have to convert this video format.

Add the following lines in the /etc/mediatomb/config.xml
<map from="ts" to="video/mp2t"/>
<map from="m2ts" to="video/mpeg"/>


Add the following package and tools to convert the files.

yum install mkvtoolnix

download http://twocats.free.fr/pub/h264tobox/ tsMuxeR and h264tobox  untar in /usr/local/ (tsMuxeR will not untar in is proper directory)

then softlink tsMuxeR, tsMuxerGUI and h264tobox in /usr/bin/

ln -s /usr/local/tsMuxeR/tsMuxeR /usr/bin/tsMuxeR
ln -s /usr/local/tsMuxeR/tsMuxerGUI /usr/bin/tsMuxeRGUI
ln -s /usr/local/h264tobox-$(ver)/h264tobox /usr/bin/h264tobox

the script h264tobox needs the faad library  ( yum install faad2 )
convert the mkv file.  To do this, start the h264tobox script in the directory the movie is placed,

the software will tell you 
aften, dcadec, oggdec, ogmdemux, ttaenc are missing ( they are optional ), I don't know why they are used, but for now, everything seems to work.

Sunday, January 2, 2011

ps3mediaserver installation

must add 2 repositories :
 rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm ( replace x86_64 for i386 if your system is 32bits ) you can point your web browser to the directory if this is not working.

rpm -ivh http://apt.sw.be/redhat/el5/en/x86_64/dab/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

have to install java
yum install java

have to install mplayer ffmpeg and mencoder

homepage: ps3mediaserver
go to /usr/local/
wget http://ps3mediaserver.googlecode.com/files/pms-generic-linux-unix-1.20.412.tgz

 tar -zxvf pms-generic-linux-unix-1.20.412.tgz

it is necessary to configure the system.  TBD

Only go in /usr/local/pms-linux-1.20.412 and run PMS.sh to start the server.

don't forget to delete the file /usr/local/pms-generic-linux-unix-1.20.412.tgz

webmin installation

source : http://www.webmin.com/rpm.html


1. create a new file in /etc/yum.repos.d/webmin.repo and insert the following :


vi /etc/yum.repos.d/webmin.repo


[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1


2. import the key from webmin
rpm --import http://www.webmin.com/jcameron-key.asc

3. yum install webmin

webmin is now working and ready to help you to configure your system.
This tool is web based and serves on the port 10000 .  Often only in HTTPS, but you have to try both (http, https).


Perhaps, only from localhost.

fresh install centos 5.5

advice : use a logical volume ( LVM ) for the /home directory.
soon after, you should start backuping your system.