/ linux-usb-cgminer
linux-usb-cgminer
  1  How to setup a cgminer using xubuntu 11.04 live on a USB
  2  
  3  The master version of this document is here:
  4   https://github.com/kanoi/linux-usb-cgminer
  5  
  6  The actual file is:
  7   https://github.com/kanoi/linux-usb-cgminer/blob/master/linux-usb-cgminer
  8  
  9  The copy in cgminer (check to make sure it isn't older) is:
 10   https://github.com/ckolivas/cgminer/blob/master/linux-usb-cgminer
 11  
 12  The original old verion on bitcointalk is:
 13   https://bitcointalk.org/index.php?topic=28402.msg426741#msg426741
 14  
 15  ========
 16  
 17  I have said to select English for the install process for 2 reasons:
 18  1) I don't know any other spoken language very well
 19  and
 20  2) I'm not sure what problems installing under a different language
 21  might cause (it will probably cause no problems but I don't know)
 22  
 23  Software
 24  ========
 25  Short hardware comment:
 26  Your mining computer doesn't need any HDD or CD/DVD/BD as long as it has at
 27  least 2GB of RAM, can boot USB, has some network connection to the internet
 28  and of course a reasonable mining ATI graphics card
 29  ... Or you can boot a windows PC with the USB to only do mining ... and ignore
 30  the system HDD ... wasting energy running the HDD (roughly 10 Watts per HDD) :)
 31  
 32  If you wish to install to an HDD instead of a USB,
 33   see the changes to the instructions at the end
 34  
 35  To create the USB, you need of course a 4GB USB and temporarily need a PC
 36  with a CD (or DVD/BD) writer, a USB port and of course an internet
 37  connection to the PC
 38  
 39  1) Download the xubuntu 11.04 desktop live CD iso for amd64
 40     ( look here for mirrors: http://www.xubuntu.org/getubuntu )
 41  
 42  2) Burn it to CD then boot that temporarily on any PC with a CD/DVD/BD and
 43     a USB port (this and the next 2 step won't effect that PC)
 44     Select "English" then select "Try Xubuntu without installing"
 45     and wait for the desktop to appear
 46     (this happens by default if you wait for the timeouts)
 47  
 48  3) Plug in your 4GB USB device and it should appear on the desktop - you can
 49     leave it's contents as long as there is at least 2.8GB free
 50  
 51  4) Now run "Startup Disk Creator" in "Applications->System"
 52     (the system menu is the little rat in the top left corner)
 53  
 54  (if you have no mouse you can get the menu with <ctr><esc> and navigate
 55  the menu with the arrow keys and <return> key)
 56  
 57  From here select the boot CD as the "Source" and the USB as the "Disk to use"
 58  lastly move the slider to 2GB for reserved extra space
 59  
 60  The 2GB should be enough for modifications
 61  
 62  Click: "Make Install Disk"
 63  After about 10-15 minutes you have a base xubuntu 11.04 boot USB
 64  (you can shut down this computer now)
 65  
 66  5) Boot your cgminer PC with this USB stick, select "English"
 67     then select "Try Xubuntu without installing" and wait for the desktop to
 68     appear (this happens by default if you wait for the timeouts)
 69  
 70  6) Start a terminal
 71     "Applications->Accessories->Terminal Emulator"
 72  
 73  7) sudo apt-get install openssh-server screen
 74  
 75     if you have a problem here then it's probably coz the internet isn't
 76     available ... sort that out by reading elsewhere about routers etc
 77  
 78  8) sudo apt-get install fglrx fglrx-amdcccle fglrx-dev
 79     sudo sync
 80     sudo shutdown -r now
 81  
 82  N.B. always do a "sudo sync" and wait for it to finish every time before
 83  shutting down the PC to ensure all data is written to the USB
 84  
 85  9) sudo aticonfig --lsa
 86     this lists your ATI cards so you can see them
 87   sudo aticonfig --adapter=all --odgt
 88     this checks it can access all the cards ...
 89  
 90  10) sudo aticonfig --adapter=all --initial
 91     this gets an error - no idea why but the xorg.conf is OK
 92   sudo sync
 93   sudo shutdown -r now
 94  
 95  11) sudo aticonfig --adapter=all --odgt
 96     this checks it can access all the cards ...
 97  
 98  12) get AMD-APP-SDK-v2.4-lnx64.tgz from
 99   http://developer.amd.com/sdks/amdappsdk/downloads/pages/default.aspx
100    ( http://developer.amd.com/Downloads/AMD-APP-SDK-v2.4-lnx64.tgz )
101  
102   sudo su
103   cd /opt
104    (replace /home/ubuntu/ with wherever you put the file: )
105   tar -xvzf /home/ubuntu/AMD-APP-SDK-v2.4-lnx64.tgz
106  
107   cd AMD-APP-SDK-v2.4-lnx64/
108   cp -pv lib/x86_64/* /usr/lib/
109   rsync -avl include/CL/ /usr/include/CL/
110   tar -xvzf icd-registration.tgz
111   rsync -avl etc/OpenCL/ /etc/OpenCL/
112   ldconfig
113   sync
114   shutdown -r now
115  
116   You now have an OpenCL enabled xubuntu
117  
118  13) cgminer:
119   sudo apt-get install curl
120  
121   get the binary linux cgminer
122   (see the bitcoin forum cgminer thread for where to get it)
123   https://bitcointalk.org/index.php?topic=28402.0
124  
125   ./cgminer -n
126     this shows you the GPU's it found on your PC
127     See further below if you get an error regarding libtinfo.so.5
128  
129  14) An OC option:
130   This is no longer needed since cgminer 2.* includes OC, however:
131  
132   sudo apt-get install libwxbase2.8-0 libwxgtk2.8-0
133  
134   http://sourceforge.net/projects/amdovdrvctrl/
135    for an Over/underclocking application and get the file listed below then:
136   sudo dpkg -i amdoverdrivectrl_1.2.1_amd64.deb
137  
138  15) set the screen saver to ONLY blank ...
139  
140   Move the mouse to the bottom of the screen and you see a set of icons like
141   on an Apple PC
142   Click on Settings, then in the Settings window "Screensaver"
143   Set "Mode:" to "Blank Screen Only"
144  
145  16) apt-get install ntpd
146   An accurate clock is always a good idea :)
147  
148  17) if you wish to ssh into the box you must set a password
149      to do this you simply have to be logged into it at the screen and type
150  
151    sudo passwd ubuntu
152  
153      it will prompt you (twice) to enter a password for the ubuntu account
154  
155  
156  Initial setup complete.
157  
158  ========
159  
160  If you want to SSH into the machine and run cgminer:
161   From a terminal on the miner display each time after you boot:
162    xhost +
163  
164   'xhost +' isn't needed if you ssh into the machine with the same
165   username that the GUI boots into (which is 'ubuntu' in this case)
166  
167  Then after you ssh into the machine:
168   export DISPLAY=:0
169  before running cgminer
170  
171  Also note, that you should force the screen to blank when mining if
172  the ATI card is displaying the screen (using the screen saver
173  application menu)
174  In my case it takes away 50Mh/s when the screen isn't blanked
175  It will auto blank - but make sure the blank is of course just blank
176  as mentioned above at 15)
177  
178  
179  This is of course just the basics ... but it should get you a computer
180  up and running and able to run cgminer
181  
182  ========
183  
184  You should keep an eye on USB disk space
185  The system logger writes log files in the /var/log/ directory
186  The two main ones that grow large are 'kern.log' and 'syslog'
187  If you want to keep them, save them away to some other computer
188  When space is low, just delete them e.g.
189  
190     sudo rm -i /var/log/syslog
191     sudo rm -i /var/log/kern.log
192  
193  The 'df' command will show you the current space e.g.:
194  
195     sudo df
196  
197  Filesystem           1K-blocks      Used Available Use% Mounted on
198  aufs                   2099420    892024   1100748  45% /
199  none                   1015720       628   1015092   1% /dev
200  /dev/sda1              3909348   2837248   1072100  73% /cdrom
201  /dev/loop0              670848    670848         0 100% /rofs
202  none                   1023772       136   1023636   1% /dev/shm
203  tmpfs                  1023772        16   1023756   1% /tmp
204  none                   1023772       124   1023648   1% /var/run
205  none                   1023772         0   1023772   0% /var/lock
206  
207  
208  This shows the 2GB space allocated when you setup the USB as '/' (aufs)
209  In this example, it's currently 45% full with almost 1.1GB of free space
210  
211  ========
212  
213  The latest version (2.0.8) of cgminer is built with 11.10 (not 11.04)
214  If you get the following error when running the prebuilt version in 11.04:
215  
216     ./cgminer: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
217  
218  The fix is to simply link the old curses library to the new name e.g.:
219  
220     cd /lib64/
221     sudo ln -s libncurses.so.5 libtinfo.so.5
222  
223  ========
224  
225  If you wish to install to an HDD instead of a USB:
226  --------------------------------------------------
227  
228  As per before:
229  
230  1) Download the xubuntu 11.04 desktop live CD iso for amd64
231     ( look here for mirrors: http://www.xubuntu.org/getubuntu )
232  
233  Then:
234  
235  2) Burn it to CD then boot that on your new mining PC
236     Select "English" then select "Install Xubuntu"
237     (you have 30 seconds to do this)
238  
239  3) When the Install window comes up - again select "English" and click "Forward"
240  
241  4) The next page will show you if you meet certain install requirements
242     (make sure you do meet them all)
243     Don't select the download option
244     The 3rd party option isn't needed for mining so ignore that also
245  
246     Click "Forward"
247  
248  5) With "Allocate drive space" it's probably easiest to say to use the
249     "Erase" option.
250  
251     This is just for mining right? :)
252  
253     However, if you have anything on the HDD that you want to keep - the
254     "Erase" install process will delete it - so back it up (quit the install)
255     Also make sure there are no OTHER HDD attached that it may erase also
256     i.e. only have attached the one HDD that you want to install onto unless
257     you know exactly what you are doing
258  
259     If you see the "Install Xubuntu 11.04 alongside 'something'" then that
260     just means that the HDD wasn't blank.
261     If you want to try this option - do that yourself and then skip to step
262     7) below when you get to that.
263  
264     There are plenty of other options available if you select "Something else"
265     but I'm not going to go into all the details here other than to say that
266     my preferred partioning is: /boot = 1GB = ext2, swap = twice memory size,
267     / = 100GB = ext3 and the rest: /extra = ext3
268  
269     Click "Forward"
270  
271  6) If you selected "Erase" then it allows you to choose the drive to install to
272     Then click "Install Now"
273  
274  7) "Where are you?" sort that out then click "Forward"
275  
276  8) "Keyboard layout" sort that out (use the default) then click "Forward"
277  
278  9) "Who are you?" The important one here is "Pick a username:" coz that's
279     the name you will need to ssh into, to access it remotely (and of course
280     the "Choose a Password" you set)
281  
282     If you set the "username" to anything but "ubuntu" then: wherever in this
283     document I have mentioned the username "ubuntu" you must of course use the
284     username you chose here instead of "ubuntu"
285  
286     Important: set it to "log in automatically" if you ever want to be able
287     to start cgminer without being in front of the computer since 'X' must
288     be running to use cgminer properly
289     That does of course mean that the computer isn't secure from anyone who
290     has access to it - but then again no computer that can automatically
291     reboot is secure from anyone who has access to the actual computer itself
292  
293     Then click "Forward"
294  
295  10) Of course when it completes click on "Restart Now"
296      ... and remove the Xubuntu CD when it asks you
297  
298  11) Wait for it to finish rebooting ... and it will auto login
299      (unless you didn't do step 9) "Important:")
300  
301  12) After it logs in, an upgrade popup for 11.10 (or later) will appear
302      Select "Don't Upgrade"
303  
304  13) Now go to step 6) of the USB script above for what to do next and that
305      covers everything else needed