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

EXPORT_SYMBOL_GPL(flush_workqueue);

(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:

EXPORT_SYMBOL(flush_workqueue);

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:

Continue reading

Advertisements

[Linux] “0.107 No irq handler for vector” aka “Problems with my PCIe Port”


As you may have already guessed, I was currently building a new Kernel for my PC (a md8818), and while doing so I encountered a strange problem, which I didn’t quite understand.

Of course, first thing to do is to ask Google, and I found out that I wasn’t the only one having that trouble, but it also seems like no one really had a solution to it (except for suppressing the symptoms). It took me 11 Kernel builds, until I finally eliminated the problem, so to help you not go through all this mess yourself, I’d like to present the problem plus solution.

Continue reading

[Linux] Before building a Kernel


This entry is about a little something I wrote down on what you want to do, before building a Kernel. It is aimed for users with some Linux experience that want to build their first Kernel (and fail). It’s not about the building process at all, but about the information process that needs to take place even before building the Kernel!

Continue reading