While installing CUDA 10.1 (via the network deb) on Ubuntu 18.10, I was asked to set up a password for Mok. When I rebooted my computer I was met with the Mok Manager blue screen, where I presume I was supposed to use the previously set up password. However, instead of choosing Enroll MOK, I accidentally continued with the boot.

After booting, nvcc --version returned the correct output (10.1) but when I tried to check my drivers using nvidia-smi I got:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

I figured that this was a result of skipping the MOK Enroll, so I tried rebooting but the blue MOK screen did not reappear. I tried following some guides in an effort to get back to that screen, but I wasn't able to do so. Also, interestingly, now running nvcc--version returns

Command 'nvcc' not found, but can be installed with:

sudo apt install nvidia-cuda-toolkit

This is especially strange because an nvcc executable can be found in /usr/local/cuda/bin. I am unsure of how to proceed from here. I have narrowed it down to the following options:

  1. Disable secure boot (apparently it can mess with nvidia drivers). I don't know if this will help or worsen the situation. I am also unsure of how to do this on my system.
  2. Somehow get back to the blue MOK screen and choose the MOK enroll option. I have tried doing this but haven't been successful.
  3. Remove everything related to nvidia from my computer and reinstall nvidia drivers, then reinstall CUDA. I'm not sure if this is good enough or if there is a deeper issue.
  4. It is possible that the correct problem/solution is something else entirely, in which case any of the above might make the problem worse.

If it is helpful, here is the output of ubuntu-drivers devices (excluding the modalias):

vendor   : NVIDIA Corporation
model    : GM107M [GeForce GTX 960M]
driver   : nvidia-driver-418 - third-party free recommended
driver   : nvidia-driver-390 - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

I am currently running a dual boot system with Windows 10 and Ubuntu 18.10 (which might have implications for my MOK/GRUB situation). According to lspci -nnk | grep -i vga -A3 my Intel graphics driver is currently in use. Here is the output of lspci | grep -i nvidia:

01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)

My end goal was to set up CUDA and cuDNN for PyTorch. I would greatly appreciate any help with how to move forward.

2 Answers 2


I missed the MOK screen too and it didn't show up on the next reboot. The solution was to run

sudo mokutil --import /var/lib/shim-signed/mok/MOK.der

from a terminal. You'll be prompted to choose a password, and then when you reboot the MOK enrollment screen will appear again. Choose to enroll, choose the key, and re-enter the password.

Credit to this post on the NVIDIA forums for helping me find the key.

  • This solution is simple and effective. Thank you!
    – chunjiw
    Apr 16, 2020 at 17:44
  • This no longer seems to work? Ubuntu 20.04.05. the mokutil command didn't give any errors but I also did not get mok screen on boot. Jan 3 at 19:30
  • @DustinWyatt it worked for me on 20.04.6 . So maybe you didn't miss the initial MOK screen, it actually worked the firs time for you ? Sep 25 at 15:06

Turns out the solution was pretty straightforward.

"Disappearing" nvcc:

I had added the path variable seen below to my current terminal instance, but I had not added it to ~/.bashrc (this means nvcc worked only in that terminal instance, hence the "disappearing" later issue). There may also be a ~/.profile file, but it seems that bashrc is read first if present, so you may need to add it to a different file depending on your available files. This is a good resource if you aren't sure: https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix

export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.1${PATH:+:${PATH}}

Driver Issues:

I solved all my driver issues by disabling Secure Boot. In my case, I did not need to hold down a key while booting to open up the settings for this. Instead, when I start up and arrive at the GRUB screen to choose my OS, I choose System Settings. Here the Secure Boot setting is available. Just disable, apply, and exit. This may be a hack, but nvidia-smi works correctly now, and I have verified that PyTorch is connected to CUDA and is using the GPU correctly. I'm pretty sure this also means I don't need to worry about that MOK Enroll screen anymore.

  • 1
    Nice job. I think you're right about the MOK Enroll after disabling secure boot, I did the same and I never saw it again. Mar 4, 2019 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .