FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘flush_workqueue’

I got the above error message after reinstalling my Gentoo Linux on a new harddrive. Untypical for a Gentoo distribution user I still fetch my Linux Kernel from the official website and compile it,

  1. because you get a Kernel unmeddled with by any distributor
  2. you have to compile it manually anyways (because genkernel sucks)
  3. because back in the old days, the Kernel sources where not in portage and therefore I am used to fetching it by hand

So my last Kernel was still a 4.0, while the new one now is a 4.2. I love Linux and distributions like Gentoo because they are text-based – I just copy and paste my configs and everything runs smoothly. Well – in theory.

The reallity of course often looks different. And this error is one example. It occurs for instance when you try to get the nVidia drivers on Gentoo with the current Kernel 4.2 – distribution independantly (as you can see here for instance).

So, when you look into the error and what’s causing it, it seems that in version 4.2 the Kernel developers assigned a different copyright license to the flush_workqueue function, i.e. usage allowed for GPL software only. And as the nVidia drivers are closed source…

Now there is an easy way to surpass this problem (see below), which would allow you to install the nVidia drivers anyway. However this would be a deliberate breach of the copyright license and would be at least rude to the developers.

Yet it seems like even the developers are not sure if that was a good idea – it rather looks like a refactoring error, that is probably being reversed any time from now. There is at least a message patching it for the unstable 4.3, and it was suggested as patch for 4.2-r5, but even in 4.2-rc8 this patch has not been included yet. So it’s now at least two months that neither nVidia nor the Linux Kernel have reacted to the problem; so either you downgrade the Kernel (which is a bunch of work), or simply patch it yourselfe šŸ™‚ Even though one might argue that it is a license breech, I do not believe that it is the intention of Linux to render your machine useless (or give you extra work by downgrading) and it probably will be reversed soon – and if not, nVidia will react with a new driver version. Until then this workaround will allow you to use your nVidia graphics card with the Linux Kernel 4.2

You just need to open the file /usr/src/linux/kernel/workqueue.c in your favorite editor and search for the line


(in my Kernel sources it’s the linke 2617).

The extra _GPL part is responsible that the compilation crashes when the function is used in code that is not GPL licensed. So just delete it, so the line looks like this:


Now just recompile your Kernel. If you haven’t changed anything else, it should be suffice to call:

/usr/src/linux $ make clean && make && make install

and reboot your system. If you however have problems with modules afterwards (e.g. because you activated hashes for your modules so they don’t work with other Kernel builds), then do a

/usr/src/linux $ make modules_install

And there you go. Now your nVidia drivers should install and run smoothly.

On a side note:

I am a huge fan of Open Source Software and I used to be a huge fan of GPL. However, situations as the above have made me question the GPL in the past, and with every instance I am further away of liking the GPL. Yes, free software is good and we should all strive to use free software, participate in improving free software and write our own free software. And yes, free software should stay free and should be protected. However, this should neither happen at the expense of the user nor should the bar for participating in supporting free software with non-free modules be artificially raised. Of course we would all love for nVidia to open their source, but this will never be achieved by force and it will also never be achieved by angering the developers that try to support your open source software. I mean, cut nVidia some slack, they are not like 80% of developers who just don’t care about Linux and just produce their software for Windows or Mac. They actually, officially support Linux, with a driver that works fast and efficient and allows Linux users to jauntly grab a high end graphics card with out needing to worry about driver support. In the past I’ve been struggling with other video cards (like the no-name card in one of my consumer PCs), TV/Radio tuner cards, lightscribe CD burners, etc. spending days and finally giving up, because there is just no driver support for certain features of the hardware. I would have loved it, if they had closed source kernel modules as nVidia does, even thoug I prefer open source.

But as long as the GPL insists on such petty arguments (take the Linux vs GNU Linux discussion for example), I’d rather use BSD licensed software…


One thought on “FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘flush_workqueue’

  1. Many thanks for the incredibly useful information!!

    This helped get me out of an otherwise very tricky bind (no graphics?, oh nooooooes!!) when I tried to upgrade to a new kernel version: sys-kernel/gentoo-sources-4.4.39. The nvidia-drivers version I was trying to emerge was x11-drivers/nvidia-drivers-375.26.

    I needed to change specifically which *file* to use the instructions on (perhaps due to different kernel or NVIDIA-drivers version):

    I ended up replacing an EXPORT_SYMBOL_GPL statement (for mutex_destroy) in file:

    That was of course after trying quite a few other things!! The error log for the driver build did at least mention that symbol. After that, built and booted the kernel and finally the NVIDIA-drivers would build and install! Pheww! That was tricky! But, yaaay!! graphics again šŸ˜€

    Thanks very much for writing this up and posting it! I hope either or both sides of the mistake/disagreement can figure out something they can do to help get it sorted soon!

    I’m all into trying to improve my understanding of how to look after Gentoo! In general I love it.. but having to edit kernel source is a little deeper than I’d like to have to go all the time.

    It is kinda kewl in a fix-things-with-hacks sort of way, but it took long enough to get right that it nearly became annoying.

    Shouldn’t the NVIDIA-drivers package be masked because of this!?! (if it doesn’t install without kernel-mashing?)

    Champion!! Many thanks!

Please comment. I really enjoy your thoughts!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s