Step by Step Guide to Cuda Mining on Ubuntu 14.04 LTS (as simple as copy paste)
- After Ubuntu is installed and ready, click on the ubuntu icon on the side bar or press windows key on your keyboard type additional drivers and open the application. You will have 4 to 5 choices depending on your nvidia graphics card
- Either select the one which has recommended
- Or choose the one which says tested
- Apply the changes and wait for it to install. Once it is installed press Ctrl + Alt + F6 to go to command line mode. This is because during the installation of the nvidia driver inside the cuda toolkit, Xserver (the service that enables graphical user interface has to be turned off)
- Once in the CLI (Command Line Interface) type (without quotes) ” sudo su ” and enter your password
- Now let us begin preparing the machine for Cuda Mining…
- Run the command (without quotes) – ” apt-get update “
- Run the command (without quotes) – ” apt-get upgrade “
- Run the command (without quotes) – ” apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglapi-mesa libgl1-mesa-dri “
- Run the command (without quotes) – “cd /home/yourusername/Downloads” (Here your username is the name of the user, usually just press the tab key after typing /home/)
- Download the toolkit – run the command (without quotes) – “wget http://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run”
- Give execution permission to the file you just downloaded chmod +x cuda_6.0.37_linux_64.run
- Stopping the display service (without quotes) – “service lightdm stop”
- Run the installer (the parameter override compiler will negate any compiler version issues) ./cuda_6.0.37_linux_64.run -override compiler
- Give yes for all questions, and when asked for the path where the cuda toolkit and cuda toolkit samples, press enter so that it takes the default location, it will be easier to debug.
- You might be asked to re run the setup after restart as the installer will try and remove the other drivers. Once restarted come back to the CLI using Ctrl + Alt + F6 and nagivate to downloads folder (without quote) – “cd /home/yourusername/Downloads/”. After that escalate privilege to root using “sudo su ” command, enter your password if asked.
- Run the command (without quotes) – ” cd “
- Edit .bashrc file with the command (without quotes) – nano .bashrc
- Add the following to the end of the document – “PATH=$PATH:/usr/local/cuda-6.0/bin”, o the next line (press enter) ” LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.0/lib64:/lib “
- Press Ctrl + Y to close press enter to save. You will be back at the terminal. Run the command (without quotes) : “source .bashrc”
- Run the command (without quotes) – ” apt-get install openmpi-bin openmpi-common libopenmpi-dev “
- Run the command (without quotes) – ” cd /home/yourusername/NVIDIA_CUDA-6.0_Samples “
- Run the command (without quotes) – ” make “
- Once the processing is complete and you are back at the cursor (make sure there are no errors.
- Run the command (without quotes) ” ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so “
- Run the command (without quotes) – ” nano /etc/ld.so.conf.d/cuda.conf “
- Inside the file add these 2 lines – ” /usr/local/cuda-6.0/lib64 ” ” /usr/local/cuda-6.0/lib “. Press Ctrl + Y and enter key to save and exit to terminal
- Run the command (without quotes) – ” nano /etc/ld.so.conf.d/NVIDIA.conf “
- Inside the file add these 2 lines – ” /usr/local/cuda-6.0/lib64 ” ” /usr/local/cuda-6.0/lib “. Press Ctrl + Y and enter key to save and exit to terminal
- Run the command (without quotes) – “ldconfig”
- Run the command (without quotes) – ” cd ~ “
- Run the command (without quotes) – ” cd /home/yourusername/Downloads/ “
- Run the command (without quotes) – ” wget https://github.com/cbuchner1/CudaMiner/archive/master.zip “
- Run the command (without quotes)- “mv master.zip CudaMiner.zip” – For easy understanding
- Run the command (without quotes)- “unzip CudaMiner.zip”
- Run the command (without quotes) – ” cd sCudaMiner “
- Run the command (without quotes) – ” chmod a+wrx configure “
- Run the command (without quotes) – ” apt-get install libcurl4-gnutls-dev autogen automake libssl-dev libssl1.0.0 libcryptokit-ocaml libcryptokit-ocaml-dev libcrypto++-dev libcrypto++9 “
- Run the command (without quotes) – ” ./autogen.sh “
- Run the command (without quotes) – ” ./configure “
- Run the command (without quotes) – ” make “
- Run the command (without quotes – ” ./cudaminer -d 0 -i 0 –benchmark “
Once this runs, it means you are ready to mine with cuda miner…
Will post how to mine with a pool in a couple of days..
Reply / Comment to this blog post or leave a message at http://mynameisvivek.in contact section, I will reach back to you..
Happy Mining
Deadbrain 🙂
Shouts to Christian Buchner & Damian Gregory

Excellent Data. This is very useful. I applied this on my machine with 6 GPU’s and it has worked seamlessly since.
Looking forward to the next post on CudaMining!
Soon enough Alex.. Thanks for following…
Hello Vivek!
Great guide! I ran into an issue at the end though while attempting to benchmark, perhaps I did not link a library file correctly?
./cudaminer -d 0 -i 0 -benchmark
*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-02-28 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
modprobe: ERROR: ../libkmod/libkmod-module.c:809 kmod_module_insert_module() could not find module by name=’nvidia_331_uvm’
modprobe: ERROR: could not insert ‘nvidia_331_uvm’: Function not implemented
[2014-05-05 17:22:30] FATAL: Unable to query number of CUDA devices! Is an nVidia driver installed?
I do have the nvidia driver 331 installed, so I am unsure what is causing this. Any tips would be most appreciated, Thank you!
Hey Bryce,
You are Welcome!
Did u do the steps 16 through 18 .. Please verify these steps
16. Edit .bashrc file with the command (without quotes) – nano .bashrc
17. Add the following to the end of the document – “PATH=$PATH:/usr/local/cuda-6.0/bin”, o the next line (press enter) ” LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.0/lib64:/lib “
18.Press Ctrl + Y to close press enter to save. You will be back at the terminal.
Once that is done, Run the command: source .bashrc
The problem is that of permission, the cuda miner is not avle to access the nvidia_331_uvm module..
Please follow these steps and try restarting cuda miner benchmarking
1. Run command
nano /etc/local.d/nv_smi_pm.startAdd these lines to the file
mknod -m 660 /dev/nvidia-uvm c 249 0chgrp video /dev/nvidia-uvm
2. Save and return to terminal (Ctrl +Y followed by enter key)
3. Run this command ->
nvidia-modprobe -c0 -u()4. Run this command ->
dkms install -m nvidia-337-uvm/337.12Plese do sudo ./cgminer -n
It should work well now
Hello Vivek!
Thank you for the quick response and help! I went back through the library linking and made sure all was correct, and attempted your fix. Unfortunately I am met with this similar error while running “nvidia-modprobe -c 0 -u”:
root@bRIG:/home/bryce/Downloads/Applications/CudaMiner/CudaMiner# nvidia-modprobe -c 0 -u
modprobe: ERROR: ../libkmod/libkmod-module.c:809 kmod_module_insert_module() could not find module by name=’nvidia_331_uvm’
modprobe: ERROR: could not insert ‘nvidia_331_uvm’: Function not implemented
Could it be because I installed the graphic driver from the toolkit installation that is messing things up?
Thank you again for all your help, still a Linux Novice, transitioning from mining on Windows!
Cheers,
Bryce
P.S Do you happen to know if it is possible to run both Nvidia and Amd drivers in tandem on Linux? I have an older amd card kicking around that I wouldn’t mind using for extra kh/s.
Thank you,
Bryce
Ehile we troubleshoot it with you, we will work on it together and make it happen (Both AMD and Nvidia)
Please PM me on gmail. I have added you to my ciricles. I will trouble shoot it with you
Thank you very much Vivek! Will do!
Have re-installed a bunch of times now, trying to get it to work lol
Hoping to save some time now with BTRFS snapshots, can always roll back to an earlier state if I mess it up.
Hello,
Thanks for the excellent guide. It has really helped me to reduce the amount of time websearching across the internet.
Viveki, I’m having difficulty on step # 19 – “make”
It shows the following error.
nvcc -g -O2 -Xptxas “-abi=no -v” -arch=compute_10 –maxrregcount=64 –ptxas-options=-v -I./compat/jansson -o wrapnvml.o -c wrapnvml.cu
/bin/bash: nvcc: command not found
I am assuming my paths are not setup corrently. My (.bashrc) file looks like this
PATH=$PATH:/usr/local/cuda-6.0/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.0/lib64:/lib
Next I use the command
:source .bashrc
How can I get nvcc file regonized to make the cudaminer?
Thanks!
So apparently, nvcc is not on the PATH
Are you running it with sudo. You can confirm this with:
sudo bash -c ‘echo $PATH’
The easiest solution is to call sudo with the absolute path of nvcc:
sudo $(which nvcc)
When running commands without absolute path like nvcc, sudo uses the value of the secure_path configuration in /etc/sudoers as the PATH, for example in my system:
Defaults secure_path=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
So even if you set PATH in one of the startup files that the shell normally sources, it won’t work. If you want to make sudo nvcc work temporarily, just to get your build working, I think you have two options:
Edit the installer script and change the lines with sudo nvcc to sudo /path/to/nvcc
Create a symlink to nvcc in one of the directories listed in secure_path, like this: sudo ln -s /path/to/nvcc /sbin/nvcc
UPDATE
If you have a hard time finding the path of nvcc, you can try these commands, in this order (they get slower and slower), until you find a match:
which nvcc
find /usr/local/cuda-5.0 -name nvcc
find /usr/local/ -name nvcc
find /opt -name nvcc
find / -name nvcc
If you need more assistance, Please send me a mail to vivek.p@me.com as I am a bit too busy these days, that is the only address configured on my mobile device.
Hi guys, did you solved the problem?
modprobe: ERROR: ../libkmod/libkmod-module.c:809 kmod_module_insert_module() could not find module by name=’nvidia_331_uvm’
modprobe: ERROR: could not insert ‘nvidia_331_uvm’: Function not implemented
if yes could you give me a hand, I am lost for now
andrej
Hey,
Try installing nvidia package using the command below:
sudo apt-get install nvidia-331-uvm
I got the exact same errors as Bryce
Hey,
Thanks for following the guide..
Try installing the nvidia-331-uvm using apt-get ( apt-get install nvidia-331-uvm) and also please send me some screenshots/error information. Are you using the same card as bryce, because each type of manufacturer / card might have a different error!
Do let me know..
Regards
V
I’m not sure why but this website is loading incredibly slow for me.
Is anyone else having this problem or is it a issue on my end?
I’ll check back later and see if the problem still exists.
I will look into this…Thanks for pointing it out.
Regards
Vivek
Its like you read my mind! You appear to know a lot about
this, like you wrote the book in it or something.
I think that you could do with a few pics to drive the message home a little bit, but other than that, this is fantastic blog.
A fantastic read. I’ll definitely be back.
It is the best time to make some plans for the future and it’s time to be happy.
I have read this post and if I could I wish to suggest you
few interesting things or suggestions. Perhaps you could write next articles referring to this article.
I desire to read more things about it!
I enjoy what you guys are up too. Such clever work and exposure!
Keep up the superb works guys I’ve incorporated you guys to my
personal blogroll.
Hello mates, how is everything, and what you wish for to say regarding this article,
in my view its in facdt remarkable designed foor me.
Nice Blog, thanks for sharing this kind of information.
You are welcome.. Thanks for visiting 🙂
This is a great tutorial! Im trying to install and get things running now. Thank you!!
You are welcome, Ken
Wishing you a great new year…
Thanks for visit the blogpost.
Oops.. What does this Build 2 error tell me I did wrong?
LOL..
Step 21 “make” w/o quotations..
root@test-XPS-630i:/home/test# cd /home/test/NVIDIA_CUDA-6.0_Samples
root@test-XPS-630i:/home/test/NVIDIA_CUDA-6.0_Samples# make
make[1]: Entering directory `/home/test/NVIDIA_CUDA-6.0_Samples/0_Simple/simpleMultiGPU’
“/usr/local/cuda-6.0″/bin/nvcc -ccbin g++ -I../../common/inc -m32 -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_32,code=sm_32 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_50,code=compute_50 -o simpleMultiGPU.o -c simpleMultiGPU.cu
/usr/local/cuda-6.0/bin/nvcc: 7: /usr/local/cuda-6.0/bin/nvcc: Syntax error: “(” unexpected
make[1]: *** [simpleMultiGPU.o] Error 2
make[1]: Leaving directory `/home/test/NVIDIA_CUDA-6.0_Samples/0_Simple/simpleMultiGPU’
make: *** [0_Simple/simpleMultiGPU/Makefile.ph_build] Error 2
root@test-XPS-630i:/home/test/NVIDIA_CUDA-6.0_Samples#
you had some errors when you compiled, I guess the g++ library was not installed.
I did get it figured out and yes you are correct!.. Took me some sampling and tweaking but great post! Keep up the good work..
Thanks Ken.
I get the error “modprobe: ERROR: could not insert ‘nvidia_331_uvm’: Invalid argument” and nvidia-331-uvm is installed. Even manual node creation does not help. What can I do?
your nvidia driver was not installed properly. Please reinstall nvidia drivers again to be able to complete the steps mentioned in the guide.
you can hit me up any time if you need help
Thanks. I fixed it by purging the whole nvidia-* packages out (apt-get remove –purge nvidia-*) and rerunning the cuda install script, which also installs the drivers which are necessary.
Yes,
That is how you can do it.. Great that you were able to make it work.
Hello Vivek,
Thanks for such an amazing guide. Lately, i’ve been trying to install cudaminer on my Nvidia Jetson tegra K1 (Kepler GPU with 192 CUDA cores running on Ubuntu 14.04, L4T), but running the “sudo make” command drops the following error:
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -msse2 -fopenmp -pthread -fno-strict-aliasing -I./compat/jansson -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT cudaminer-cpu-miner.o -MD -MP -MF .deps/cudaminer-cpu-miner.Tpo -c -o cudaminer-cpu-miner.o `test -f ‘cpu-miner.c’ || echo ‘./’`cpu-miner.c
gcc: error: unrecognized command line option ‘-msse2’
Unable to figure out what’s wrong and even google has no answer for it.
Help would be appreciated. Thank you.
Hey adarsh,
I went through your problem andooks like on of the components that is required for it to be compiled is missing. Can you send me a dump of the terminal screen and I can help you better.
You can reach out to me here any time and I will reply immediately
Hi Vivek,
I’m having an issue similar to Bryce’s, but I don’t have the “nvidia_331_uvm” line in the log.
Here is the output:
./cudaminer -d 0 -i 0 -benchmark
*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-02-28 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
[2015-03-26 04:28:31] FATAL: Unable to query number of CUDA devices! Is an nVidia driver installed?
Any ideas?
The problem you are having is because of bad driver installation, please re install the driver and it will work alright, if you need further help or detailed assistance send me a PM