Return to

[FIXED IN 4.18.0-24]Watch out, there's a GCC version mismatch on 18.04.2 Bionic


Seems like the current HWE and LTS kernels have NOT been updated to the version of GCC that Bionic Updates is now pushing which is 7.4.0-1ubuntu1~18.04. This is a nightmare for manual Nvidia driver installation because the GCC versions have to match exactly.

No word on if new kernels will be built on the new version from bionic-updates to correct this issue, so if you’re still on 7.3.0-16ubuntu3, DO NOT UPDATE if you run Nvidia at all. Hold gcc, cpp, g++, gcc-7, cpp-7, and g++-7.

If it’s too late, run your Nvidia installer with -A to list arguments you can run the installer with. Most likely the one you want is --no-cc-version-check

If you’re running KDE or Kubuntu, let gcc-8 update, because what you care about is gcc --version being 7.3.0. Holding gcc-8 will break all KDE components, and on Kubuntu, break apt, so DO NOT HOLD gcc-8 if you run Kubuntu 18.04.



Can’t believe something this big was overlooked…



So far the only thing anal about GCC versions matching is the Nvidia driver if installed manually and not from a PPA.



We faced same issue. The solution is to install latest kernel from mainline archive:

# -i v5.1.2

Then download latest nvidia driver:

Install gcc-8.

Update alternatives:

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 40

Tries to install (also in dkms), may be it is neccessary to start with a newer kernel:

dkms build nvidia/430.14 -k 5.1.2-050102-generic
dkms install nvidia/430.14 -k 5.1.2-050102-generic


New HWE kernel just got pushed out. Guess what /proc/version says?

Linux version 4.18.0-20-generic ([email protected]) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #21~18.04.1-Ubuntu SMP Wed May 8 08:43:37 UTC 2019

Nope. They’re not getting the memo that the bionic-updates GCC version mismatches their OOTB kernel.

I’m personally having to use the Vulkan Beta drivers and those ALWAYS work when the GCC version is the same.



There is an another solution: ignore cc compiler version with:

# or

Nvidia driver says that it is better not to use it. I didn’t never tried to use unstable module (with ignoring cc mistmatch.



The environment variable doesn’t get passed over to the dkms build instance in my case so only --no-cc-version-check works. Minor GCC version changes like from 7.3.0 to 7.4.0 are fine, but not 8.x.x vs 7.x.x.



@FurryJackman Thank you for your update about “Minor GCC version changes” but it’s easier for me to install a more recent version of the GCC (kernel, driver) than to roll back to 7.3. At least I don’t want to downgrade. Now everything is working on Linux-5.1.2

It seems to me that linux-image-4.15.0-51-generic should be compiled gcc 7.4. But Canonical is not predictable.



Okay, looks like a recent D9VK change let the cat out of the bag for “minor” GCC version changes. (I think???)

I brute force downgraded these packages via the Ubuntu Packages site and dpkg -i *.deb and DKMS built properly again:


Don’t do this if you’re uncomfortable doing so. There is an extremely high risk of breakage. Remember to hold your packages afterwards.



So i’ve spent the last 3 to 4 days trying to get an nvidia graphics card to work with Ubuntu 18.04.2 LTS on my Dell PowerEdge T620.

This thread is the closest thing I have found to actually discussing and resolving some of the log errors ive traced in my journey. I am willing to discuss at length the things I have tried but - for now - I’d begin with confirming I had the GCC-7.4 in use but GCC-7.3 required issue, I used the --no-cc-version-check and successfully completed the install. On reboot its back to the login boot loop. I log in, 3 seconds later it escapes in error and returns me to the login screen.

Oddly enough, when I wipe everything down / purge nvidia … or any clean install attempt… results in VIDEO OUTPUT from the Nvidia gpu when Ubuntu is loading just the mauve screen (and lasts anywhere from 3 - 8 secs) before switching controllers back to the Matrox200 onboard GPU.

I am REALLY stumped and would love some input.

GPUs tried:

  • Nvidia 9500 GT
  • Nvidia GTX 750
  • AMD HD4650 (just for sanity check tbh)

Only the nvidia cards ever get video output, and it only ever occurs early in the Ubuntu launch and promptly switches before the login prompt appears.



Double check Nouveau is actually disabled in the initial RAM disk. You should also install the Nvidia drivers with nomodeset.



UPDATE: 4.18.0-24-generic is built with GCC 7.4.0, so before updating to that kernel, update your GCC version. Otherwise Nvidia DKMS will fail.



So ive set the nomodeset but how do you disable the Nouveau drivers? Adding them to blacklist? I’ve beena Linux user for all of 5 days apologies in advance. I am, however, fairly comfortable in UNIX / bash as a dev on a mac.



Is there a way to check if DKMS failure is the cause? I feel like I am close to resolving the issue. Also, do you think disabling the onboard GPU would change anything? Its risky as ill have to reset my RAID controller and BIOS to reenable it - and id rather not lol.



Disabling the iGPU does matter and changing the UEFI (or BIOS if it’s old enough) so that the primary GPU output is your Nvidia GPU also matters for Nvidia Proprietary drivers. Unlike Windows, having the iGPU and a Nvidia card running at the same time has a really steep newbie curve to configure correctly if you’re not using Pop!_OS.

You can check if it’s a DKMS failure by simply going sudo dkms status in terminal, and if nvidia isn’t listed, the DKMS build failed.


sudo nano /etc/modprobe.d/blacklist-nouveau.conf

then create that file with this as the contents:

blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
1 Like


Thank you for popping back up to help!

So I jumped into bash and ran the dkms status…
It wasnt installed.
Installed it, upon reboot and rerun of the command there is no output.

I built the blacklist file but before moving forward with disabling onbaord GPU I need to make sure my nvidia drivers were installed properly and nothing else is logging errors (while in this boot loop mode).

Any suggesting for logs to check? Im going to poke around and try to detail as much of the relevant errors I find in the mean time - but if there are things you’d like me to check/share definitely throw some commands my way!



Don’t forget to update your initial RAM disk after making the blacklist file with update-initramfs -u

1 Like


Will do, in the meantime…

------------ UPDATE -----------

While reinstalling nvidia drivers I recieved the error:

Failed to run /usr/sbin/dkms build -m nvidia -v 340.107 -k 4.18.0-24-generic:

KBUILD_EXTMOD=/var/lib/dkms/nvidia/340.107/build/uvm…(bad exit status 2)
ERROR (dkms apport): binary package for nvidia: 340.107 not found
Error! Bad return status for a module build on kernel: 4.18.0-24-generic (x86_64)
Consult /var/lib/dkms/nvidia/340.107/build/make.log for more information.

and then…

Failed to install the kernel module through DKMS. No kernel module was installed; please try installing again without DKMS, or check the DKMS logs for more information.


Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details

Make log (starting at Line 3):

make[1]: Entering directory ‘/usr/src/linux-headers-4.18.0-24-generic’
Makefile:970: “Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel, or
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (
echo >&2;
echo >&2 " ERROR: Kernel configuration is invalid."
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";
echo >&2 " Run ‘make oldconfig && make prepare’ or kernel src to fix it.";
echo >&2;



Kernel is too new for the driver. This can sometimes happen so you’ll want to downgrade your kernel to install that specific driver.