Can't start nvidia-driver-460 in Ubuntu 18.04 (GeForce MX230)

Hello I purged nvidia-* packages, and installed nvidia-driver-460 (recommended in ubuntu-drivers devices output).
I am on xubuntu 18.04, with IdeaPad S340 and GeForce MX230.
Secure boot is already disabled, but I keep getting display UNCLAIMED in output of sudo lshw -c display.

$ prime-select query
nvidia
$ nvidia-settings
ERROR: NVIDIA driver is not loaded
ERROR: Unable to load info from any available system
$ dpkg --get-selections | grep nvidia-driver-460
nvidia-driver-460				install

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

You have gcc 5.5 installed and enabled. Please the standard reenable gcc 7.5 as system-compiler.

Thanks for quick reply.
I updated gcc to 7.5.0, but initial problem persists after reboot.
Here is updated bug-report file:

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

Please post the output of
gcc -v
and
cc -v

Here are some outputs.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
$ cc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
$ sudo update-alternatives --query gcc
Name: gcc
Link: /usr/bin/gcc
Slaves:
 g++ /usr/bin/g++
Status: manual
Best: /usr/bin/gcc-7
Value: /usr/bin/gcc-7

Alternative: /usr/bin/gcc-5
Priority: 60
Slaves:
 g++ /usr/bin/g++-5

Alternative: /usr/bin/gcc-7
Priority: 80
Slaves:
$ sudo update-alternatives --query cc
Name: cc
Link: /usr/bin/cc
Slaves:
 cc.1.gz /usr/share/man/man1/cc.1.gz
Status: auto
Best: /usr/bin/gcc
Value: /usr/bin/gcc

Alternative: /usr/bin/gcc
Priority: 20
Slaves:
 cc.1.gz /usr/share/man/man1/gcc.1.gz

It’s the very same problem as in
https://forums.developer.nvidia.com/t/nvidia-smi-nvidia-smi-has-failed-because-it-couldn-t-communicate-with-the-nvidia-driver-make-sure/166240?u=generix
gcc was switched to an incompatible version but switching it back doesn’t rebuild the kernel module. Please keep an eye on that thread to undupe.

Now I am getting black screen instead of login, but I am able to use tty1, tty2, …

When I run sudo dpkg-reconfigure linux-headers-5.4.0-62-generic I get some errors, thats the reason?

$ sudo dpkg-reconfigure linux-headers-5.4.0-62-generic
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.4.0-62-generic

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....(bad exit status: 2)
make -j8 KERNELRELEASE=5.4.0-62-generic all INCLUDEDIR=/lib/modules/5.4.0-62-generic/build/include KVERSION=5.4.0-62-generic DKMS_BUILD=1...(bad exit status: 2)
ERROR (dkms apport): binary package for evdi: 5.1.26 not found
Error! Bad return status for module build on kernel: 5.4.0-62-generic (x86_64)
Consult /var/lib/dkms/evdi/5.1.26/build/make.log for more information.
Error!  The dkms.conf for this module includes a BUILD_EXCLUSIVE directive which
does not match this kernel/arch.  This indicates that it should not be built.
   ...done.

I feel like I messed to much with that system, but I’m not sure how. There is also newest bug-report.

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

Driver/kernel/build system is working fine now, you just need to delete /etc/X11/xorg.conf and reboot.

Now this kernel is not booting up at all.
I booted with kernel 5.4.0-60-generic and nvidia-settings stills outputs:
ERROR: NVIDIA driver is not loaded.

sudo lshw -c display now do not show unclaimed. Maybe it would be easier to upgrade whole system to 20.04 or reinstall X or something?

nvidia-bug-report.log.gz (132.6 KB)
$ sudo journalctl -b (1.5 MB)

Now nouveau is loading, seems the blacklist went AWOL. please create
/etc/modprobe.d/blacklist-nouveau.conf

blacklist nouveau

and run
sudo update-initramfs -u
then reboot.

Thank you so much for your help, that worked.

In my case I needed to update specific kernel version with sudo update-initramfs -u -k 5.4.0-60-generic