VnutZ Domain
Copyright © 1996 - 2024 [Matthew Vea] - All Rights Reserved

2019-04-14
Featured Article

Configuring Ethminer in Ubuntu 18 Bionic Beaver

[index] [2,580 page views]
Tagged As: Bitcoin, Blockchain, Cryptocurrency, DIY, Ethereum, and Linux

One of my Ubuntu machines recently stopped functioning properly so I opted to perform a do-release-upgrade to bring her up to the Bionic Beaver LTS release. While that fixed a number of issues, it introduced a new one - my ethminer ceased working which impacted my Ethereum production. The fixes weren't hard, but the documentation on the process was certainly shoddy.

She happens to be running a NVIDIA GeForce GTX 1070 with 8GB of RAM and the release upgrade forced a reinstallation of the graphics drivers. Those can be found from the nVidia website where at the time of this post, the current version is 418.56. Simply save the NVIDIA-Linux-x86_64-418.56.run file, make it executable, and run it as sudo to complete the installation. Reboot as necessary.


chmod +x NVIDIA-Linux-x86_64-418.56.run
sudo ./NVIDIA-Linux-x86_64-418.56.run

You'll need to install the CUDA toolkit for the nVidia graphics cards. That's easily done from the apt repository:


sudo apt-get install nvidia-cuda-toolkit

The PPA repositories for ethereum used to have the ethminer binaries but that apparently ceased to be included under Bionic Beaver. You'll have to either grab a binary from the GitHub page or simply compile the tool yourself. I ended up opting for the latter. The following commands will:

  • clone the repository to a local "ethminer" folder
  • change into that local folder
  • grab any necessary submodules
  • create a "build" folder
  • change to that folder
  • create compilation instructions for using CUDA, skipping OpenCL, and accessing a Stratum/GetWork server
  • build and install the binaries

git clone https://github.com/ethereum-mining/ethminer.git ethminer
cd ethminer
git submodule update --init --recursive
mkdir build
cd build
cmake .. -DETHASHCUDA=ON -DETHASHCL=OFF -DETHSTRATUM=ON
sudo make install

From here, the system balked at me about missing various libraries such as JSON and C++ Boost libraries such as libboost_random.so.1.58.0: cannot open shared object file. Ultimately, these libraries were mitigated with the following apt repository installations:


sudo apt install libjsoncpp1 libjsonrpccpp*
sudo apt install libboost-program-options-dev

With these shared object libraries installed, ethminer was happy to run again but no longer accepted the previous command-line arguments. To mine with NanoPool required the following:


screen -dmS ethminer ethminer \
  -P getwork://eth-us-east1.nanopool.org:8888/0xa00b9B354f46a2268A5d16c5331a2B0CD61be7Cb/GPU \
  -P exit

I use screen because it makes accessing a headless server to check on the miner's status that much easier. It's also extremely easy to set up a CoinBase account with an Ethereum address for receiving the 0.2ETH pool payments. With all those steps complete, the water-cooled nVidia card was quietly cranking away again.

Unfortunately, I find my built ethminer binary crashes fairly regularly, especially if it cannot reach the pool server. Running under screen prevented it from truly just dying and getting restarted by a cronjob so I added this little bash script to monitor its running health. Adding a log file allowed the health to be monitored, looking for keywords related to a fault. This script is periodically run by cron to keep ethminer running regularly.


#! /bin/bash

#make sure there's a running ethminer
if ps -A | pgrep ethminer; then
  #confirm the logfile is present
  if [ -f "/tmp/mining.log" ]; then
    #check if the logfile shows an ethminer failure
    if cat "/tmp/mining.log" | grep "backtrace()"; then
      echo "[!] ethminer error : process stuck - force killing"
      kill `ps -A | pgrep ethminer`
    fi
  else
    echo "[!] ethminer error : log file missing - force killing"
    kill `ps -A | pgrep ethminer`
  fi
fi

#determine if miner restart is necessary
if ps -A | pgrep ethminer; then
  echo "[*] ethminer running : no action"
else
  wall "[!] ethminer error : no process - starting GPU"
  rm /tmp/mining.log
  screen -dmS gpumining -L -Logfile /tmp/mining.log /usr/local/bin/ethminer \
   -P getwork://eth-us-east1.nanopool.org:8888/0xa00b9B354f46a2268A5d16c5331a2B0CD61be7Cb/GPU \
   -P getwork://eth-us-west1.nanopool.org:8888/0xa00b9B354f46a2268A5d16c5331a2B0CD61be7Cb/GPU \
   -P exit
fi

Consider an Ethereum donation to 0x3D6D56fE1f6006d3Ed299368eF8d93811584B45E if you're feeling generous and found this article helpful. Thanks!



More site content that might interest you:

Basically a "pics or it didn't happen" kind of science scenario.


Try your hand at fate and use the site's continuously updating statistical analysis of the MegaMillions and PowerBall lotteries to choose "smarter" number. Remember, you don't have to win the jackpot to win money from the lottery!


Tired of social media sites mining all your data? Try a private, auto-deleting message bulletin board.


paypal coinbase marcus