Glxinfo not showing my nvidia card

I just installed a fresh copy of Ubuntu 20.04 with recommended proprietary drivers.
This is the output of glxinfo -B not showing my GeForce 940M:

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) HD Graphics 5500 (BDW GT2) (0x1616)
    Version: 20.2.6
    Accelerated: yes
    Video memory: 3072MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics 5500 (BDW GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.2.6
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.2.6
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

Is nvidia-smi showing the card?

If yes, you might want to use nvidia-prime to switch to the nvidia card.

If not, please run nvidia-bug-report.sh as root and attach the resulting file here.

Ok, I read the tutorial but I had already taken those steps.

No luck with nvidia-smi:

# nvidia-smi
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’m already using the recommended drivers:
Screenshot from 2021-03-17 09-49-53

And lshw doesn’t even show my card

# lshw -c display
  *-display                 
       description: VGA compatible controller
       product: HD Graphics 5500
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 09
       width: 64 bits
       clock: 33MHz
       capabilities: msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:50 memory:a1000000-a1ffffff memory:b0000000-bfffffff ioport:5000(size=64) memory:c0000-dffff

However:

# prime-select query
nvidia

This is the resulting file from nvidia-bug-report.sh
nvidia-bug-report.log.gz (127.0 KB)

Please try running ubuntu updates:
https://askubuntu.com/questions/1323913/all-resolution-options-except-1024x768-gone-after-upgrade-to-ubuntu-20-04-2-lts

Thanks for the fast reply.

I did it. This is the last part of /var/log/apt/history.log:

Start-Date: 2021-03-17 10:05:08
Commandline: apt upgrade
Requested-By: abelramos (1000)
Upgrade: linux-modules-nvidia-460-generic-hwe-20.04:amd64 (5.8.0-45.51~20.04.1, 5.8.0-45.51~20.04.1+1), linux-modules-nvidia-460-5.8.0-45-generic:amd64 (5.8.0-45.51~20.04.1, 5.8.0-45.51~20.04.1+1)
End-Date: 2021-03-17 10:05:37

I even restarted after that, however nvidia-smi is still showing the same error message.

Please try adding the graphics drivers ppa and install the driver from that.

Mar 16 13:27:43 venus kernel: [ 1188.272846] NVRM: API mismatch: the client has the version 460.39, but
Mar 16 13:27:43 venus kernel: [ 1188.272846] NVRM: this kernel module has the version 460.32.03. Please
Mar 16 13:27:43 venus kernel: [ 1188.272846] NVRM: make sure that this kernel module and all NVIDIA driver
Mar 16 13:27:43 venus kernel: [ 1188.272846] NVRM: components have the same version.

Seems you installed the driver through the .run file, but never uninstalled it before installing via ubuntu.
Please run the .run file installer with the --uninstall option. Purge all nvidia driver packages from ubuntu.
Then re-install from ubuntu or the graphics ppa.

Hello, sorry for the delayed response, I just had the time today.

I purged everything, then re-installed from ubuntu. Now I get this errors:

# nvidia-smi 
Failed to initialize NVML: Driver/library version mismatch

# dmesg | tail
[ 1875.478077] Code: 29 31 db 0f 1f 00 48 63 c3 49 8b 74 c4 08 48 85 f6 74 0e 48 8d 3d a7 70 0e 00 31 c0 e8 bd 4e f6 ff 83 c3 01 41 3b 1c 24 7c dc <c7> 04 25 00 00 00 00 00 00 00 00 0f 0b 48 8d 3d 68 70 0e 00 31 c0
[ 2588.434465] perf: interrupt took too long (2525 > 2500), lowering kernel.perf_event_max_sample_rate to 79000
[ 4791.647808] NVRM: API mismatch: the client has the version 460.56, but
               NVRM: this kernel module has the version 460.67.  Please
               NVRM: make sure that this kernel module and all NVIDIA driver
               NVRM: components have the same version.
[ 5079.614198] NVRM: API mismatch: the client has the version 460.56, but
               NVRM: this kernel module has the version 460.67.  Please
               NVRM: make sure that this kernel module and all NVIDIA driver
               NVRM: components have the same version.

You again have a client/kernel-module version mismatch.

sudo apt purge "^nvidia.*" "^libnvidia.*"
Run dpkg -l |grep nvidia to check if there is nothing left installed. Otherwise purge those one by one.
Then re-install from ubuntu or the graphics ppa. Reboot.

Since ther’s the 460.67 driver installed, which was released just yesterday, I suspect you used the .run installer. Please uninstall it first by running it with --uninstall options.
Don’t mix repo and runfile installs.

I already did that, as I said, I purged everything from nvidia and dpkg -l | grep nvidia was empty. I then re-installed via GUI, from the “Additional Drivers” tab. I also rebooted after that, no luck.

Did you uninstall the driver you installed from the .run file, as you already been asked two times?

No, I installed from the repo.
I just gave it a try via runfile now, with dpkg -l | grep nvidia empty, and I’m getting this other error message after reboot:

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

Please create a new nvidia-bug-report.log

Here it is. Please notice that I just re-installed via runfile this time.

nvidia-bug-report.log.gz (120.4 KB)

→ An alternate method of installing the NVIDIA driver was detected. (This is usually a package provided by your distributor.) A driver installed via that method may integrate better with your system than a driver installed by nvidia-installer.
Please review the message provided by the maintainer of this alternate installation method and decide how to proceed:

The NVIDIA driver provided by Ubuntu can be installed by launching the “Software & Updates” application, and by selecting the NVIDIA driver from the “Additional Drivers” tab.

Since you uninstalled the driver packages, prime-select is now switched to intel so the nvidia gpu is turned off and the driver is unloaded.

Ok, I had to install nvidia-prime now.

# prime-select query
on-demand

Then I switched to nvidia

# nvidia-prime nvidia

No luck with nvidia-smi after that. Rebooted, still no luck.

Since there’s bbswitch turning off the gpu, did you meanwhile also install bumblebee?

Not explicitly, but yes, bumblebee it’s there