Installing Nvidia-396 on Ubuntu Mate laptop

I tried to ask this question at the Ubuntuforums, but nobody could help me because they didn't understand how Mate works with graphics cards. I was adviced to switch to the regular Ubuntu, but I really like Mate so I want to see if I can make it work first.

The situation is that I have a problem with using the Nvidia-396 driver on a laptop running Mate 18.04.

I have a brand new HP Pavilion Power 15-CB084NO laptop with a Nvidia Geforce GTX 1050 graphics card, and I'm trying to use an external monitor connected via HDMI. However, Ubuntu Mate doesn't detect any signal from the monitor when I'm in "Monitor Preferences" and pressing "Detect Monitors." (Windows 10 can detect the monitor on the same laptop, so it's not a hardware problem.)

I have installed nvidia-driver-396, and in "Software & Updates / Additional Drivers," it appears that it's working (see screenshot below):

But for some reason, it's using the Intel driver instead of the Nvidia driver, and that this is the reason why I can't get a signal on the external monitor.

When I type "cat /var/log/gpu-manager.log" in terminal, a part of the reply is:

Is nvidia loaded? no
Was nvidia unloaded? no
Is nvidia blacklisted? no
Is intel loaded? yes
Is radeon loaded? no
Is radeon blacklisted? no
Is amdgpu loaded? no
Is amdgpu blacklisted? no
Is amdgpu versioned? no
Is amdgpu pro stack? no
Is nouveau loaded? no
Is nouveau blacklisted? yes
Is nvidia kernel module available? yes
Is amdgpu kernel module available? no

So, what am I doing wrong? Does anybody know how to fix this in Mate?

Dear Redchili,

Do you happen to have “nvidia-settings” installed?

Best,
M

Yes, it’s installed, but nothing happens if I try to launch it.

Dear Redchili,

Could you please be so kind as to launch it from terminal and send the results? It seems as if the driver exists, but is not loaded. Also, lsmod results might show it or not. If you can get nvidia settings to work, you can choose the driver easily from the gui, but that may take us a bit.
I suspect one of the old hands with Mate can help more, because there appear to be some Mate issues that are separate from Debian or Ubuntu, but let us start with the terminal output of both commands.

best,
M

When I try to start it from terminal, I get the following error message:

ERROR: NVIDIA driver is not loaded
ERROR: Unable to load info from any available system

lsmod gives:

Module Size Used by
ipmi_devintf 20480 0
ipmi_msghandler 53248 1 ipmi_devintf
btrfs 1130496 0
zstd_compress 163840 1 btrfs
xor 24576 1 btrfs
raid6_pq 114688 1 btrfs
ufs 77824 0
qnx4 16384 0
hfsplus 106496 0
hfs 57344 0
minix 32768 0
ntfs 102400 0
msdos 20480 0
jfs 188416 0
xfs 1200128 0
libcrc32c 16384 1 xfs
rfcomm 77824 16
ccm 20480 6
cmac 16384 1
bnep 20480 2
nls_iso8859_1 16384 3
uvcvideo 86016 0
intel_rapl 20480 0
videobuf2_vmalloc 16384 1 uvcvideo
videobuf2_memops 16384 1 videobuf2_vmalloc
videobuf2_v4l2 24576 1 uvcvideo
videobuf2_core 40960 2 videobuf2_v4l2,uvcvideo
x86_pkg_temp_thermal 16384 0
videodev 184320 3 videobuf2_core,videobuf2_v4l2,uvcvideo
hp_wmi 16384 0
wmi_bmof 16384 0
sparse_keymap 16384 1 hp_wmi
intel_powerclamp 16384 0
coretemp 16384 0
media 40960 2 videodev,uvcvideo
snd_hda_codec_hdmi 49152 1
rtsx_pci_ms 20480 0
kvm 598016 0
irqbypass 16384 1 kvm
crct10dif_pclmul 16384 0
crc32_pclmul 16384 0
snd_hda_codec_realtek 106496 1
snd_hda_codec_generic 73728 1 snd_hda_codec_realtek
ghash_clmulni_intel 16384 0
pcbc 16384 0
arc4 16384 2
memstick 16384 1 rtsx_pci_ms
snd_hda_intel 40960 5
snd_hda_codec 126976 4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek
snd_hda_core 81920 5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
btusb 45056 0
snd_hwdep 20480 1 snd_hda_codec
aesni_intel 188416 6
aes_x86_64 20480 1 aesni_intel
snd_pcm 98304 5 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_core
iwlmvm 364544 0
mac80211 778240 1 iwlmvm
btrtl 16384 1 btusb
btbcm 16384 1 btusb
btintel 16384 1 btusb
bluetooth 548864 43 btrtl,btintel,btbcm,bnep,btusb,rfcomm
crypto_simd 16384 1 aesni_intel
ecdh_generic 24576 2 bluetooth
snd_seq_midi 16384 0
snd_seq_midi_event 16384 1 snd_seq_midi
glue_helper 16384 1 aesni_intel
cryptd 24576 3 crypto_simd,ghash_clmulni_intel,aesni_intel
iwlwifi 282624 1 iwlmvm
cfg80211 622592 3 iwlmvm,iwlwifi,mac80211
intel_cstate 20480 0
snd_rawmidi 32768 1 snd_seq_midi
intel_rapl_perf 16384 0
snd_seq 65536 2 snd_seq_midi,snd_seq_midi_event
joydev 24576 0
input_leds 16384 0
snd_seq_device 16384 3 snd_seq,snd_seq_midi,snd_rawmidi
serio_raw 16384 0
snd_timer 32768 2 snd_seq,snd_pcm
snd 81920 20 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_pcm,snd_rawmidi
hp_accel 28672 0
lis3lv02d 20480 1 hp_accel
input_polldev 16384 1 lis3lv02d
soundcore 16384 1 snd
mei_me 40960 0
mei 90112 1 mei_me
wmi 24576 2 hp_wmi,wmi_bmof
hp_wireless 16384 0
shpchp 36864 0
intel_pch_thermal 16384 0
acpi_pad 180224 0
processor_thermal_device 16384 0
int340x_thermal_zone 16384 1 processor_thermal_device
int3400_thermal 16384 0
intel_soc_dts_iosf 16384 1 processor_thermal_device
acpi_thermal_rel 16384 1 int3400_thermal
mac_hid 16384 0
sch_fq_codel 20480 6
parport_pc 36864 0
ppdev 20480 0
lp 20480 0
parport 49152 3 parport_pc,lp,ppdev
ip_tables 28672 0
x_tables 40960 1 ip_tables
autofs4 40960 2
mmc_block 36864 2
hid_generic 16384 0
uas 24576 0
usbhid 49152 0
usb_storage 69632 2 uas
hid 118784 2 usbhid,hid_generic
i915 1617920 3
rtsx_pci_sdmmc 24576 0
i2c_algo_bit 16384 1 i915
drm_kms_helper 172032 1 i915
syscopyarea 16384 1 drm_kms_helper
sysfillrect 16384 1 drm_kms_helper
sysimgblt 16384 1 drm_kms_helper
fb_sys_fops 16384 1 drm_kms_helper
r8169 86016 0
psmouse 147456 0
rtsx_pci 65536 2 rtsx_pci_sdmmc,rtsx_pci_ms
mii 16384 1 r8169
drm 401408 4 drm_kms_helper,i915
ahci 36864 2
libahci 32768 1 ahci
video 45056 1 i915

Module is clearly not loading.
What happens when you try sudo modprove nvidia?
If nothing, can you try install module-assistant and installing that way? It should install all the necessary headers and build dependencies.

sudo: modprove: command not found

Maybe you really meant sudo modprobe nvidia:

modprobe: ERROR: could not insert 'nvidia': Required key not available

install module-assistant:

install: missing destination file operand after 'module-assistant'
Try 'install --help' for more information.

required key not available is usually an error if secure boot is enabled and one tries to install proprietary drivers.

sorry about typo, not enough sleep.

I am sorry, I should have written whole command:

 sudo apt-get install module-assistant

This should work as your kernel is signed, and you are merely adding a module to a signed kernel.

It will give clear instructions. Keep in touch please. I used to go through this a lot.

I don't have secure boot enabled on my machine.

Okay, so I installed the module-assistant, and when I run it, I choose to work on the nvidia-kernel. When I try to build that kernel, it tells me that the source package may not be installed and asks if I want to install it. When I press yes, I get the following error message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package nvidia-kernel-source is a virtual package provided by:
nvidia-kernel-source-390:i386 390.87-0ubuntu0~gpu18.04.1
nvidia-kernel-source-410 410.73-0ubuntu0~gpu18.04.1
nvidia-kernel-source-396 396.54-0ubuntu0~gpu18.04.1
nvidia-kernel-source-390 390.87-0ubuntu0~gpu18.04.1
You should explicitly select one to install.

W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Package 'nvidia-kernel-source' has no installation candidate

Can you try to install nvidia-kernel-source-396 via apt or synaptic? module assistant can be a pain, but it usually works. if you have all your kernel headers and nvidia source installed it will build, and since you do not have secure boot enabled it will install. I am just perplexed now as to why it will not load with sudo modprobe…

also, to build, you may need nvidia-dkms-396, and a whole bunch of other stuff.

I am not sure why mate uses the 396 version, I have 390 in plain old ubuntu, but I am sure there is a reason.

at any rate, there is indeed a kernel source. It might be easier to install synaptic, so you can see the nvidia stuff graphically.

Just to make it easy so people can see which nvidia packages you actually have, can you please be so kind as to run?

aptitude search "nvidia.* ~i"

aptitude search "nvidia.* -i" returns:

v libnvidia-ifr1 -
v libnvidia-ifr1:i386 -
p libnvidia-ifr1-390 - NVIDIA OpenGL-based Inband Frame Readback
p libnvidia-ifr1-390:i386 - NVIDIA OpenGL-based Inband Frame Readback
v libnvidia-ifr1-390:i386 -
i A libnvidia-ifr1-396 - NVIDIA OpenGL-based Inband Frame Readback
i A libnvidia-ifr1-396:i386 - NVIDIA OpenGL-based Inband Frame Readback
v libnvidia-ifr1-396:i386 -
p libnvidia-ifr1-410 - NVIDIA OpenGL-based Inband Frame Readback
p libnvidia-ifr1-410:i386 - NVIDIA OpenGL-based Inband Frame Readback
v libnvidia-ifr1-410:i386 -
v nvidia-opencl-icd -
v nvidia-opencl-icd:i386 -
p nvidia-opencl-icd-304 - NVIDIA OpenCL ICD
p nvidia-opencl-icd-304:i386 - NVIDIA OpenCL ICD
p nvidia-opencl-icd-304-updates - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-304-updates:i - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-331 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-331:i386 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-331-updates - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-331-updates:i - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-340 - NVIDIA OpenCL ICD
p nvidia-opencl-icd-340:i386 - NVIDIA OpenCL ICD
p nvidia-opencl-icd-340-updates - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-340-updates:i - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-346 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-346:i386 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-346-updates - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-346-updates:i - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-352 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-352:i386 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-352-updates - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-352-updates:i - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-361 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-361:i386 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-361-updates - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-361-updates:i - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-367 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-367:i386 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-375 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-375:i386 - Transitional package for nvidia-opencl-icd
p nvidia-opencl-icd-384 - Transitional package for nvidia-headless-3
p nvidia-opencl-icd-384:i386 - Transitional package for nvidia-headless-3
p nvidia-opencl-icd-387 - Transitional package for nvidia-compute-39
p nvidia-opencl-icd-387:i386 - Transitional package for nvidia-compute-39
p nvidia-opencl-icd-390 - Transitional package for nvidia-compute-39
p nvidia-opencl-icd-390:i386 - Transitional package for nvidia-compute-39

If I try to install nvidia-kernel-source-396 via the terminal, I get:

Reading package lists... Done
Building dependency tree
Reading state information... Done
nvidia-kernel-source-396 is already the newest version (396.54-0ubuntu0~gpu18.04.1).
nvidia-kernel-source-396 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.

In Synaptic Package Manager, when I search for "nvidia 396" I have all options installed except for nvidia-headless-396 and nvidia-headless-no-dkms-396.

OK, i synaptic just search for nvidia, omit the 396.

What I am not seeing in the aptitude search is something I expected, although mine is 390, to wit:

i A nvidia-dkms-390 - NVIDIA DKMS package
i A nvidia-driver-390 - NVIDIA driver metapackage
i A nvidia-kernel-common-390 - Shared files used with the kernel module
i A nvidia-kernel-source-390 - NVIDIA kernel source package
i A nvidia-prime - Tools to enable NVIDIA's Prime

I would expect aptitude to return those things, since without them, the kernel module cannot be built.

Please try to use synpatic or apt-get to install nvidia-driver-396, since that should pull in the other packages, unless synaptic says it is installed and aptitude does not, in which case, there is a problem with apt-get, and that is involved.

I am running out of ideas, but before I did anything, I would now run

dpkg --configure -a'

just in case the script that the distro uses to compile and install the module did not for some reason work.

then use synaptic to install or reinstall "nvidia-driver- 396" and see what happens.

Normally, I simply wait until a distro is installed and use apt-get or synaptic or aptitude to install things like this, so I can troubleshoot if something takes a bif of a wrong turn, but you will get this done, I am sorry is appears so tricky.

I have not done a source install from the nvidia website download in a while, but that always works, presuming you are comfortable working in the terminal without a graphic interface loaded, and build and install all the requisite stuff by command. You seem to know how to do this, so keep going.

best,
martin