If now solved: Please visit the "Thread Tools" link in the upper right of the page & mark this thread as "Solved"... So that other may find your solution to help them with resolving this problem.
I have a felling that within the next few years, with how this has been going with kernel series changes, and now the announcement that LTS versions are going to be getting longer support... I'm just going to post both my fixes in this post, so that other may be able to find a solution to their similar problem. Thank you for the opportunity to look into this and helping. That way, we both can share how to solve this for others. I'll get the Moderators to add the link to this post to Post #2 of my Graphics Resolution Sticky.
To check which Compiler the system is using and compare it to what the current kernel was compiled with:
Code:
grep -e 'linux-gnu-gcc-' /proc/version
uname -r
gcc --version | grep -e 'gcc'
To install and change gcc compilers:
NVidia drivers sometime have a problem compiling the drivers if there is too much of a difference between the installed compiler and the version of compiler the running kernel was compiled with... Solution- install that compiler. This works right now for recently supported drivers (with kernel 6.5.0), but not currently for legacy drivers. For that work-around, skip this, and see below to run the working kernel...
Install the matching compiler:
Code:
sudo apt update
sudo apt install gcc-12 g++-12
Look to see which compiler pieces are installed
Code:
apt list g{cc,++}-*{0,1,2,3,4,5,6,7,8,9} --installed
For example, mine:
Code:
mafoelffen@msi-ubuntu:~$ apt list g{cc,++}-*{0,1,2,3,4,5,6,7,8,9} --installed
Listing... Done
g++-11/jammy-updates,jammy-security,now 11.4.0-1ubuntu1~22.04 amd64 [installed,automatic]
g++-12/jammy-updates,jammy-security,now 12.3.0-1ubuntu1~22.04 amd64 [installed]
gcc-11/jammy-updates,jammy-security,now 11.4.0-1ubuntu1~22.04 amd64 [installed,automatic]
gcc-12/jammy-updates,jammy-security,now 12.3.0-1ubuntu1~22.04 amd64 [installed,automatic]
mafoelffen@msi-ubuntu:~$ ls -larth `find /usr/bin/ -name gcc-*` | grep -v 'nm\|ar\|ra'
lrwxrwxrwx 1 root root 23 May 13 2023 /usr/bin/gcc-12 -> x86_64-linux-gnu-gcc-12
lrwxrwxrwx 1 root root 23 May 13 2023 /usr/bin/gcc-11 -> x86_64-linux-gnu-gcc-11
mafoelffen@msi-ubuntu:~$ ls -larth `find /usr/bin/ -name g++-*` | grep -v 'nm\|ar\|ra'
lrwxrwxrwx 1 root root 23 May 13 2023 /usr/bin/g++-12 -> x86_64-linux-gnu-g++-12
lrwxrwxrwx 1 root root 23 May 13 2023 /usr/bin/g++-11 -> x86_64-linux-gnu-g++-11
Add them to an update-alternatives group
Code:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
Temporarily pick gcc-12
Code:
mafoelffen@msi-ubuntu:~$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-12 12 auto mode
1 /usr/bin/gcc-11 11 manual mode
2 /usr/bin/gcc-12 12 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2
Reinstall my driver
Code:
sudo apt install --yes nvidia-driver-535 nvidia-dkms-535
Optionally, install Nvidia Cuda
Code:
sudo apt install --yes nvidia-cuda-toolkit
Reboot to test
After you are through, rest the compiler back to what it was...
Code:
mafoelffen@msi-ubuntu:~$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/gcc-12 12 auto mode
1 /usr/bin/gcc-11 11 manual mode
* 2 /usr/bin/gcc-12 12 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/gcc-11 to provide /usr/bin/gcc (gcc) in manual mode
If this work-around helped, then join this Bug Report as "Also Affects Me":
https://ubuntuforums.org/showthread....4#post14175164
Legacy Drivers: Use 6.2.0 series kernels...
Code:
sudo apt remove --purge --yes linux-headers-6.5.0-14-generic linux-image-6.5.0-14-generic linux-modules-6.5.0-14-generic linux-modules-extra-6.5.0-14-generic
sudo apt install --reinstall --yes linux-headers-6.2.0-39-generic linux-image-6.2.0-39-generic linux-modules-6.2.0-39-generic linux-modules-extra-6.2.0-39-generic
sudo apt-mark hold linux-headers-6.2.0-39-generic linux-image-6.2.0-39-generic linux-modules-6.2.0-39-generic linux-modules-extra-6.2.0-39-generic
When they come up with a fix to compile NVidia Legacy drivers with Linux kernel 6.5 series kernels, then you can re-add that kernel series by unpinning the kernels via
Code:
sudo apt-mark unhold linux-headers-6.2.0-39-generic linux-image-6.2.0-39-generic linux-modules-6.2.0-39-generic linux-modules-extra-6.2.0-39-generic
sudo apt update && sudo apt upgrade