How to Install Ethminer on linux (Ubuntu) - Guide (2022)

8 minute read

Simple steps on how to get started with ETHMiner by manually compiling it and configuring it for mining with Nanopool (although it will work for other pools as well). ethminer

Download

Download for linux

While mining Ethereum on Windows is much easier, there is probably an improvement in hashrate when you are using Linux as a driver.

Commands and essence of this guide

First, make sure you have installed the latest AMDGPU-pro drivers with OpenCL support. в качестве драйвера.

AMD

sudo apt-get install opencl-amdgpu-pro-icd cmake git mesa-common-dev
git clone https://github.com/ethereum-mining/ethminer.git
cd ethminer
git submodule update --init --recursive
mkdir build; cd build
cmake .. -DETHASHCUDA=OFF -DETHASHCL=ON
cmake --build . -- -j
sudo make install
ethminer -G -M 0
ethminer -G --report-hr -P stratum1+tcp://[email protected]ool.org:9999

Nvidia

sudo apt-get install nvidia-cuda-toolkit cmake mesa-common-dev
git clone https://github.com/ethereum-mining/ethminer.git
cd ethminer
git submodule update --init --recursive
mkdir build; cd build
cmake .. -DETHASHCUDA=ON -DETHASHCL=OFF
cmake --build . -- -j
sudo make install
ethminer -U -M 0
ethminer -U --report-hr -P stratum1+tcp://[email protected]ool.org:9999

Requirements

Since Ethereum is optimized for GPU mining, one or more powerful GPUs are great. It doesn’t matter if it’s NVidia or AMD, although we prefer to use AMD.

Also make sure your graphics card has enough memory. You can use the DAG file size calculator, to find out how much memory you need. Video cards with less than 5GB of memory are no longer enough.

You will also need a wallet to provide your unique Ethereum address.

We personally recommend using Ledger, as it’s easy to set up, supports multiple currencies, and doesn’t consume all your system resources like Trust Wallet.

We don’t like the idea of ​​resellers keeping your private keys, we suggest you stay away from cloud wallets.

For AMD cards, you also need to install the AMDGPU-pro driver with OpenCL support before compiling Ethminer.

Installing AMDGPU pro driver with OpenCL support

Get the latest drivers from the AMD support, page , then install them with OpenCL support and reboot:

# See: https://www.amd.com/en/support
tar -xf amdgpu-pro-*.tar.xz
cd amdgpu-pro-*/
./amdgpu-pro-install --opencl=legacy,pal
reboot

Vega10 (or newer) cards require change, replace legacy,pal with rocm:

./amdgpu-pro-install --opencl=rocm

Optionally, you can add --headless / or an --no-dkms option to the ./amdgpu-pro-install command if you don’t want AMD drivers loaded in the desktop environment:

./amdgpu-pro-install --opencl=legacy,pal --no-dkms --headless

Building Ethminer fot ubuntu

There is no need to manually collect Ethminer. The latest version can be downloaded from the releases page. However, if you are a professional and want to get additional hashes from your graphics card, compile the miner yourself by following the steps below.

  1. First, install the necessary drivers for your video card:
    • For NVidia use:
      sudo apt-get install nvidia-cuda-toolkit
      
    • For AMD, first install the driver with OpenCL support and then use:
      sudo apt-get install opencl-amdgpu-pro-icd
      
  2. Also make sure that all required packages exist on your system:
    sudo apt-get install cmake mesa-common-dev git
    
  3. Now download the latest version from GitHub into a new folder:
    git clone https://github.com/ethereum-mining/ethminer.git
    cd ethminer
    git submodule update --init --recursive
    
  4. Finally, compile it (the command will take a while, so be patient):
    • For AMD use:
      mkdir build; cd build
      cmake .. -DETHASHCUDA=OFF -DETHASHCL=ON
      cmake --build . -- -j
      
    • To use NVidia:
      mkdir build; cd build
      cmake .. -DETHASHCUDA=ON -DETHASHCL=OFF
      cmake --build . -- -j
      
  5. Optionally, you can install it as an executable file:
    sudo make install
    

First launch of Ethmienr

If you skipped step 5 above, you can start Ethminer from the ethminer directory inside the build directory you are probably still in:

./ethminer/ethminer --help

Otherwise, you can run it directly:

ethminer --help

The commands above show brief Ethminer documentation. For lengthy documentation, use an --help-ext option with one of the valid extensions:

ethminer --help-ext

Optionally, you can view all options in the cpp-ethereum readme file (which is the GPU-enabled ethminer source).

Benchmarking Ethminer

To get an idea of ​​the Mh / s being achieved by your farm, you can run the test first. For ATI / OpenCL use:

./ethminer/ethminer -G -M 0

For NVidia / CUDA use:

./ethminer/ethminer -U -M 0

If the test returns an empty result (which it probably will be the first few times), wait for the DAG file to be generated.

benchmark

Divide “MAX hashrate” by 1,000,000 to get the speed in megahashes. This is your real hash rate in MH/s.

Pool connection

Finally, we are ready to start mining! The last step is actually very simple, just run the following command:

./ethminer/ethminer -G --report-hr -P stratum1+tcp://[email protected]ool.org:9999

0x5576999cc34c1c0030f28939444d6ba9cd6919c2 - change the address of your Eth-wallet.

rigname - the name of your rig (or just remove it, as this is an optional option).

Mining should now start working. Optionally, you can track your progress by viewing your wallet address on the miner’s statistics page.

Ethminer supports all the latest protocols, allowing you to connect to any pool you want. See examples on how to connect to different pools to get started.

To understand if there is the best Ethereum mining pools, there are many factors that need to be considered that determine profitability.

Pool Name Pool Homepage Details about connection
2miners.com https://2miners.com/ https://eth.2miners.com/en/help
ethermine.org https://ethermine.org/ https://ethermine.org/
ethpool.org https://www.ethpool.org/ https://www.ethpool.org/
f2pool.com https://www.f2pool.com/ https://www.f2pool.com/help/?#tab-content-eth
flexpool.io https://flexpool.io/ https://flexpool.io/docs/getting-started/
miningpoolhub.com https://miningpoolhub.com/ https://ethereum.miningpoolhub.com/
nanopool.org https://nanopool.org/ https://eth.nanopool.org/help
nicehash.com https://www.nicehash.com/ https://www.nicehash.com/help/which-stratum-servers-are-available
whalesburg.com https://whalesburg.com/ https://whalesburg.com/start_mining/

2miners.com

-P stratum1+tcp://[email protected]s.com:2020

ethermine.org

Non-SSL connection:

-P stratum1+tcp://[email protected]rmine.org:4444
-P stratum1+tcp://[email protected]ine.org:4444
-P stratum1+tcp://[email protected]ine.org:4444
-P stratum1+tcp://[email protected]ine.org:4444

SSL connection:

-P stratum1+ssl://[email protected]rmine.org:5555
-P stratum1+ssl://[email protected]ine.org:5555
-P stratum1+ssl://[email protected]ine.org:5555
-P stratum1+ssl://[email protected]ine.org:5555

ethpool.org

 -P stratum1+tcp://[email protected]ool.org:3333
 -P stratum1+tcp://[email protected]l.org:3333
 -P stratum1+tcp://[email protected]l.org:3333

f2pool.com

-P stratum1+tcp://[email protected].com:8008

flexpool.io

Non-SSL connection:

-P stratum1+tcp://[email protected]l.io:4444
-P stratum1+tcp://[email protected]l.io:4444

SSL connection:

-P stratum1+ssl://[email protected]l.io:5555
-P stratum1+ssl://[email protected]l.io:5555

miningpoolhub.com

-P stratum2+tcp://USERNAME%2eWORKERNAME:[email protected]:20535
-P stratum2+tcp://USERNAME%2eWORKERNAME:[email protected]:20535
-P stratum2+tcp://USERNAME%2eWORKERNAME:[email protected]:20535

HINTS:

  • miningpoolhub.com needs username.workername in the internal login process. Use %2e to join them into one parameter.
  • It seems the password is not being verified by the pool so you can use a plain x as WORKERPWD.

nanopool.org

Notice:

  • Use %40 for the @-sign in your email address.
  • Use \%2e for the .-sign on Linux in 0x5576999cc34c1c0030f28939444d6ba9cd6919c2.WORKERNAME

With email:

-P stratum1+tcp://[email protected]g:9999/WORKERNAME/EMAIL
-P stratum1+tcp://[email protected]:9999/WORKERNAME/EMAIL
-P stratum1+tcp://[email protected]:9999/WORKERNAME/EMAIL
-P stratum1+tcp://[email protected].org:9999/WORKERNAME/EMAIL
-P stratum1+tcp://[email protected].org:9999/WORKERNAME/EMAIL

Without email:

-P stratum1+tcp://[email protected]nanopool.org:9999
-P stratum1+tcp://[email protected]nopool.org:9999
-P stratum1+tcp://[email protected]nopool.org:9999
-P stratum1+tcp://[email protected]t1.nanopool.org:9999
-P stratum1+tcp://[email protected]t1.nanopool.org:9999

nicehash.com

-P stratum2+tcp://[email protected]:3353
-P stratum2+tcp://[email protected]:3353
-P stratum2+tcp://[email protected]:3353
-P stratum2+tcp://[email protected]:3353
-P stratum2+tcp://[email protected]:3353
-P stratum2+tcp://[email protected]:3353

whalesburg.com

-P stratum1+tcp://[email protected].whalesburg.com:8082

Troubleshooting

Getting system information

Some of the commands we used to understand which drivers or devices are recognized or not:

List GPU’s with loaded drivers:

lspci -k | grep -EA3 'VGA|3D|Display'

Show loaded kernel modules:

lsmod | grep "kms\|drm\|amdgpu"

List OpenCL platforms and devices:

clinfo

List devices Ethminer recognises:

ethminer --list-devices

Ethminer test keeps giving 0H / s

This mostly happens on CUDA cards and / or when DAG generation takes longer than the test time.

The option has --benchmark-warmup been removed, so be patient and let the DAG file be generated.

Error - unsupported GNU version! gcc versions later than 8 are not supported

Build Ethminer fails. This error is actually self-explanatory and can be resolved by manually installing the gcc version:

First, remove all existing files from the current directory build:

make clean

Now install required libs and restart building:

sudo apt-get install gcc-8 g++-8

For ATI/OpenCL use:

cmake -D CMAKE_C_COMPILER=gcc-8 -D CMAKE_CXX_COMPILER=g++-8 -DETHASHCUDA=OFF -DETHASHCL=ON ..
cmake --build . -- -j

For Nvidia/CUDA use:

cmake -D CMAKE_C_COMPILER=gcc-8 -D CMAKE_CXX_COMPILER=g++-8 -DETHASHCUDA=ON -DETHASHCL=OFF ..
cmake --build . -- -j

Ethminer does not see usable devices with AMD card.

Using clinfo, check if any platforms with OpenCL support are found:

# This is wrong
Number of platforms                               0

# This is good
Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3143.9)
  Platform Profile                                FULL_PROFILE
[...]

If clinfo and ethminer does not see the devices, which means that you are using a device driver or not working properly, or does not support OpenCL. See above for how to install the driver for your device. Uninstall any existing drivers in advance. Optionally, you can check if the AMD driver is loaded into the kernel using:

lsmod | grep amdgpu

SIGSEGV, not enough memory available on device

Ошибка SIGSEGV означает, что на устройстве недостаточно памяти. A SIGSEGV error means there is not enough memory on the device.

Look at the lines above the trace message to figure out exactly what went wrong. If your device is low on memory, you can squeeze extra life out of your card by stopping all other programs and / or stopping the GUI / desktop environment.

Use the DAG Size Calculator to find out the minimum GPU memory required for mining.

Usage ethminer --list-devices shows the amount of memory available.

An alternative solution would be to mine other coins that run on Ethash Proof of Work, such as Expanse or Metaverse.

Others (compatibility issues)

Sometimes, using the latest version leads to strange problems or bugs that have not been fixed yet. So you can check an earlier version (like v0.18.0) and try if it works:

git clone --single-branch --branch v0.18.0 https://github.com/ethereum-mining/ethminer.git

Then follow the same assembly steps as above.

It is also important to check for conflicting drivers or other issues. For AMD, you can manually uninstall the existing drivers:

amdgpu-pro-uninstall rm -Rf /etc/vulkan /opt/amdgpu /opt/amdgpu-pro

Conclusion

After installing Linux with a prebuilt version of Ethminer, the hash rate jumped by almost 4 Mh / s. Therefore, we must conclude that the extra effort to get the miner and drivers up and running is really worth it.

Notification

Mining will shorten the lifespan of your hardware and force your computer to use more power, resulting in higher electricity bills. In addition, you can lose all the money you have invested. So, be careful!

You and you alone are responsible for any damage to you, your equipment, or financial loss.

Changelog

2019-01-11
-t 1 The flag is removed as it is not needed. Added a --report-hr flag to report hash to the pool. Changed the AMD drivers download page to ensure that users always get the latest driver.

2020-09-23 Added the -j ability to use all processor cores during assembly, because this significantly speeds up the process. Added documentation for the AMDGPU-pro driver farm with OpenCL support.

2020-09-24
Added additional troubleshooting information, low memory resolution and other minor fixes. Corrected version indication gcc, and g++ in the assembly.

2021-01-04
Maximum supported version gcc/g++ - 8, replaced by 6 in the bug fix.

2021-01-07
Added sudo before commands requiring additional privileges.

mining rig for ethminer