Linux installation error: cudaGetDeviceCount returned 30 -> unknown error

I am trying to install Cuda on my system.
I have a Dell XPS9560 laptop with an NVidia GeForce GTX Mobile GPU. My OS is Arch Linux 64-bit.
I tried to install Cuda 8 and then Cuda 9 but they both fail. I was able to narrow down the error using the deviceQuery utility from the samples:

$ ./deviceQuery 
./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL

My device is neither found or not found: an unknown error occurs. This message is not very helpful so I don’t know where to look for more information.

Here is the detected name of my GPU: GeForce GTX 1050 Mobile

$ lspci | grep -i nvidia
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)

In the list of supported GPUs, only the “desktop” GeForce GTX 1050 GPU is listed, but a moderator confirmed the the laptop version is also supported and the list is not synced.

Here is my driver version with additional info: 387.34 (Package)

$ nvidia-smi -a

==============NVSMI LOG==============

Timestamp                           : Mon Dec 11 14:56:40 2017
Driver Version                      : 387.34

Attached GPUs                       : 1
GPU 00000000:01:00.0
    Product Name                    : GeForce GTX 1050
    Product Brand                   : GeForce
    Display Mode                    : Disabled
    Display Active                  : Disabled
    Persistence Mode                : Disabled
    Accounting Mode                 : Disabled
    Accounting Mode Buffer Size     : 1920
    Driver Model
        Current                     : N/A
        Pending                     : N/A
    Serial Number                   : N/A
    GPU UUID                        : GPU-d8675584-441c-45f0-59a6-db42d4cca53c
    Minor Number                    : 0
    VBIOS Version                   : 86.07.3E.00.1C
    MultiGPU Board                  : No
    Board ID                        : 0x100
    GPU Part Number                 : N/A
    Inforom Version
        Image Version               : N/A
        OEM Object                  : N/A
        ECC Object                  : N/A
        Power Management Object     : N/A
    GPU Operation Mode
        Current                     : N/A
        Pending                     : N/A
    GPU Virtualization Mode
        Virtualization mode         : None
        Bus                         : 0x01
        Device                      : 0x00
        Domain                      : 0x0000
        Device Id                   : 0x1C8D10DE
        Bus Id                      : 00000000:01:00.0
        Sub System Id               : 0x07BE1028
        GPU Link Info
            PCIe Generation
                Max                 : 3
                Current             : 3
            Link Width
                Max                 : 16x
                Current             : 16x
        Bridge Chip
            Type                    : N/A
            Firmware                : N/A
        Replays since reset         : 0
        Tx Throughput               : 0 KB/s
        Rx Throughput               : 0 KB/s
    Fan Speed                       : N/A
    Performance State               : P0
    Clocks Throttle Reasons
        Idle                        : Not Active
        Applications Clocks Setting : Not Active
        SW Power Cap                : Not Active
        HW Slowdown                 : Not Active
            HW Thermal Slowdown     : Not Active
            HW Power Brake Slowdown : Not Active
        Sync Boost                  : Not Active
        SW Thermal Slowdown         : Not Active
    FB Memory Usage
        Total                       : 4041 MiB
        Used                        : 0 MiB
        Free                        : 4041 MiB
    BAR1 Memory Usage
        Total                       : 256 MiB
        Used                        : 2 MiB
        Free                        : 254 MiB
    Compute Mode                    : Default
        Gpu                         : 2 %
        Memory                      : 0 %
        Encoder                     : 0 %
        Decoder                     : 0 %
    Encoder Stats
        Active Sessions             : 0
        Average FPS                 : 0
        Average Latency             : 0
    Ecc Mode
        Current                     : N/A
        Pending                     : N/A
    ECC Errors
            Single Bit            
                Device Memory       : N/A
                Register File       : N/A
                L1 Cache            : N/A
                L2 Cache            : N/A
                Texture Memory      : N/A
                Texture Shared      : N/A
                CBU                 : N/A
                Total               : N/A
            Double Bit            
                Device Memory       : N/A
                Register File       : N/A
                L1 Cache            : N/A
                L2 Cache            : N/A
                Texture Memory      : N/A
                Texture Shared      : N/A
                CBU                 : N/A
                Total               : N/A
            Single Bit            
                Device Memory       : N/A
                Register File       : N/A
                L1 Cache            : N/A
                L2 Cache            : N/A
                Texture Memory      : N/A
                Texture Shared      : N/A
                CBU                 : N/A
                Total               : N/A
            Double Bit            
                Device Memory       : N/A
                Register File       : N/A
                L1 Cache            : N/A
                L2 Cache            : N/A
                Texture Memory      : N/A
                Texture Shared      : N/A
                CBU                 : N/A
                Total               : N/A
    Retired Pages
        Single Bit ECC              : N/A
        Double Bit ECC              : N/A
        Pending                     : N/A
        GPU Current Temp            : 42 C
        GPU Shutdown Temp           : 102 C
        GPU Slowdown Temp           : 97 C
        GPU Max Operating Temp      : 94 C
        Memory Current Temp         : N/A
        Memory Max Operating Temp   : N/A
    Power Readings
        Power Management            : N/A
        Power Draw                  : N/A
        Power Limit                 : N/A
        Default Power Limit         : N/A
        Enforced Power Limit        : N/A
        Min Power Limit             : N/A
        Max Power Limit             : N/A
        Graphics                    : 1354 MHz
        SM                          : 1354 MHz
        Memory                      : 3504 MHz
        Video                       : 1215 MHz
    Applications Clocks
        Graphics                    : N/A
        Memory                      : N/A
    Default Applications Clocks
        Graphics                    : N/A
        Memory                      : N/A
    Max Clocks
        Graphics                    : 1911 MHz
        SM                          : 1911 MHz
        Memory                      : 3504 MHz
        Video                       : 1708 MHz
    Max Customer Boost Clocks
        Graphics                    : N/A
    Clock Policy
        Auto Boost                  : N/A
        Auto Boost Default          : N/A
    Processes                       : None

I installed Cuda using the package manager: Cuda 9, Cuda 8

Thank you in advance for any help regarding my issue. I’d like to at least find a way to get a better description of the error to understand what went wrong.

I solved my issue by doing a cold reboot of my computer. I previously tried a logout/login because it was mentioned on some posts but it did not work. A cold reboot did the trick.
I mostly regret that the error message was so cryptic but I am now able to use CUDA 9.

I solved the issue in the same way as @demurgos: cold reboot.

Thank you @demurgos. It worked after a reboot. I think rebooting the kernal might also solve the problem.

Reboot also fixed it for me. Thanks!

Is cold reboot the same as shutting down your laptop and starting up again?

Yes, it is.

Thank you all, reboot worked for me too!!

Hi everyone,

I am running the following kernel :

void query_device()
int deviceCount = 0;
cudaError err = cudaGetDeviceCount(&deviceCount);
printf(“error %d\n”, err);

if (deviceCount == 0)
printf(“No CUDA support device found”);

cudaGetDeviceCount() also returns 30. After I sudo reboot, the issue does not go away. I am running everything in Ubuntu 16.04.6, with CUDA 7.5 and using a Tesla C2070 with driver version 387.26.

According to:
Screen Shot 2020-05-03 at 5.01.49 PM
taken from, my driver and CUDA version are compatible.
Did anyone else find a different fix to this issue?
Thank you.

I just came across this question and since just found different solution while impossible to resolve with simple reboot: check if your Fabric Manager service is up and running:
(sudo) systemctl status nvidia-fabricmanager.service