BTC: 1CxnFVKpFadhpnkj4MtuadzEXULnG7hPrW
Eth: 8e61bf5a2e46d15774172781cf100ed0962cbb63

Friday, November 27, 2015

Ethereum GPU Mining with Ubuntu 14.04 from Scratch

_________________
UPDATED 3/20/2016 - qtminer install instructions for pool mining and GPU_SINGLE_ALLOC_PERCENT=100 for 2GB GPUs
__________________

As the codebase developed, we now have a much simpler way to install and run a GPU miner for Ethereum.

Install Ubuntu
A quick note here for newbies, it'll be easier to manage your system in the long run if you install Ubuntu in headless mode. (Headless means it won't output anything to a monitor on bootup and you'll have to loginto the computer remotely via SSH). 

Install Graphics Drivers (AMD)
1) At the command line type:

 sudo apt-get -y update   
 sudo apt-get -y upgrade -f   
 sudo apt-get install fglrx-updates  
 sudo amdconfig --adapter=all --initial  

2) Reboot the machine.
3) You should now be able to see all the video cards installed on your system using the command:
 aticonfig --list-adapters   
The item with the star (*) next to it is the default graphics output of the computer. In our case we have set this to the integrated graphics card and we will use the GPUs installed in the PICe slots only for mining.

3) Trouble: If you're having trouble getting the system to display anything on the screen after boot, you are probably plugged into the wrong graphics card and you may have to change the defaults in BIOS as well as changing the default card the ubuntu uses for it's output. You can force use of the integrated graphics card by entering the following at the terminal:
 sudo aticonfig --pxl-igpu  

Install Geth
Note: If you have a different wallet software like MIST, you don't need to install geth to mine with a pool (non-solo mining).
1) Make a new directory for the latest version of geth
mkdir go-eth135
cd go-eth135

2) Download the master branch for github
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum

3) Enable OPENCL and Build

  export GO_OPENCL=true   
  export GPU_MAX_ALLOC_PERCENT=100   
  export GPU_SINGLE_ALLOC_PERCENT=100  
  make geth   

4) Make a new coinbase account (where your Ether will be deposited)
 build/bin/geth account new  

(enter in a password 2x)


Install QT Miner

We use qt miner as are pool mining software. Several mining pools use qt miner.
1) Download the qtminer software for 14.04 or 15.04 from EthPool.org.

 tar zxvf qtminer.tgz  
 cd ./qtminer  
 chmod +x qtminer.sh  

Start Mining (Solo)
1) To start GPU Mining, go back to your go-eth directory

build/bin/geth -maxpeers '100' -mine -minergpus '0' -autodag console

2) Mine with Multiple GPUs
build/bin/geth -maxpeers '100' -mine -minergpus '0,1,2' -autodag console

Where '0,1,2' means mine with GPUs zero, one and two. You should change this to list however many GPUs you have. Thus if you have only 2 GPUs and they are devices 2 and 4 you would type : '2,4' instead of '0,1,2'. To see which devices your GPUs are listed as use the command:

aticonfig --list-adapters  

NOTE: All the rest of the commands are typed inside the go-ethereum console:

3) Ensure your rig is mining to your address
web3.eth.coinbase
 (This should be set to the same address that you just created when you made your coinbase account)
If this returns '0x0' that means you're mining rewards will get sent into a big black hole. Fix this by typing the following inside the geth java scrypt console:
 web3.miner.setEtherbase(web3.eth.accounts[0])

4) Check Profits
web3.fromWei(eth.getBalance(eth.coinbase), "ether")
 This will return how much ether you have in your account

5) Check Hash Rate
miner.hashrate


Start Mining (Pool)
1) Mining with ethermine.org, they have several servers throughout the world:
US East : us1.ethermine.org:4444
US West: us2.ethermine.org:4444
Asia       : asia1.ethermine.org:4444
Europe  : eu1.ethermine.org:4444

They use a PPLNS 1% fee system. I have used their companion service ethpool.org successfully for months.

Below, you should replace the address with your own wallet address given to you by geth when you made your account. I mine with US East so to start mining I type the following:

./qtminer.sh -s us1.ethermine.org:4444 -u 0x8e61bf5a2e46d15774172781cf100ed0962cbb63.rig1 -G

The command above will attempt to start all your video cards mining. In my case, this doesn't work because I have an AMD integrated graphics card as my first device (device '0' in the image below).


2) Troubleshooting: If you have a an issue like me where you have an integrated graphics card, that you can't mine on, or you just want to specify the cards to mine on, modify the above qtminer command as follows:

./qtminer.sh -s us1.ethermine.org:4444 -u 0x8e61bf5a2e46d15774172781cf100ed0962cbb63.rig1 -G --opencl-device '1'

This will start my first device. To start the rest of the non-integrated graphics mining I would then enter the following in separate terminals:

./qtminer.sh -s us1.ethermine.org:4444 -u 0x8e61bf5a2e46d15774172781cf100ed0962cbb63.rig2 -G --opencl-device '2'

./qtminer.sh -s us1.ethermine.org:4444 -u 0x8e61bf5a2e46d15774172781cf100ed0962cbb63.rig3 -G --opencl-device '3'


The End & Other Problems
If you have enjoyed this post, please consider sending me a beer!

Having problems with PCIe Extenders? Check Here for common solutions.

Problems with 2GB GPU? Make sure that the following is set before starting qtminer:

  export GPU_MAX_ALLOC_PERCENT=100   
  export GPU_SINGLE_ALLOC_PERCENT=100  

28 comments:

Alex Pothiawala said...

Hi guys,

I have a slight problem when I get to the mining, all seems to be working but when I check the hashrate it comes back with 0. I've had it running for about 20 minutes now and still nothing. Any ideas?

"> I1204 00:48:33.482831 21510 blockchain.go:1230] imported 1 block(s) (0 queued 0 ignored) including 0 txs in 6.701283ms. #637507 [6755d548 / 6755d548]
I1204 00:48:33.495611 21510 worker.go:570] commit new work on block 637508 with 5 txs & 0 uncles. Took 12.62265ms
> miner.hashrate
0"

Thanks in advance

Alex Pothiawala said...

Fixed my problem, didn't have CUDA installed, I'm running a Nvidia 760 now getting 14060784 as my hashrate.

Followed this guide to install CUDA for Nvidia cards:

https://forum.ethereum.org/discussion/comment/8889/#Comment_8889

Kasper Sky said...

When I get to "make geth" it returns

build/flags.sh: 13: build/flags.sh: go: not found
build/env.sh go install -v -ldflags '-X main.gitCommitc541b38fb36587d23c60f5e2f2b9b3c8700ec489' -tags opencl ./cmd/geth
build/env.sh: 32: exec: go: not found
make: *** [geth] Error 127

What do I need to do to fix this?

Louis Blank said...

Hi - great tutorial.

I will gladly buy you a BetBeer if I can get all of my GPU's mining !!!

First question. I WAS mining with one card for several days (using ethminer)...

Using what you wrote, I got the following...

> web3.eth.coinbase
"0x157cef734bebef185455b25c684423c2e787416e"
> I0215 14:02:01.784395 eth/downloader/downloader.go:295] Block synchronisation started
> web3.fromWei(eth.getBalance(eth.coinbase), "ether")
5.0209968

But when I check the blockchain for my account, I show only the 0.001 that I sent myself after creating the Ether account.

So, where is the 5.02xxxx profit that web3 is telling me I have?

Thanks

Louis Blank said...

Never mind... I had mined a block before killing to miner in order to try your tutorial.

Either way.... I got a block.

Second question
The command...

build/bin/geth -maxpeers '100' -mine -minergpus '0,1,2' -autodag console

...does not mine - but rather, returns several a mass amount of "goroutine xxx [select]"
the last part of which is...

goroutine 139 [select]:
github.com/ethereum/go-ethereum/p2p.(*Peer).run(0x95981ce0, 0x80ac08d0)
/home/tommy/Downloads/go-eth132/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/peer.go:152 +0xb18
github.com/ethereum/go-ethereum/p2p.(*Server).runPeer(0x92f4c1a0, 0x95981ce0)
/home/tommy/Downloads/go-eth132/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/server.go:681 +0x2bd
created by github.com/ethereum/go-ethereum/p2p.(*Server).run
/home/tommy/Downloads/go-eth132/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/server.go:489 +0x14ca

goroutine 141 [chan receive]:
github.com/ethereum/go-ethereum/p2p/discover.(*udp).findnode(0x92fa8480, 0xd032f591, 0x43483c9d, 0x52b04d00, 0xd9939a90, 0xbc956c64, 0x315d7862, 0xcbb555e7, 0xccb17d30, 0x7e3af4f0, ...)
/home/tommy/Downloads/go-eth132/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/discover/udp.go:276 +0x393
github.com/ethereum/go-ethereum/p2p/discover.(*Table).Lookup.func1(0x92f52000, 0x94faa300, 0x9629ef80, 0x9629efc0)
/home/tommy/Downloads/go-eth132/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/discover/table.go:237 +0x143
created by github.com/ethereum/go-ethereum/p2p/discover.(*Table).Lookup
/home/tommy/Downloads/go-eth132/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/discover/table.go:250 +0x441

---

Then the terminal window froze and does nothing. That output doesn't look like it was even trying to mine. Your thoughts?

Also, still working on trying to get multi-GPU's mining. Right now only one of three is working

Louis

Martin John Bramwell said...

SkithUno,

Thanks very much for doing this.

One bit that's lacking, though ...

¿¿ What is the definitive test that my GPU is in fact mining for real Ether ??

I am seeing the same logs that I have seen previously before discovering an error message somewhere. If it can take hours or days before I see a success message, I could waste those hours or days unaware that I'm still misconfigured.

How can I know for sure that it's working?

Thanks,
Martin

Donnie Bott said...

I have this same issue

build/flags.sh: 13: build/flags.sh: go: not found
build/env.sh go install -v -ldflags '-X main.gitCommit34b622a24853e1cf550238e8c8be6dfa4178cd35' -tags opencl ./cmd/geth
build/env.sh: 32: exec: go: not found
make: *** [geth] Error 127


Any help?
Thanks!

HowlingMad said...

run sudo apt-get install golang

HowlingMad said...

Kasper, Donny,
You need to install the GO package by:
sudo apt-get install golang

Then start where it crashed.

SkithUno said...

Thanks for the update /u/HowlingMad. I didn't have to do this step when I installed which is why I didn't previously listed. I thought golang was included in the current version of go-eth?

Parker Fairfield said...

2nd post here. I didn't see the XLNTE.com post


1 of 6x Radeon Sapphire R9 390 found AS Rock H81 pro btc Ubuntu 14.04

Virgin install of Ubuntu - works fine finding ONE of the SIX different Radeon Sapphire R9-390 GPUs.

It'd be great if you 'd comment on your solution to configuring them. I'm in China ... and getting any assistance is ridiculously difficult.

Ubuntu 14.04
AS Rock H81 pro btc
6x Radeon Sapphire R9 390

I've tried about everything....

I'm keeping a log trying to hunt down the settings.
https://gist.github.com/rawsushi/46711041d146b936e5ad0233c57b5d82

Me: www.Linkedin.com/in/parkerfairfield

WeChat: PAFwork
Gitter: Rawsushi

Гавриил Шарапов said...

Hi. Tyvm for your tutorial. Its was very helpfull for my builds on 15.04 and 14.04.4 LTS Ubuntu versions. Both are work fine. Really not sure what is a better because im getting the same hashrates on both versions. My rig getting around +20Mhs on Ubuntu build ethminer with using eth-proxy 0.0.5 vs Windows ethminer. And its work stable without any issues. Im have not so much but 4 AMD R9 Radeon cards on board = 2x280x DC2T 3GDD5 + 380 4Gb + 380x 4Gb all cards made by Asus.Motherboard Gygabyte GA970 DS3P rev.1. Ty again for your work.GL.

Гавриил Шарапов said...

Parker if you need else some help you can send me mail.

Ale Vald said...

Thanks for a damn good tutorial!!

everything has gone well beside the connection to the server ... this is what i get out

23:24:33|qtminer Push: New work package received
ℹ 23:24:37|qtminer Loading full DAG of seedhash: #290decd9…
ℹ 23:24:37|qtminer Connection to stratum server lost. Trying to reconnect!
ℹ 23:24:41|qtminer Full DAG loaded
ℹ 23:24:42|qtminer Connection to stratum server established!
ℹ 23:24:42|qtminer Waiting for work package...
ℹ 23:24:42|qtminer Push: New work package received
ℹ 23:24:42|qtminer Connection to stratum server lost. Trying to reconnect!
ℹ 23:24:47|qtminer Connection to stratum server established!
ℹ 23:24:47|qtminer Waiting for work package...
ℹ 23:24:47|qtminer Push: New work package received
ℹ 23:24:47|qtminer Connection to stratum server lost. Trying to reconnect!

i want to mine at nanopool.
./qtminer.sh -s eu1.nanopool.org:8888 -u ADDRESS.worker2 -G

does anybody have a clue why i keep losing connection??

Thanks

Гавриил Шарапов said...

HI Ale. Try to change port to 9999 and run miner. How I'm understand you are not use eth-proxy right?

Ale Vald said...

HI!
thanks for your answer, that made it work. but it sems like its not generating hashes to my account. i will let its work for the night and will see tomorow.

I am not on a proxy.

Thanks a lot

Гавриил Шарапов said...

You are wellcome Ale. Better use proxy it's increase your hashes ussually around 20% up, if your are have any questions you are free to ask me about via gmail first. Good luck

Ale Vald said...
This comment has been removed by the author.
Гавриил Шарапов said...

Ale are you are slved your issues? My gmail address shpopell@gmail.com

Andrew said...

How do we overclock the video cards?

I keep getting this error for all video cards after the primary one.

ERROR - Set clocks failed for Default Adapter - ATI Radeon 390 Series
Please check that input values were valid

JDC said...

Does it matter which version of Ubuntu 14.04 you install. Desktop or Server?

nich said...

Hi, great tutorial. Now wondering, what if you have a farm, about 15 rigs, and you want to combine your MH/s to mine in a pool?

Unknown said...

Hi,

Great guide. I have one quick question for you. Do you happen to have a guide for Nvidia?

Thanks

Matt

finexo desprado said...

hello
i have a problem when i use the sudo apt-get install fglrx
i get this

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package fglrx is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'fglrx' has no installation candidate

can any one help me

Budi Susanto said...
This comment has been removed by the author.
Budi Susanto said...

bitcofee

Budi Susanto said...
This comment has been removed by the author.
Budi Susanto said...

Mantap gan nitip link http://bitcoin-spot.blogspot.com
Download mp3 disini >> http://bitcofee.tk