[SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
midwestE
Level 1
Level 1
Posts: 4
Joined: Mon Nov 07, 2022 9:41 am

[SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by midwestE »

When installing nvidia-driver-525 on kernel 5.19.0-28-generic the nvidia install fails with

Code: Select all

dpkg: error processing package nvidia-dkms-525(--configure):
 installed nvidia-dkms-525 package post-installation script subprocess returned error exit status 10

Examining the /var/lib/dkms/nvidia/525.78.01/build/make.log reveals multiple
cc: error: unrecognized command-line option ‘-ftrivial-auto-var-init=zero’
Looks like kernel 5.19.0-28-generic needs gcc-12 to compile the nvidia-driver-525 correctly.

[Per SMG - The Nvidia-525 driver needs the same version gcc as the kernel you have installed used. You upgraded to the 5.19 kernel. Had you remained on the 5.15 kernel then you would not have had problems.] Switching back to 5.15 is therefore an option.

-------------------------------------

If you don't want to switch back to kernel 5.15, here's what worked for me:

Remove nvidia driver

Code: Select all

sudo apt-get purge *nvidia* && sudo apt-get autoremove
Update gcc and update alternatives
# https://linuxconfig.org/how-to-switch-b ... ocal-fossa

Code: Select all

sudo apt-get install gcc-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
Check the gcc version, should now show v 12.x.x:

Code: Select all

gcc --version
gcc (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Install nvidia driver:

Code: Select all

sudo apt-get install nvidia-driver-525
Last edited by LockBot on Thu Jul 20, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
kallestar4
Level 1
Level 1
Posts: 19
Joined: Tue Dec 25, 2018 12:47 am
Location: New Zealand

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on kernel 5.19.0-28-generic

Post by kallestar4 »

I seem to have had this just fail with an updated kernel that came along, with nvidia-driver-515 installed - suddenly the Mesa driver was being used instead.

In my case, gcc-12 was installed as a package (according to dpkg), but /usr/bin/gcc-12 didn't exist, so I guess maybe something was mis-configured somewhere.

I found installing the package 'g++-12' was the key thing to getting gcc-12 fully installed and, then I could re-apply the nvidia drivers again with the new kernel.
User avatar
SMG
Level 25
Level 25
Posts: 31988
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on kernel 5.19.0-28-generic

Post by SMG »

midwestE wrote: Fri Jan 20, 2023 5:44 pmLooks like nvidia-driver-525 needs gcc-12 to install correctly.
The Nvidia-525 driver needs the same version gcc as the kernel you have installed used. You upgraded to the 5.19 kernel. Had you remained on the 5.15 kernel then you would not have had problems.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
kallestar4
Level 1
Level 1
Posts: 19
Joined: Tue Dec 25, 2018 12:47 am
Location: New Zealand

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on kernel 5.19.0-28-generic

Post by kallestar4 »

You upgraded to the 5.19 kernel. Had you remained on the 5.15 kernel then you would not have had problems.
In my case, I don't remember actively switching kernel versions. I certainly haven't changed anything in the View -> Linux Kernels part of the Linux Mint Update manager, and a few weeks ago I was on 5.15 after the upgrade to 21.1, so I'm not really sure how this happened.

On another 21.1 machine with Intel GPU (so didn't have an issue), I appear to be on 5.19 there as well all of a sudden, so that's two machines that appear to have suddenly changed minor kernel versions without my obviously agreeing to it, which I don't remember that having happened before for several years.

Can the kernel version update (as a minor version, not just a patch version like normal) with a "standard" Update manager package change?
User avatar
SMG
Level 25
Level 25
Posts: 31988
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on kernel 5.19.0-28-generic

Post by SMG »

kallestar4 wrote: Fri Jan 20, 2023 8:26 pmIn my case, I don't remember actively switching kernel versions. I certainly haven't changed anything in the View -> Linux Kernels part of the Linux Mint Update manager, and a few weeks ago I was on 5.15 after the upgrade to 21.1, so I'm not really sure how this happened.

On another 21.1 machine with Intel GPU (so didn't have an issue), I appear to be on 5.19 there as well all of a sudden, so that's two machines that appear to have suddenly changed minor kernel versions without my obviously agreeing to it, which I don't remember every happening before for several years.
Did you upgrade in place from LM20.3 on those computers? I ask because maybe you were using the HWE kernel in LM20.3 and thus had the packages for it already installed. That would be my guess as to what might have happened.

The 5.15 kernel is the LTS kernel for LM21 and is supported through its entire life so change is not needed and, if one has the LTS kernel (rather than the HWE kernel), then it should not change. (At least that is my understanding how it should work.)
Image
A woman typing on a laptop with LM20.3 Cinnamon.
kallestar4
Level 1
Level 1
Posts: 19
Joined: Tue Dec 25, 2018 12:47 am
Location: New Zealand

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on kernel 5.19.0-28-generic

Post by kallestar4 »

Did you upgrade in place from LM20.3 on those computers? I ask because maybe you were using the HWE kernel in LM20.3 and thus had the packages for it already installed. That would be my guess as to what might have happened.
On the laptop with the Intel GPU (which didn't have any issues obviously) it was an update progressively from 20.0 -> 21.0 -> 21.1, but my desktop system with an nvidia GPU which had the compiler mis-match issue, was a clean install of 21.0 in August (when it came out).
The 5.15 kernel is the LTS kernel for LM21 and is supported through its entire life so change is not needed and, if one has the LTS kernel (rather than the HWE kernel), then it should not change. (At least that is my understanding how it should work.)
Yeah, that's what's (slightly) concerning to me: it's not the end of the world as I've fixed it now, but I am curious as to how this happened on two machines, as I haven't had anything break "automatically" in Linux Mint in 4/5 years (since some Python 2/3 weirdness which broke Cinnamon back in Mint 17 or something) until now.

I'm also not sure if it's normal for a package (in this case Kernel 5.19) to be built with the non-"native" compiler version for the Ubuntu/Mint distro version, which I'm fairly sure is gcc 11 (going off the readmes of both Ubuntu LTS and Mint 21.1): I would have expected all packages to be built with the "native" compiler, rather than a slightly newer one, just for maximum compatibility (I know C ABIs should really be compatible between major compiler versions, but....)
User avatar
SMG
Level 25
Level 25
Posts: 31988
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on kernel 5.19.0-28-generic

Post by SMG »

kallestar4 wrote: Fri Jan 20, 2023 9:41 pmOn the laptop with the Intel GPU (which didn't have any issues obviously) it was an update progressively from 20.0 -> 21.0 -> 21.1
I believe you meant 20.0->20.3->21.0->21.1.

If at any time while on LM20 you upgraded to an HWE kernel then I would presume you had those packages on your computer which would explain why that one upgraded. Approximately a year ago, the HWE packages started automatically upgrading to a newer kernel when it became available. HWE kernels are short-term support kernels so if one does not upgrade, they may end up running an unsupported kernel.
kallestar4 wrote: Fri Jan 20, 2023 9:41 pmbut my desktop system with an nvidia GPU which had the compiler mis-match issue, was a clean install of 21.0 in August (when it came out).
I do not understand why that one automatically upgraded to the 5.19 kernel. Also, it is odd your system needed more than just the gcc-12 package installed. So far, others have only needed the one package. I do not have any guesses as to what might have happened on your install. Maybe others will have an idea of what might have caused the automatic upgrade.
kallestar4 wrote: Fri Jan 20, 2023 9:41 pmI'm also not sure if it's normal for a package (in this case Kernel 5.19) to be built with the non-"native" compiler version for the Ubuntu/Mint distro version, which I'm fairly sure is gcc 11 (going off the readmes of both Ubuntu LTS and Mint 21.1): I would have expected all packages to be built with the "native" compiler, rather than a slightly newer one, just for maximum compatibility (I know C ABIs should really be compatible between major compiler versions, but....)
That is also a bit puzzling to me. The 5.19 kernel was the release kernel for Ubuntu 22.10 and, based on what someone else posted for inxi info from their install, there were some other difference I would not have expected. I do not know where might be the appropriate place to find out why that happened.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
Loron
Level 1
Level 1
Posts: 4
Joined: Sun Sep 09, 2018 1:34 pm
Location: Germany

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on kernel 5.19.0-28-generic

Post by Loron »

Hello!
Your instructions work for me as well. Had the same issues with the kernel and NVidia drivers.
Thank you!

Regards

Loroin
midwestE
Level 1
Level 1
Posts: 4
Joined: Mon Nov 07, 2022 9:41 am

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on kernel 5.19.0-28-generic

Post by midwestE »

SMG wrote: Fri Jan 20, 2023 8:14 pm
midwestE wrote: Fri Jan 20, 2023 5:44 pmLooks like nvidia-driver-525 needs gcc-12 to install correctly.
The Nvidia-525 driver needs the same version gcc as the kernel you have installed used. You upgraded to the 5.19 kernel. Had you remained on the 5.15 kernel then you would not have had problems.
Thank you, that makes sense. I may have previously updated my kernel in previous version of Mint before I did a mintupdate. I've updated the post to add information you provided
visseroth
Level 2
Level 2
Posts: 64
Joined: Sun Feb 02, 2014 5:09 am

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by visseroth »

@midwestE, thank you for the post, I was banging my head on the wall trying to figure out why I couldn't get the NVidia driver installed with the new kernel and the new kernel gave me better hardware support than the old kernel.
SM3 was kind enough to point out your fix to me.
ggill
Level 1
Level 1
Posts: 15
Joined: Mon Jan 17, 2022 1:19 am

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by ggill »

Thanks for this post. Really helpful.

When I had a look at the logs, I realised that the nvidia-driver-525 install was failing only for kernel 5.19 and installing correctly for kernel 5.15, for the reasons given here. But using the Mint update manager or installing software with synaptic (for completely unrelated packages), every time it would try to finish the installation of nvidia-driver-525 and give errors.

If you want to use kernel 5.19 and keep kernel 5.15 installed as a backup, how would you go about doing that? How can you do the equivalent of installing nvidia-driver-525 just for kernel 5.19 using gcc-12, and then again for kernel 5.15 using gcc-11? Seems like you'd want to have separate packages that allow something like that.
User avatar
SMG
Level 25
Level 25
Posts: 31988
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by SMG »

ggill wrote: Wed Feb 01, 2023 6:09 amIf you want to use kernel 5.19 and keep kernel 5.15 installed as a backup, how would you go about doing that? How can you do the equivalent of installing nvidia-driver-525 just for kernel 5.19 using gcc-12, and then again for kernel 5.15 using gcc-11? Seems like you'd want to have separate packages that allow something like that.
You can have both gcc-11 and gcc-12 installed. When you install gcc-12, that adds that package to your system in addition to the gcc-11 package you already have. It does not replace the gcc-11 package on your system. Multiple versions of gcc / g++ affects.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
mtwebster
Level 1
Level 1
Posts: 43
Joined: Sun Jun 17, 2012 1:29 pm

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by mtwebster »

Hi we need to update our 'dkms' package for Mint 21, which has the missing dependencies..

In the meantime you can run:

Code: Select all

apt install dkms=2.8.7-2ubuntu2.1
to get the updated version. Once we update our own that will be replaced.

The issue with that upstream version (and the reason we patch it for Mint) is it causes an issue with dual-gpu laptops - not breaking issues, but it can make the 'powersave' mode unavailable. For normal systems there should be no problem.
mgarcia
Level 1
Level 1
Posts: 6
Joined: Thu Dec 06, 2018 5:16 pm

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by mgarcia »

midwestE wrote: Fri Jan 20, 2023 5:44 pm When installing nvidia-driver-525 on kernel 5.19.0-28-generic the nvidia install fails with

Code: Select all

dpkg: error processing package nvidia-dkms-525(--configure):
 installed nvidia-dkms-525 package post-installation script subprocess returned error exit status 10

Examining the /var/lib/dkms/nvidia/525.78.01/build/make.log reveals multiple
cc: error: unrecognized command-line option ‘-ftrivial-auto-var-init=zero’
Looks like kernel 5.19.0-28-generic needs gcc-12 to compile the nvidia-driver-525 correctly.

[Per SMG - The Nvidia-525 driver needs the same version gcc as the kernel you have installed used. You upgraded to the 5.19 kernel. Had you remained on the 5.15 kernel then you would not have had problems.] Switching back to 5.15 is therefore an option.

-------------------------------------

If you don't want to switch back to kernel 5.15, here's what worked for me:

Remove nvidia driver

Code: Select all

sudo apt-get purge *nvidia* && sudo apt-get autoremove
Update gcc and update alternatives
# https://linuxconfig.org/how-to-switch-b ... ocal-fossa

Code: Select all

sudo apt-get install gcc-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
Check the gcc version, should now show v 12.x.x:

Code: Select all

gcc --version
gcc (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Install nvidia driver:

Code: Select all

sudo apt-get install nvidia-driver-525
thanks, that helped me too :)
mtwebster
Level 1
Level 1
Posts: 43
Joined: Sun Jun 17, 2012 1:29 pm

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by mtwebster »

The dkms package has been updated (2.8.7-2ubuntu2.1mint1) so this should not be an issue anymore.
enigmista911
Level 1
Level 1
Posts: 1
Joined: Sun Apr 23, 2023 10:53 am

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by enigmista911 »

Thank a lot, that solve the problem for me in Dell G16 .
I owe 1 beer to you
User avatar
SMG
Level 25
Level 25
Posts: 31988
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [SOLVED] Nvidia driver failure on Vera because of gcc-11 on updated kernel 5.19.0-28-generic

Post by SMG »

enigmista911 wrote: Sun Apr 23, 2023 10:56 am Thank a lot, that solve the problem for me in Dell G16 .
I owe 1 beer to you
Welcome to the forum, enigmista911.

What exactly solved your problem? This topic is old and updating your system to the latest files before installing the Nvidia driver is all one needs to do.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
Locked

Return to “Graphics Cards & Monitors”