Friday, October 4, 2013

Minimal Headless OpenCL + cgminer on Ubuntu 13.04 Server

UPDATE 2015-05-12: This guide hasn't been touched in a really long time. It'll probably still work if you use the actual versions of everything listed, but no guarantees. I've noticed that Catalyst 14.12 has a "minimal" video driver now along with a "graphics accelerators devel files" download. Needless to say, the situation seems to have changed for the better, but I haven't needed to do any new OpenCL setups, so I don't know what's involved. If you've landed on this page from a search engine, I would suggest searching for a more up-to-date guide. Unfortunately, I do not have any recommendations at this time.


Purpose of this Guide
I'm going to explain how to set up a minimal number of X dependencies required to run cgminer on Linux with AMD GPUs. This also potentially applies to other OpenCL tasks too.

Why is this Needed?
AMD makes decent Windows drivers, but unfortunately, AMD's proprietary Linux drivers are not very good. In order to do OpenCL, you must have some sort of X server running*.

*Update: there is a way to modify the drivers so that an X server isn't required:
I could not get it to work, but one of the commenters reported success (but only with errors and no ADL)

I'm going to assume you've got a headless server with SSH access and that you've just done a default install of Ubuntu Server 13.04 64-bit.

Note about Ubuntu Desktop vs Ubuntu Server:
It's very likely that the instructions in this guide will not work with Ubuntu Desktop without a few modifications. This guide will install xdm and assume it's set as the default, but if you already have a graphical environment, you probably already have a display manager installed (probably lightdm).

Also, there have been varying levels of success with different software versions. Some combinations of fglrx and the APP-SDK result in 100% CPU usage, or just don't work at all.

Update the Server
It's very important that you run apt-get update otherwise the buildpkg may fail later. Also, upgrading now is a good idea unless you want to experience the pain of upgrading a kernel with fglrx right away.
sudo apt-get update
sudo apt-get dist-upgrade
sudo reboot

Download and Install the Drivers
Download the latest fglrx drivers (I'm using 13.8 beta in this guide):
(note: at least one commenter reported problems with the latest drivers. If you need 13.8 specifically, see Patrick's commentuse "wget --referer=""" to download because AMD blocks direct links)
(note: if you have an R9 290 or one of the other newer GPUs, please see this comment, there are several people having trouble with the newer cards, you might need to install a graphical environment first and run the manual installer rather than building a package)

Install Some Necessary Packages
sudo apt-get install dh-make dh-modaliases execstack libxrandr2 libice6 libsm6 libfontconfig1 libxi6 libxcursor1 libgl1-mesa-glx libxinerama1 libqtgui4 unzip

Extract the Installer
chmod +x

Build the fglrx .deb Packages
./ --buildpkg Ubuntu/raring

(replace "raring" with the code name for your version according to "lsb_release -c")

Install fglrx
sudo dpkg -i fglrx*.deb
sudo apt-get -f install
sudo reboot
(it'll fail the first time, complaining about dependency problems; running apt-get -f install fixes it)

If you have multiple GPUs and want to run all of them, you might have to run something like: Update: it looks like this step is required. You can also run "aticonfig --list-adapters" if you'd like some extra information.
sudo aticonfig --initial --adapter=all

Install the APP SDK
Next, you'll need AMD's APP SDK:

Extract the APP SDK
tar xvf AMD-APP-SDK-v2.8.1.0-lnx64.tgz
sudo ./
sudo reboot

(you can do this in another directory if you want, these things produce lost of junk files)

Install the Minimum Required X Server Packages
sudo apt-get install xdm xorg

If you have a screen hooked up, you'll see an ugly XDM log in prompt. Don't use it (unless you install openbox or something). If you need console access to your server, switch to tty1 (ctrl+alt+f1).

Disable Authorization on xdm
(if you know of a better way to do this, please tell me...)

sudo nano /etc/X11/xdm/xdm-config

find the line
DisplayManager*authorize:       true

and make it
DisplayManager*authorize:       false

Save the file and reboot
sudo reboot

At this point, I'd recommend making sure xdm is actually running.

Compile cgminer and Test
Even if you don't plan to mine crypto-currencies, running cgminer is a good way to make sure stuff works. If you just want to run your own application, take a look at the cgminer sh towards the end and modify it to your needs.

Install Git
sudo apt-get install git

Download cgminer
git clone -b 3.7
Update: It looks like cgminer 3.7.2 is the last version to support GPU mining (see: Thank you to the Anonymous poster in the comments for this.

Alternatively, you could try sgminer, a scrypt-only fork of cgminer 3.7.2 with new bug fixes, as suggested by an anonymous comment.

Download AMD ADL SDK (for temperature monitoring, fan control, etc)
cp include/* ./cgminer/ADL_SDK/
(you might want to do this in a temporary directory as the ADL zip has a bunch of other stuff that it extracts into the current directory)

Install the packages we'll need to compile cgminer
sudo apt-get install build-essential autoconf libtool libcurl4-openssl-dev libncurses5-dev pkg-config libudev-dev

Compile cgminer
cd cgminer
./configure --enable-opencl --enable-scrypt
Update: It seems that I now have to add --enable-opencl to compile on 3.7.2
Note: you only need "./configure" (without any options) if you're using sgminer

Make sure you see the following after configure:
OpenCL...............: FOUND. GPU mining support enabled
scrypt...............: Enabled
ADL..................: SDK found, GPU monitoring support enabled

If everything looks good, compile

Testing cgminer (or other OpenCL applications)
You'll need to set some environment variables to run OpenCL applications. I recommend you start them with a bash script like the following:
export DISPLAY=:0
./cgminer -n

Save it as something like "" and "chmod +x"

(note: in some cases, you may need to run the script as root)
When you run it, you should get something like:
 [2013-10-04 22:46:09] CL Platform 0 vendor: Advanced Micro Devices, Inc.                    
 [2013-10-04 22:46:09] CL Platform 0 name: AMD Accelerated Parallel Processing                    
 [2013-10-04 22:46:09] CL Platform 0 version: OpenCL 1.2 AMD-APP (1214.3)                    
 [2013-10-04 22:46:09] Platform 0 devices: 1                    
 [2013-10-04 22:46:09] 0 Tahiti                    
 [2013-10-04 22:46:09] GPU 0 AMD Radeon HD 7900 Series hardware monitoring enabled                
 [2013-10-04 22:46:09] 1 GPU devices max detected

If everything worked (hopefully it did, because if not, the suffering starts now), you can now run OpenCL applications. Yay!

If you found this guide helpful and want to donate:
LTC -- LQNDRwrk9H6nwU88Ka87XPqfiJ9AAqdxJR

Issues / Troubleshooting

If something in this guide didn't work for you, please leave a comment with your operating system and driver version. I ran through this guide start to finish on a fresh install on my hardware and it seemed to work, but I only have a 7950 to test.

Some people are having issues with R9 290s. It looks like there are problems getting cgminer to see the newer hardware in some cases. I don't have any new hardware to test unfortunately, but I linked a few of the comments above, it seems a few people managed to figure it out.

Also, since GPU mining isn't supported in the newer cgminer releases, this guide may no longer work when AMD releases new hardware.

Run cgminer at Boot with rc.local and screen

This is a simple workaround to get cgminer running at boot and allow you to see it when you log in remotely later. These are not complete instructions, but hopefully they might help.

First, install screen if you haven't already:

sudo apt-get install screen

If you use a script like my script above to start cgminer already, then take note of where that is located. Create a different script somewhere accessible (mine is ~/ in my home directory) and add this:

cd /home/yourusername/cgminer/
(of course replace "yourusername" with your name, and "" with whatever script you use to start cgminer)

Then add something like this to your rc.local

/bin/su yourusername -c "/usr/bin/screen -dmS test bash -c '/home/yourusername/; exec bash'"

To test, log in as the root user "sudo su" and run "/etc/rc.local". Exit the root user, and run "screen -r" and see if cgminer is working. To detach from screen, type Ctrl+a then type 'd' key. Then try it after a reboot.

Alternatively, one commenter mentioned using crontab, which may be better than the rc.local method.

Run "crontab -e" (as a regular user, not root) and add something like the following:

@reboot cd /home/yourusername/cgminer && screen -dmS test bash -c '/home/yourusername/cgminer/; exec bash'

That seemed to work for me. Probably a better solution since it doesn't require root.


  1. I have two 7970's, and I cannot get any kind of confirmation of OpenCL working when I run "./configure --enable-scrypt". Also, "--enable-scrypt" doesn't seem to be a thing any more. Running "clinfo" I see my processor and my two video cards. Any clues as what to do to get cgminer to see them?

    1. yeah they seem to have disabled scrypt in recent versions, no idea why. If you use 'git checkout tags/3.1.1' after cloning the repo you shouldn't have any issues compiling. I don't know at which version they stopped including scrypt but I know that one works.

  2. Which version of cgminer are you trying to use?
    I'm asking because last version of cgminer that supports GPU mining is 3.7.2:

  3. Everything seems to have built and installed properly but when I run ./cgminer -n I get:

    Setting of real/effective user Id to 0/0 failed
    libkmod: ERROR ../libkmod/libkmod-module.c:791 kmod_module_insert_module: could not find module by name='fglrx'
    ERROR: could not insert 'fglrx': Function not implemented
    Error! Fail to load fglrx kernel module! Maybe you can switch to root user to load kernel module directly
    X Error of failed request: BadRequest (invalid request code or no such operation)
    Major opcode of failed request: 154 ()
    Minor opcode of failed request: 19
    Serial number of failed request: 12
    Current serial number in output stream: 12

    1. I found the issue, looks like the latest version of amd-catalyst drivers do not include required files, must use your recommended version of 13.8-beta

    2. Ah, interesting. Was it 13.11 that didn't work?

    3. Where do you find the 13.8-beta? I can't find it in the archives.


    5. I noticed that you cannot download the 13.8 driver file from AMD's web site directly using the URL because AMD blocks direct and external requests to the download pages. In order to download the file, you need to spoof the HTTP referrer. You should be able to download it with the following command:
      wget --referer=""

    6. I've struggled for a day or two with my system setup (R9290X, HD7850, I7-4820, 16GB RAM @ Xubuntu) and after the n-th re-install it started working.

      AMD Driver: 13.11 (latest). Installed the driver without the --buildpkg Ubuntu/$(lsb_release -c) option in a desperate attempt to "try everything", which lead me to a install screen asking if I wanted the latest driver (13.20) which I approved...

      All else I did as described in the post with the following versions,

      CGMINER 3.7.2
      AMD ADL SDK 6.0

      Good luck

    7. I almost got it working thanks to your instructions... only think is I am getting 41.08Kh/s with a r9 290!

      [2013-12-14 05:41:34] Started cgminer 3.7.2
      [2013-12-14 05:41:34] ADL found less devices than opencl!
      [2013-12-14 05:41:34] There is possibly more than one display attached to a GPU
      [2013-12-14 05:41:34] Use the gpu map feature to reliably map OpenCL to ADL
      [2013-12-14 05:41:34] WARNING: Number of OpenCL and ADL devices did not match!
      [2013-12-14 05:41:34] Hardware monitoring may NOT match up with devices!

    8. Fixed the above problem by reinstalling the fglrx package after removing all.

      Now is card is detected and there are no more errors but I am mining at
      GPU 0: 68.0C 1059RPM | 19.09K/19.43Kh/s | A:239 R:0 HW:0 WU:18.0/m I:10

    9. "GPU 0: 68.0C 1059RPM | 19.09K/19.43Kh/s | A:239 R:0 HW:0 WU:18.0/m I:10"

      Try raising the intensity to 20.

  4. Everything compiles correctly. Can't get it to work. Used these instructions and some from other sources. Any ideas?

    kurt@miner01:~/Downloads/cgminer-3.7.2$ export DISPLAY=:0
    kurt@miner01:~/Downloads/cgminer-3.7.2$ export GPU_MAX_ALLOC_PERCENT=100
    kurt@miner01:~/Downloads/cgminer-3.7.2$ export GPU_USE_SYNC_OBJECTS=1
    kurt@miner01:~/Downloads/cgminer-3.7.2$ ./cgminer -n
    [2013-12-03 12:26:53] CL Platform 0 vendor: Advanced Micro Devices, Inc.
    [2013-12-03 12:26:53] CL Platform 0 name: AMD Accelerated Parallel Processing
    [2013-12-03 12:26:53] CL Platform 0 version: OpenCL 1.2 AMD-APP (1214.3)
    [2013-12-03 12:26:53] Error -1: Getting Device IDs (num)
    [2013-12-03 12:26:53] clDevicesNum returned error, no GPUs usable
    [2013-12-03 12:26:53] 0 GPU devices max detected
    [2013-12-03 12:26:53] USB all: found 12 devices - listing known devices
    [2013-12-03 12:26:53] No known USB devices

    1. I get the exact same problem, on 13.10, with a r9 290 gpu using newest drivers (13.11)...

    2. I get the EXACT same issue with R9 290s, tried SlackWare and Xubuntu. I'm just about to give up and go to Windows

    3. It sounds like a communication problem with the X server.
      If you run "lspci | grep VGA" and "cat /etc/X11/xorg.conf | grep BusID", do the numbers match up?

    4. Same issue here... r9 290 13.11 clinfo shows only cpu

    5. this is what I get:

      > lspci | grep VGA
      01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Hawaii PRO [Radeon R9 290]
      > cat /etc/X11/xorg.conf | grep BusID
      BusID "PCI:1:0:0"

      looks like they match up, no?

    6. It must be a problem unique to the newer generation of GPUs. I unfortunately do not have an R9 290 to test. I found several threads through Google with similar problems, a few of them suggested removing the APP SDK since the latest drivers supposedly have it included (but I thought that only applied to Windows, maybe that's not true anymore).

    7. getting this problem with 290 R9

      [2013-12-14 04:46:55] CL Platform 0 vendor: Advanced Micro Devices, Inc.
      [2013-12-14 04:46:55] CL Platform 0 name: AMD Accelerated Parallel Processing
      [2013-12-14 04:46:55] CL Platform 0 version: OpenCL 1.2 AMD-APP (1307.1)
      [2013-12-14 04:46:55] Platform 0 devices: 1
      [2013-12-14 04:46:55] 0 Hawaii
      [2013-12-14 04:46:55] Failed to ADL_Adapter_ID_Get. Error -1
      [2013-12-14 04:46:55] ADL found less devices than opencl!
      [2013-12-14 04:46:55] There is possibly more than one display attached to a GPU
      [2013-12-14 04:46:55] Use the gpu map feature to reliably map OpenCL to ADL
      [2013-12-14 04:46:55] WARNING: Number of OpenCL and ADL devices did not match!
      [2013-12-14 04:46:55] Hardware monitoring may NOT match up with devices!
      [2013-12-14 04:46:55] 1 GPU devices max detected

    8. I also had the same issue as Kurt on Debian Jessie (I tried install drivers for R9 290 to my Debian Wheezy but it was not work even with kernel from backports).
      I solve it by purge all Driver and SDK and install ONLY driver amd-catalyst-13.11-betaV9.95-linux-x86.x86_64 (which is acctualy 13.25), it also contain SDK!
      After that mining works but system hanged after closing cgminer (via "q" or ctrl+c), a could see "divide error: 0000" in syslog. It is some bug in driver or cgminer but it alsa fixed in cgminer fork sgminer. It's almost the same, but with some features and bugfixes included - my choise.
      Thanks for post!

    9. This comment has been removed by the author.

    10. I also had the exact same problem as reported above with my R9 290's when starting cgminer:
      Error -1: Error -1: Getting Device IDs (num)
      clDevicesNum returned error, no GPUs usable

      I found out that this happens because the OpenCL library that comes with the AMD APP SDK does not support the R9 290. The version of AMD APP SDK that ships with the 13.8 driver however does support the R9 290. The issue is that if you install the APP SDK, your system will automatically be set to use the wrong OpenCL library because the APP SDK installer modifies your /etc/profile file.
      First, use the following command to check which OpenCL library you are using:

      ldd /usr/bin/clinfo

      If you get ' => /opt/AMDAPP/lib/x68_64/' then you are using the wrong OpenCL version, supplied by APP SDK (it should be /usr/lib/fglrx/

      The issue is that the APP SDK installer modified your /etc/profile file with the following lines:

      export LD_LIBRARY_PATH

      The fix is to comment out or delete those two lines above in your /etc/profile file. In addition, the installer places two files in your /etc/ directory: amdapp_x86.conf and amdapp_x86_64.conf. You need to delete both files.
      After deleting both of the above files and making the change to your /etc/profile file, run the following command:


      and then restart. After restarting, run ldd /usr/bin/clinfo again and check to make sure that now points to /usr/lib/fglrx/
      Now, clinfo should show your cards and cgminer should no longer throw an error.

      You can see more info on this issue in the following thread:

    11. Also, if you run aticonfig and you get the following message:

      aticonfig: no supported adapters detected

      then you probably need to use a more recent fglrx driver. In order for my R9 290's to work, I needed to use the 13.11 driver. The 13.8 driver did not work for the R9 290's but it did work for my 7970's.

      When running cgminer -n, your OpenCL version should be:
      OpenCL 1.2 AMD-APP (1348.4)

    12. I have to thank you, Patrick. You saved my day!

    13. Thank you Patrick! Really helpful, even for a Linux newb.

    14. Patrick! Very helpful, even for a Linux veteran. :)

  5. Thank you for your nice post. I keep getting
    OpenCL...............: NOT FOUND. GPU mining support DISABLED
    It is a fresh 13.10 (Desktop) installation with 2xHD6990 cards. aticonfig --lsa sees the cards just fine.
    Catalyst-13.8-beta, ADL_SDK v6, AMD_APPSDK_v2.8
    Also tried Catalyst 13.11 and AMD_APPSDK_v2.9.
    Any help much appreciated.

    1. Btw, I am using cgminer 3.7.2

    2. Could you post the output of "lspci | grep VGA" and "cat /etc/X11/xorg.conf | grep BusID"?
      If you don't mind, could you post a pastebin of your /etc/X11/xorg.conf?
      Usually I've found that when cgminer can't find a GPU it's because of a problem with the X server configuration. I've had this problem so many times, but it's been something slightly different each time.i
      Are you running it from an SSH session or do you have a console up in a graphical environment?

    3. Thanks for your quick reply.
      cat /etc/X11/xorg.conf | grep BusID
      BusID "PCI:13:0:0"
      BusID "PCI:12:0:0"
      BusID "PCI:5:0:0"
      BusID "PCI:4:0:0"

      I was running a console in a graphical environment. (And now the Ubuntu top bar and sidebar are invisible....)
      In the meantime I wil retry with 13.04 headless.

    4. I have the same problem...

    5. Update:
      I tried again following instructions to the letter, thus 13.04 headless server + Catalyst-13.8-beta and AMD_APPSDK_v2.8.
      And now it works ;)
      Thanks! I'll donate when I've mined some coins.

    6. Attn. Kjetil and Co.
      There is a file i.e. /cgminer/ADL_SDK/readme.txt which asks for copying 2 files from /AMD-ADL-SDK/cgminer/ADL_SDK. Please read it and do so!
      After doing this it compiles for me with Catalyst v13.12, AMD APP SDK v2.9 and ADL SDK 6.0.

  6. Great write up dude, I will donate as soon as I have something

    1. thanks again for the excellent writeup, it's been very helpful, and as promised you should have .01 BTC awaiting in 1EBVjJSM7Qa1msYcU4AEFG3kLFimwXbAA9

  7. for what it's worth, I have gotten this working in basically every iteration of Ubuntu 12.04, 12.10, 13.10, minimal and desktop. I have used the ADK 5 and 6, and all worked, as long as I installed 13.8. These steps are really solid, thanks to the comments section as well. The wget was clutch.

    If you have Desktop installed simply skip the xdm step, has worked for me several times, before I just went 100% headless.

    the hardware has been only 7990s and 7950s

  8. would it still work if i do sudo update-rc.d xdm remove?

    1. If you have another way to run an X server, then maybe. But an X server has to be running and the user that runs cgminer needs to have access to it.

  9. verything Installed & compiles well but I don't have /etc/X11/xorg.conf. What I missed? gives only:
    Setting of real/effective user Id to 0/0 failed
    Setting of real/effective user Id to 0/0 failed
    Xubuntu 13.10

    1. If you don't have a xorg.conf, try running "sudo aticonfig --initial --adapter=all" and see if it creates one, then reboot.

  10. Now I have xorg.conf. But still: Setting of real/effective user Id to 0/0 failed

    spci | grep VGA
    01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cayman PRO [Radeon HD 6950]
    miner@miner-desktop:~/Downloads/cgminer$ cat /etc/X11/xorg.conf | grep BusID
    BusID "PCI:1:0:0"

    When booting I have XDM login. I go to first terminal (...F1) ./ & only:
    Setting of real/effective user Id to 0/0 failed

    I have onboard GPUalso , but I think it does not do anything with this?

    1. I got cgminer working. I don't know why did not work? & I reinstalled with GUI the driver... Getting a lot off hardware errors?

  11. Hello,

    I tried to beat it about a 3 days and always the same result. I was trying install 12.04.03 LTS, 13.04, 13.10, tried different catalysts 13.4, 13.8, 13.11. ADL 5.0, APP SDK 2.9. Also I tried different cgminers, from 2 till 3.7.2
    VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Pitcairn XT [Radeon HD 7870 GHz Edition] (prog-if 00 [VGA controller])

    leon@mine:~/cgminer$ ./cgminer -n
    No protocol specified
    [2013-12-17 07:25:32] CL Platform 0 vendor: Advanced Micro Devices, Inc.
    [2013-12-17 07:25:32] CL Platform 0 name: AMD Accelerated Parallel Processing
    [2013-12-17 07:25:32] CL Platform 0 version: OpenCL 1.2 AMD-APP (1348.4)
    [2013-12-17 07:25:32] Error -1: Getting Device IDs (num)
    [2013-12-17 07:25:32] clDevicesNum returned error, no GPUs usable
    [2013-12-17 07:25:32] 0 GPU devices max detected

    Thank you in advance,

  12. FYI need to run cgminer as sudo. This tripped me up BIG TIME.

    1. Yea, I think something was messed up with my Lubuntu install. I nuked it and went for this headless version. Works w/o sudo now.

  13. This probably has to be the best minimal miner setup :-) Thanks for posting!

    How do you autostart the cgminer with this setup on system boot?

    I can not seem to get it working from rc.local (with screen).

    1. I'm still trying to figure out how to start it at boot. I've gotten other things, like USB miners to start on boot, but I haven't gotten this one working yet.

      If I get it working, I'll add it to the guide. In the meantime, if you can get it working with rc.local and screen, let me know and I'll update the guide.

    2. crontab -e:
      @reboot cd /home/miner/cgminer; sleep 120; screen -S cgminer -d -m ./

      Seems to work OK for me. I have another cronjob as sudo to make sure cgminer is running. If not, it restart xdm and as user miner. Not sure about this restarting thing yet.

  14. Anyone else have 100% cpu usage while running cgminer? I don't know what the issue could be.

    1. According to the GPU-README Faq in cgminer it has to do with the version of the catalyst driver:

      Q: The CPU usage is high.
      A: The ATI drivers after 11.6 have a bug that makes them consume 100% of one
      CPU core unnecessarily so downgrade to 11.6. Binding cgminer to one CPU core on
      windows can minimise it to 100% (instead of more than one core). Driver version
      11.11 on linux and 11.12 on windows appear to have fixed this issue. Note that
      later drivers may have an apparent return of high CPU usage.

      Since AMD doesn't put a lot of effort in trying to keep their drivers compatible with different kernel versions I've been trying for days now to find a good combination. Also making legacy drivers work is THE HORROR. They sometimes don't even compile on a fresh install distro of that very time.

      Maybe we can put up a list together to see whats working?

      I'll start like this:

      Catalyst 13.11 beta V9.4 (=fglrx 13.25.5) + Kernel 3.8.0-27-generic on Ubuntu 13.04 64bit => cgminer 0,7%

      to find out what version of fglrx you're running type: dmesg | grep fglrx
      for kernel version: uname -a
      for cpu usage: top

    2. This comment has been removed by the author.

    3. Catalyst 13.11 beta V9.4 (=fglrx 13.25.5) + Kernel 3.8.0-27-generic on Ubuntu 13.04 64bit => cgminer 0,7%
      Catalyst 12.11 beta (=fglrx 9.1.11) + Kernel 3.8.0-19-generic on Ubuntu 13.04 64bit => cgminer 27%
      Catalyst 13.12 (=fglrx 13.25.5?) + Kernel 3.8.0-19-generic on Ubuntu 13.04 64bit => cgminer 19%

    4. I also encountered the 100% CPU usage problem recently:

      Catalyst 13.12, APP SDK 2.9 RC, kernel 3.8.0-35-generic, Ubuntu 13.04 64bit, sgminer 4.0.0 == 100% CPU usage

      Changing to Catalyst 13.8 beta did not help, but downgrading the APP SDK to 2.8 and recompiling sgminer seems to have fixed the problem, so:

      Catalyst 13.8 beta, APP SDK 2.8, kernel 3.8.0-35-generic, Ubuntu 13.04 64bit, sgminer 4.0.0 == <1%

      So, the problem might be in the APP SDK versions rather than the Catalyst versions.

  15. hi,
    I follow the steps and install everything without any errors.

    [2013-12-29 02:37:18] CL Platform 0 vendor: Advanced Micro Devices, Inc.
    [2013-12-29 02:37:18] CL Platform 0 name: AMD Accelerated Parallel Processing
    [2013-12-29 02:37:18] CL Platform 0 version: OpenCL 1.2 AMD-APP (1214.3)
    [2013-12-29 02:37:18] Platform 0 devices: 1
    [2013-12-29 02:37:18] 0 Pitcairn
    [2013-12-29 02:37:18] GPU 0 AMD Radeon HD 7800 Series hardware monitoring enabled
    [2013-12-29 02:37:18] 1 GPU devices max detected

    But cgminer don't accept any shares. I see hashrate speed and average hashrate.
    Any ideas?
    Thank you in advance,

    1. A few things to check:
      *Are you getting any HW errors?
      *Did you start cgminer with --scrypt? (if you're mining Litecoins)

    2. - no HW errors after 5 min of runing
      - I don't mine ltc at the moment. That is my current settings:
      "intensity" : "8",
      "worksize" : "256",
      "lookup-gap" : "2",
      "shaders" : "1024",
      "gpu-engine" : "900",
      "gpu-fan" : "45",
      "gpu-memclock" : "1200",
      "gpu-memdiff" : "0",
      "gpu-powertune" : "0",
      "gpu-vddc" : "0.000",
      "temp-cutoff" : "95",
      "temp-overheat" : "85",
      "temp-target" : "75",
      "log" : "5",
      "kernel-path" : "/usr/local/bin"

      - This is result of ./cgminer -c cgminer.conf -D -T --verbose :

      [2013-12-29 03:46:55] Generated target 00000000000000000000000000000000000000000000000000fcff0300000000
      [2013-12-29 03:46:55] Generated stratum work
      [2013-12-29 03:46:55] Pushing work from pool 0 to hash queue
      [2013-12-29 03:46:55] Work stale due to block mismatch
      [2013-12-29 03:46:55] Popping work from get queue to get work
      [2013-12-29 03:46:55] Got work from get queue to get work for thread 1
      [2013-12-29 03:46:55] Generated stratum merkle 07c1f7f8ab522fd5be3f96a35c33155cae925bb9c6dc4aca80ba4408307720b2
      [2013-12-29 03:46:55] Generated stratum header 0000000109b3ba3e9fafdf5298cbc8400c522f7a15e37cd2fc42a04c72ef2753ccc8db1107c1f7f8ab522fd5be3f96a35c33155cae925bb9c6dc4aca80ba4408307720b252bf7f0e1c05266200000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000
      [2013-12-29 03:46:55] Work job_id 67d nonce2 04000000 ntime 52bf7f0e
      [2013-12-29 03:46:55] Generated target 00000000000000000000000000000000000000000000000000fcff0300000000
      [2013-12-29 03:46:55] Generated stratum work
      [2013-12-29 03:46:55] Pushing work from pool 0 to hash queue
      [2013-12-29 03:46:56] [thread 1: 134217728 hashes, 127249.0 khash/sec]
      [2013-12-29 03:46:56] [thread 0: 134217728 hashes, 126038.1 khash/sec]
      [2013-12-29 03:46:56] 53.0 C F: 45%(2281RPM) E: 900MHz M: 1200Mhz V: 1.138V A: 99% P: 0%
      [2013-12-29 03:46:57] [thread 1: 134217728 hashes, 130594.4 khash/sec]
      [2013-12-29 03:46:57] [thread 0: 125829120 hashes, 122320.8 khash/sec]
      [2013-12-29 03:46:58] [thread 1: 125829120 hashes, 124355.5 khash/sec]
      [2013-12-29 03:46:58] [thread 0: 134217728 hashes, 126346.3 khash/sec]
      [2013-12-29 03:46:58] 53.0 C F: 45%(2272RPM) E: 900MHz M: 1200Mhz V: 1.138V A: 99% P: 0%
      ^C [2013-12-29 03:46:59] Received kill message
      [2013-12-29 03:46:59] Killing off HotPlug thread
      [2013-12-29 03:46:59] Killing off watchpool thread
      [2013-12-29 03:46:59] Killing off watchdog thread
      [2013-12-29 03:46:59] Stopping mining threads
      [2013-12-29 03:46:59] [thread 1: 134217728 hashes, 126891.6 khash/sec]
      [2013-12-29 03:46:59] Thread 1 being disabled
      [2013-12-29 03:46:59] Popping wakeup ping in miner thread
      [2013-12-29 03:46:59] [thread 0: 142606336 hashes, 138299.8 khash/sec]
      [2013-12-29 03:46:59] Thread 0 being disabled
      [2013-12-29 03:46:59] Popping wakeup ping in miner thread
      [2013-12-29 03:47:00] Killing off mining threads
      [2013-12-29 03:47:00] Killing off stage thread
      [2013-12-29 03:47:00] Killing off API thread
      [2013-12-29 03:47:00] Releasing all USB devices

  16. I noticed that the commands:
    sudo apt-get install xdm xorg
    Was needed before I installed the AMD drivers. Got loads of errors about X server before..

  17. Hi guys!

    Could anybody kindly supply with

    It is impossible to download it from the web.

    I'd like to try it out to resolve 100% CPU consumation by cgminer

    my email 6406640 at

    Thank you

    1. wget --referer=""

      still works

    2. It is!

      Thank you!

  18. I cannot get OpenCL to run headlessly here. That is, running it through an ssh session. If the machine starts up with xdm, I log in, then I can run OpenCL with the GPUs. If the machine starts up, and then I simply connect through an ssh session, the only device I can use OpenCL with is the processor. I'm running 2 5850's with a 6-core processor, for what it's worth. The output of clinfo on the logged in session (through xdm) shows both GPUs plus the CPU. The output of clinfo on the ssh session only shows the CPU. What am I doing wrong?

    1. Well, here are a few things I'd check: are you sure the $DISPLAY environment variable is set? If you log in through SSH and run "echo $DISPLAY", do you get ":0" or a blank line? If it's blank, try "export DISPLAY=:0" first and then "echo $DISPLAY" again to make sure it's set, then try to run an OpenCL application again. Also, it wouldn't hurt to double check if DisplayManager*authorize is set to false in xdm's config: "cat /etc/X11/xdm/xdm-config | grep authorize".

  19. Nevermind, the "export DISPLAY=:0" was what I was missing. Is there a way to configure OpenCL to use the DISPLAY of the ssh terminal? I do x-forwarding on ssh sessions as needed, so it would be nice to have graphical output show up on my ssh session rather than the computer monitor connected to my GPU-box.

    1. Hmm... I'm not sure exactly what you're trying to do, but if I understand correctly, trying to forward an X application on a terminal that has $DISPLAY set will cause the application to show up on the remote display rather than being forwarded. I usually put the "export DISPLAY=:0" line in a script that also starts sgminer, so when I run that script, the scope of the $DISPLAY variable is limited to just that script/process; so when I run "echo $DISPLAY" on my SSH session, it's still unset, and X apps won't try to start on the remote display (just tested it with xterm on my mining server and it worked).

    2. Hmmm, I see, I will try it. That's kind of a pain to execute every OpenCL program from within a script just to keep the DISPLAY variable limited to that process. On the OpenCL forums, someone wrote a guide to run OpenCL headless, without X server. I haven't tried it yet:

    3. Quick report: I tried (without installing xdm/xorg - 14.10+2.9+sg+adl6). It seems to work (as in sgminer starts hashing), but:
      - aticonfig (fglrx module issues) and sgminer (OpenCl device issues) throw errors
      - ADL doesn't work (no temps)

      I didn't dick around further. The gain is minimal, if any. It's just a few MBs more for xorg/xdm - the current proposed install is very clean in comparison.

  20. Hey there,

    thanks from me too for the detailed guide. Sadly I'm stuck with the same problem that cgminer can't find a gpu on boot. I have an 7850 like you do, so it's not an hardware issue.

    Since I installed xdm next to lightdm cgminer now doesn't even find a gpu when starting on command line. This was working before.
    It has been puzzling me all day, I guess xdm installed a newer version of xorg-server which is incompatible with the latest ati drivers.

    I'll setup the system again from scratch as I've been trying to fix it all day, but I'm still not sure if cgminer will start on boot, as I first set up the system in a way similar to yours. Anyway, all help or ideas will be appreciated.

    CU, Robert.

  21. Hello great guide, thank you very much! I am now running cgminer on a headless ubuntu server. I have one issue though. I start cgminer and after a while everything is soooooo slow. I mean cpu usage is at 0-1% but everything is lagging like hell. I type letters in the ssh connection and they appear with delays between them. If i try to open files to edit them it takes minutes. Its kinda weird. I am using the ATI driver suggested here, SDK 2.9, ADL 6.

  22. Great post, I appreciate you and I would like to read your next post.Thanks for creating this informative post.

    Windows Thin Client & Citrix Thin Client

  23. Disable Authorization on xdm
    (if you know of a better way to do this, please tell me...)

    sudo -s
    #enter password
    sed -i 's/DisplayManager\*authorize:.*true/DisplayManager\*authorize: false/' /etc/X11/xdm/xdm-config

  24. Great information, I really like all your post. I will keep visiting this blog very often. It’s good to visit your website. And also please Read link bvba Woodstone which provide information server monitoring software & Network monitoring tools

  25. Excellent blog ,,,, its helps you to remove your rundll problem click this site How To Remove Rundll Error Free from error.
    Thank you
    Aalia lyon

  26. This comment has been removed by the author.

  27. As a veteren Linux user, software and hardware engineer, I should speak up.

    If you want to use ATI / AMD graphics cards use the CGMiner 3.7.2 (for Ubuntu only) use Ubuntu 14.04 not 13.04:

    sudo apt-get install -y libcurl4-openssl-dev pkg-config libtool libncurses5-dev

    The -y" is an automatic yes to the question to download those files, makes it quicker.

    Download and install the latest in repository FGLRX driver from AMD,

    Note: AMD Catalyst 13.9 ~ 14.6 should be paired with ADL SDK 7.0 and AMD APP v2.9 not v2.9.1. Also, get the correct download
    for your architecture. Once the Catalyst is installed type this in terminal:

    sudo amdconfig -f --initial

    Use "uname -i" without double quotes in terminal to figure out which version you need of the AMD APP SDK. Mine happens to say, i686 which is 32-bit, if you see i386, that's 32-bit as well, if you see x86_64 that 64-bit. You match the bit edition with your OS.

    Once, you've downloaded and installed the AMD APP SDK you need to reboot (again).

    Depends on if you get CGMiner from the authors site or if you get it from github.

    If you get it from his site you do the following:

    1. Download and unarchive the files into a directory of your choosing.
    2. Get into that directory, look for the sub directory or folder "ADL_SDK"
    3. Download and unzip the AMD ADL 7.0 on your desktop, get into the ADL includes directory in that and copy, those 3 files
    into the ADL_SDK directory for CGminer. You might have to change ownership of two of the files. What you do is this, get into
    terminal in that directory and type the following:

    sudo chown user:user *.h

    Now user, is your username you use in Ubuntu, for example your name could be cgmineruser, so it would be:

    sudo chown cgmineruser:cgmineruser *.h

    What this does when you enter your username and a colon and username again is change ownership of the include files so that when CGMiner goes to access the files to compile it won't run into problems. The lock symbol files are owned by root, which when you change ownership, you taking ownership of the files from root.

    Then get back into your main cgminer directory.

    3. Enter in this command in terminal.

    ./configure --enable-scrypt --enable-opencl

    4. Then type this command in terminal.

    sudo make install

    5. At which time if everything is pair up correctly and your not missing anything.

    cgminer -n

    That should show your GP-GPU boards and mention OpenCL has found them. Now, the fun part, getting you set up for solo or pool mining. That's for another time and place.

    The shell files listed above do work, just have to make sure CGMiner works first before you go headless mining.

  28. Thanks for the useful information.Your blog is really informative.
    Web apps24x7 have global monitoring station to use check your server status.Download this

  29. Excellent blog ,,,, its helps you to remove your rundll problem Click this Website How To Remove Rundll Error Free from error.