Ubuntu – Nvidia GTX 1650 not detected in Ubuntu 18.04.3

driversgraphicsnvidiaxorg

I recently bought this machine: ASUS TUF FX505DT – AMD Ryzen 5 3550H with GTX 1650 4GB. It came with Windows 10 preinstaleld. The GTX 1650 graphics card worked in Windows without any issue. After I cleaned my SSD, disabled Secure Boot in BIOS and installed Ubuntu 18.04.3, the graphics card is not recognized.

I added graphics-drivers/ppa, purged all existing NVIDIA packages, installed nvidia-driver-430 (tried 435 as well), but still it didn't work. I've also installed ppa:xorg-edgers/ppa using the following command:

sudo add-apt-repository ppa:xorg-edgers/ppa

This what Additional Drivers shows before installing the drivers:

additional driver before install

This what Additional Drivers shows after installing the drivers:

additional driver after install

This is the About info regarding the machine:

about the machine

Product model is showing as Unknown in the Additional Drivers settings.
Product model is just NVIDIA in lshw -C display.

shivakumaar@techpack-tuf:~$ sudo lshw -C display
[sudo] password for shivakumaar: 
  *-display                 
       description: VGA compatible controller
       product: NVIDIA Corporation
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:67 memory:f6000000-f6ffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:f000(size=128) memory:f7000000-f707ffff
  *-display
       description: VGA compatible controller
       product: Picasso
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:05:00.0
       version: c2
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi msix vga_controller bus_master cap_list
       configuration: driver=amdgpu latency=0
       resources: irq:65 memory:e0000000-efffffff memory:f0000000-f01fffff ioport:c000(size=256) memory:f7500000-f757ffff
shivakumaar@techpack-tuf:~$ sudo nvidia-xconfig

WARNING: Unable to locate/open X configuration file.

Package xorg-server was not found in the pkg-config search path.
Perhaps you should add the directory containing `xorg-server.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xorg-server' found
New X configuration file written to '/etc/X11/xorg.conf'

shivakumaar@techpack-tuf:~$ nvidia-detector
none
shivakumaar@techpack-tuf:~$ nvidia-settings

ERROR: Unable to load info from any available system


(nvidia-settings:2313): GLib-GObject-CRITICAL **: 13:01:50.443: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
** Message: 13:01:50.448: PRIME: No offloading required. Abort
** Message: 13:01:50.448: PRIME: is it supported? no

nvida x controller settings

shivakumaar@techpack-tuf:~$ nvidia-smi
Sat Sep 28 13:02:14 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 435.21       Driver Version: 435.21       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 1650    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   42C    P8     2W /  N/A |      0MiB /  3911MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

shivakumaar@techpack-tuf:~$ nvidia-debugdump --list
Found 1 NVIDIA devices
    Device ID:              0
    Device name:            GeForce GTX 1650
    GPU internal ID:        GPU-ba92a04a-ae32-bc09-62df-9fe847ba81ca

After installing the drivers, if I reboot and try to login into Ubuntu (Xorg), it freezes in the login screen or logs out immediately. But Ubuntu (Wayland) login works fine. But even with all the drivers installed, the screen flickers constantly in Wayland.

Best Answer

From the poster's comment to a detailed fix;

Do not add graphics drivers ppa and if you did it, remove everything including the ppa.

Open up the Additional Drivers from menu and select the proprietary tested driver and reboot.

Then create the directory and copy the file in it by following commands:

    sudo mkdir /etc/X11/xorg.conf.d
    sudo cp /usr/share/X11/xorg.conf.d/10-nvidia.conf /etc/X11/xorg.conf.d

Then add Option "PrimaryGPU" "Yes" to the OutputClass of the following file

sudo vim /etc/X11/xorg.conf.d/10-nvidia.conf

It should look like this in the end:

Section "OutputClass"
    Option "PrimaryGPU" "Yes"    
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection

Then reboot. After rebooting, try nvidia-smi command to see if it works.

I got gtx1660ti working with this soluiton well.

Related Question