How to enable NVIDIA?

17,791

Solution 1

June 3, 2019 Update

Nvidia needs a working Xorg installation to operate within. As your current Xorg Gnome desktop is broken you can try the Unity Desktop to get nVidia drivers working first.

sudo apt-get install unity-session
sudo apt-get install lightdm 
  • And using TAB key select lightdm between "gdm3" and "lightdm" choices there, and press ENTER key to go.

I have a GTX 970M but I know this driver also works with the GTX 1060M which is one step above yours:

$ sudo ubuntu-drivers devices

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
model    : GM204M [GeForce GTX 970M]
vendor   : NVIDIA Corporation
modalias : pci:v000010DEd000013D8sv00001028sd00000708bc03sc02i00
driver   : nvidia-384 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

$ dmesg | grep -i nvidia

[    1.760813] nvidia: loading out-of-tree module taints kernel.
[    1.760817] nvidia: module license 'NVIDIA' taints kernel.
[    1.763857] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    1.771538] nvidia-nvlink: Nvlink Core is being initialized, major device number 242
[    1.771720] nvidia 0000:01:00.0: enabling device (0006 -> 0007)
[    1.771858] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  384.130  Wed Mar 21 03:37:26 PDT 2018 (using threaded interrupts)
[    1.778086] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  384.130  Wed Mar 21 02:59:49 PDT 2018
[    1.779773] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[    1.779774] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 1
[    4.866848] nvidia-uvm: Loaded the UVM driver in 8 mode, major device number 240
[    5.248695] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input9
[    8.877159] nvidia-modeset: Allocated GPU:0 (GPU-30fab9bc-fe6f-ec05-e8e6-c151a1a96121) @ PCI:0000:01:00.0

If you need sound turned on for your nVidia HDMI and most manufacturers these days have it powered off, then you need to use this:

Here is someone that has taken the prime-select code and patched it because it wouldn't switch from nvidia to intel. If his patch doesn't help you perhaps he can?

Solution 2

Your reported symptoms exactly match the case of having an installed Nvidia driver, but logging in with wayland. At the login screen, click on the little gear next to the signin button, and select a non-wayland choice. Proceed to login, and the nvidia-settings should be fully functional.

Share:
17,791
FedKad
Author by

FedKad

Retired system administrator / programmer

Updated on September 18, 2022

Comments

  • FedKad
    FedKad almost 2 years

    Note: Even after I followed the explanation in another question (as my question was identified as a possible duplicate of it) nothing changed of what I am detailing below.


    I know there are myriad questions and how-to's about installing and using NVIDIA graphics card on Ubuntu, but my case is a bit different (probably due to using Ubuntu 19.04).

    My laptop has a GeForce GTX 1050 NVIDIA graphics card besides the "default" Intel graphics card. (I am using the laptop's own display and nothing is connected to the HDMI port.)

    $ lspci -k | grep -A 2 -i "VGA"
    00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)
        Subsystem: Tongfang Hongkong Limited UHD Graphics 630 (Mobile)
        Kernel driver in use: i915
    --
    01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
        Subsystem: Tongfang Hongkong Limited GP107M [GeForce GTX 1050 Mobile]
        Kernel driver in use: nvidia
    

    I already have installed the latest recommended NVIDIA driver (probably several weeks ago!):

    $ sudo ubuntu-drivers devices
    == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
    modalias : pci:v000010DEd00001C8Dsv00001D05sd00001042bc03sc00i00
    vendor   : NVIDIA Corporation
    model    : GP107M [GeForce GTX 1050 Mobile]
    driver   : nvidia-driver-390 - distro non-free
    driver   : nvidia-driver-418 - distro non-free recommended
    driver   : xserver-xorg-video-nouveau - distro free builtin
    
    $ sudo apt-get install nvidia-driver-418
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    nvidia-driver-418 is already the newest version (418.56-0ubuntu1).
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    
    $ prime-select query
    nvidia
    

    However, system Settings | Details | About displays that the following graphics processor is active:

    Intel® UHD Graphics 630 (Coffeelake 3x8 GT2)
    

    I get the following output from nvidia-smi command:

    $ nvidia-smi
    Wed May 29 19:17:55 2019       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 418.56       Driver Version: 418.56       CUDA Version: 10.1     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |===============================+======================+======================|
    |   0  GeForce GTX 1050    Off  | 00000000:01:00.0 Off |                  N/A |
    | N/A   33C    P8    N/A /  N/A |      2MiB /  4040MiB |      0%      Default |
    +-------------------------------+----------------------+----------------------+
    
    +-----------------------------------------------------------------------------+
    | Processes:                                                       GPU Memory |
    |  GPU       PID   Type   Process name                             Usage      |
    |=============================================================================|
    |  No running processes found                                                 |
    +-----------------------------------------------------------------------------+
    

    The GPU seems idle.

    And the nvidia-settings command just displays a simple window like this:

    enter image description here

    Considering all these, I believe that currently the Intel graphics card, and not the NVIDIA graphics card is active in my system.

    Purging and reinstalling the NVIDIA driver does not help.

    Certainly I am missing something. But what?

    • Admin
      Admin about 5 years
      Disable Secure Boot.
    • FedKad
      FedKad about 5 years
      It was disabled 2 months ago when I installed VirtualBox.
    • Admin
      Admin about 5 years
      I suggest you purge and reinstall the 418 version.
    • FedKad
      FedKad about 5 years
      @GabrielaGarcia : I did the purge and reinstall; but nothing changed.
    • FedKad
      FedKad about 5 years
      @Nmath : My computer is a laptop. I am using the laptop's own display. Nothing is connected to the HDMI port.
    • FedKad
      FedKad about 5 years
      I ran a FHD video. But no change in memory usage. The last lines of the nvidia-smi output always show No running processes found
    • karel
      karel about 5 years
    • FedKad
      FedKad about 5 years
      @Nmath and @karel : Although the duplicates suggested are quite old postings, I tried to do my best to read and understand all the links provided. The only meaningful thing was to reinstall nvidia-driver-418 which I did yesterday and also I repeated today more carefully. As the note I added to my original question above says, nothing changed.
    • FedKad
      FedKad about 5 years
      update-alternatives --config glx gives update-alternatives: error: no alternatives for glx error.
    • Michal Przybylowicz
      Michal Przybylowicz about 5 years
      Try to blacklist the integrated graphics card module in kernel - I have it blacklisted in my 7700k and I use GTX 1080 with nvidia binary drivers.
    • ubfan1
      ubfan1 about 5 years
      Ensure you are not logging in using wayland, that still might switch to the Intel driver regardless of what you have installed. Click on the little gear at the login screen to select the xorg choice.
    • FedKad
      FedKad about 5 years
      @ubfan1 The other options do not allow me to login. They throw some errors to syslog and return immediately to login prompt. Do you mean that under wayland the NVIDIA GPU is never used?
  • FedKad
    FedKad about 5 years
    Unfortunately, I cannot log in with non-wayland options. The Xorg selection for example, throws some errors on syslog and returns immediately to the login prompt. The relevant errors (there are hundreds of messages during login) seem to be these: gnome-shell[15707]: JS ERROR: TypeError: monitor is null#012_updateContentScale@resource:///org/gnome/shell/ui/m‌​agnifier.js:174:9... and org.gnome.Shell.desktop[15707]: Window manager warning: struts occupy an unusually large percentage of the screen; available remaining width = 8 < 100... I haven't found any solution for these on the web. :(
  • FedKad
    FedKad about 5 years
    Does this mean that NVIDIA does not work on wayland?
  • WinEunuuchs2Unix
    WinEunuuchs2Unix about 5 years
    Yes. Many things do not work on Wayland including nvidia drivers. ubuntuforums.org/showthread.php?t=2416644
  • FedKad
    FedKad about 5 years
    I fixed the problem of not being able to log in with non-wayland option. And I saw that you are right: nvidia options are not available and nvidia-smi shows the relevant processes.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix about 5 years
    Upvoting for catching this!