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

Featured Article

Configuring Ethminer in Ubuntu 18 Bionic Beaver

[index] [2,657 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 file, make it executable, and run it as sudo to complete the installation. Reboot as necessary.

chmod +x
sudo ./

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 ethminer
cd ethminer
git submodule update --init --recursive
mkdir build
cd build
sudo make install

From here, the system balked at me about missing various libraries such as JSON and C++ Boost libraries such as 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:// \
  -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`
    echo "[!] ethminer error : log file missing - force killing"
    kill `ps -A | pgrep ethminer`

#determine if miner restart is necessary
if ps -A | pgrep ethminer; then
  echo "[*] ethminer running : no action"
  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:// \
   -P getwork:// \
   -P exit

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

More site content that might interest you:

Do AI's dream of electric sheep?

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