Ubuntu Mining

From Ravencoin Wiki
Jump to navigation Jump to search

By Jeroz - Jan 19th, 2018

General Introduction

This guide will help you set up Ubuntu on your PC and help you start mining with NVIDIA GPUs. You will have to install Ubuntu first.

This guide will further guide you through the steps to set up your system NVIDIA CUDA drivers. This guide is heavily inspired on the more comprehensive guide by NVIDIA that also describes installation steps for other Linux distributions.


Run Updates

sudo apt-get update
sudo apt-get upgrade


Verify that you have a CUDA-Capable GPU

lspci | grep -i nvidia

If your graphics card is from NVIDIA and it is listed in http://developer.nvidia.com/cuda-gpus, your GPU is CUDA-capable.

Verify you have 64 bit Ubuntu 18.04

uname -m && cat /etc/*release

The x86_64 line indicates you are running on a 64-bit system. The remainder gives information about your distribution.

Verify gcc is installed

gcc --version

If an error message displays, you need to install the development tools from your Linux distribution or obtain a version of gcc and its accompanying toolchain from the Web.

Verify the System Kernel Headers

sudo apt-get install linux-headers-$(uname -r)

Install required third-party libraries

sudo apt-get install build-essential dkms freeglut3 freeglut3-dev libxi-dev libxmu-dev

Download and install the NVIDIA CUDA Toolkit

Download CUDA drivers

cd ~/Downloads
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb

Install CUDA drivers

sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda

Post-installation Actions

Add location of CUDA drivers to the PATH

Add drivers to environment path:

nano ~/.profile

With the file opened in the nano editor, scroll down and add at the bottom:

export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}

Type Ctrl+O ENTER to save and Ctrl+X to exit

Set configuration

sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration


Installation verification

Verify the Driver Version

cat /proc/driver/nvidia/version

Should return the version

Verify the version of the CUDA Toolkit

nvcc -V

Should return the version

Verify GPUs are found


This will return something that looks like this (make sure all GPUs are found):

| NVIDIA-SMI 410.79       Driver Version: 410.79       CUDA Version: 10.0     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|   0  GeForce GTX 106...  Off  | 00000000:01:00.0  On |                  N/A |
| 28%   29C    P8     8W / 120W |    674MiB /  6075MiB |      0%      Default |

[OPTIONAL] Change power and or overclock settings

To overclock the cards you can adjust the settings in the NVIDIA applications that is listed in the applications list. This list is available in the lower left corner of the desktop. Most miners want to set their power to ~70% to save energy costs. This can be done by:

  • Enable persistent mode so that settings persist after a reboot:
sudo nvidia-smi -pm 1
  • Look up current power setting to figure out what ~70% needs to be:
nvidia-smi -i 0 -q -d POWER
  • Change power setting (in my example I lower power from 120W to 100W):
sudo nvidia-smi -pl 100

Disable automatic updates

IMPORTANT: Disabling automatic updates creates a security risk. To keep your system updated manually:

sudo apt update 
sudo apt upgrade

Automatic updates might interfere with your miner. To disable them, edit the following file:

sudo nano /etc/apt/apt.conf.d/20auto-upgrades

With the file opened in the nano editor, switch off the updater by changing values from 1 to 0:

APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";

Type Ctrl+O ENTER to save and Ctrl+X to exit

Setting up the miner

For this example, let's look at the currently popular miner T-Rex.

  1. Download the last version from their Github here.
  2. Browse to the Downloads folder using the Files explorer
  3. Extract the miner from the tar.gz-file (right click and choose Extract Here)
  4. Move the extracted folder to your home directory by dragging or copy-pasting it there
  5. Rename the folder to trex-miner for simplicity (right click and choose Rename...)
  6. In the folder trex-miner, rename config_example to config (at the time of this writing their example was named config_example)
  7. Open the config file in Text Editor (simply double-click) and change the settings to your liking.

Now start the miner by opening a Terminal and type:

~/trex-miner/t-rex -c config

OPTIONAL: Adjust intensity setting to your liking by adding -i X, where X is your desired intensity setting, for example 20.

~/trex-miner/t-rex -c config -i 20


PCI Bus Error

If you encounter PCIe Bus Error messages:

sudo nano /etc/default/grub 

Add pci=noaer at the end of GRUB_CMDLINE_LINUX_DEFAULT:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=noaer"

Type Ctrl+O ENTER to save and Ctrl+X to exit and update grub:

sudo update-grub

Now reboot