NVIDIA-SMI has failed / nvmlInit(): Driver Not Loaded

Hello.

I am installing nvidia drivers and cuda on a new msi laptop and I am having problems to make it running.

I kept the 430 driver on ubuntu 18.04 installed by default and it seen not working.

I installed driver 440 using the .run file and it looks like it has been properly installed:

Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X?  Any pre-existing X configuration file will be backed up. (Answer: Yes)
-> Your X configuration file has been successfully updated.  Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 440.44) is now complete.

After that I installed

sudo apt-get install --no-install-recommends \
    cuda-10-0 \
    libcudnn7=7.6.2.24-1+cuda10.0  \
    libcudnn7-dev=7.6.2.24-1+cuda10.0

Looks like everything is installed property but GPU can’t be accessed

/usr/bin/nvidia-debugdump -D

Error: nvmlInit(): Driver Not Loaded
/usr/bin/nvidia-smi --query

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
/usr/bin/nvidia-smi --query --unit

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 tried to uninstall the .run, and install manually

sudo apt install nvidia-driver-430

but the problem persist.

right now on ubuntu settings it is using:

Graphics: Intel® UHD Graphics 630 (Coffeelake 3x8 GT2)

Kind Regards

Please run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post of yours will reveal a paperclip icon.
https://devtalk.nvidia.com/default/topic/1043347/announcements/attaching-files-to-forum-topics-posts/

I manage to install 430 driver using .run on secure boot and signing with private and public keys manually generated. Now everything is running fine.

Following the steps in case any other have the same problem:

sudo apt purge nvidia-*
sudo autoremove
sudo apt install pkg-config

openssl req -new -x509 -newkey rsa:2048 -keyout PATH_TO_PRIVATE_KEY -outform DER -out PATH_TO_PUBLIC_KEY -nodes -days 36500 -subj "/CN=Graphics Drivers"

sudo mokutil --import PATH_TO_PUBLIC_KEY

--> sudo reboot --> accept MOK --> reboot

echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf; sudo update-initramfs -u

sudo telinit 3

sudo sh ./NVIDIAXXXXXX.run -s --module-signing-secret-key=PATH_TO_PRIVATE_KEY --module-signing-public-key=PATH_TO_PUBLIC_KEY

check nvidia-smi connect to kernel and display the driver and CUDA version

After installation, the problem was that only HDMI output was working, after reset xorg config I manage to have the laptop screen running as well (previously black):

sudo rm xorg.conf
sudo cp xorg.conf.nvidia-xconfig-original xorg.conf

Do you know why the apt-get install is not working?

I have cuda 10.1. that is installed by default with the driver. What is the best way to install 10.0?

Following this procedure is Unable to locate package cuda-10-0

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get update
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt-get update
sudo apt-get install --no-install-recommends \
    cuda-10-0 \
    libcudnn7=7.6.2.24-1+cuda10.0  \
    libcudnn7-dev=7.6.2.24-1+cuda10.0

Kind Regards

Rather just install the cuda-toolkit, installing ‘cuda’ will overwrite the already installed driver with the bundled one.
sudo apt install cuda-toolkit-10-0
The way you installed the driver now will break on kernel update. Installing the driver from repo with secure boot enabled will either require to select “install third-party software” on Ubuntu install or afterwards using
update-secureboot-policy
to enroll/create keys for dkms.