Flickering for Intel graphic card in Linux 4.2

After I upgraded my Dell Precision m3800 to the new Kubuntu Wily 15.10 I had a very bad surprise: the screen was continuously flickering in a way that it was unusable. This happens only if you are NOT using the default highest resolution 3200×1800 which, at least for me, is really too small.

I thought it was a problem with the new Plasma, but the culprit is the Intel i915 driver in the 4.2 kernel which comes with the new version of (K)ubuntu, as reported in this bug: https://bugs.freedesktop.org/show_bug.cgi?id=91393. In particular, two commits seem to be the cause, and reverting them fixes the problem (hopefully the whole bug will be fixed).

I’m detailing the procedure to get the kernel sources, reverting the two commits, and compile your own fixed kernel:

  • You need git to revert the patches (though you’re not getting the kernel sources from the git repository), so you need to install that if it’s not already installed.
  • Install the kernel sources for your current kernel:
    apt-get source linux-image-$(uname -r)
    this will unpack the kernel sources in the current directory (you don’t need to use sudo for this; if you use sudo, you may want to change the owner of the sources’ directory to match your user, so that you won’t need to compile the kernel as root)
  • Install required packages to compile the kernel
    sudo apt-get build-dep linux-image-$(uname -r)
  • Install other required packages (needed when you install your compiled kernel later):
    sudo apt-get install linux-cloud-tools-common linux-tools-common
  • Save the above mentioned two commits into two local files, in the following order (e.g., name them patch1.txt and patch2.txt):
    https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/patch/?id=4e96c97742f4201edf1b0f8e1b1b6b2ac6ff33e7
    https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/patch/?id=5fa836a9d85975c5f0f1219669523c1f0ac64349
  • Enter in the directory where the kernel sources have been unpacked and revert the two commits in the reversed order:
    git apply -R patch2.txt
    git apply -R patch1.txt
  • Run the following commands in the kernel sources directory as described here:
    chmod a+x debian/scripts/*
    chmod a+x debian/scripts/misc/*
    fakeroot debian/rules clean
  • “In order to make your kernel “newer” than the stock Ubuntu kernel from which you are based you should add a local version modifier. Add something like “+test1″ to the end of the first version number in the debian.master/changelog file, before building. This will help identify your kernel when running as it also appears in uname -a.”
  • Compile the kernel (this will take some time, and require some free space on your hard disk):
    fakeroot debian/rules binary-headers binary-generic
  • This will create in the end some .deb files in the parent folder; install them all with dpkg, e.g., with
    sudo dpkg -i linux*4.2*.deb
  • reboot and enjoy your Linux without flickering 🙂

2 thoughts on “Flickering for Intel graphic card in Linux 4.2

  1. Tony

    When I enter “apt-get source linux-image-$(uname -r)”
    I receive the following:

    Picking ‘linux’ as source package instead of ‘linux-image-4.4.0-040400rc5-generic’
    E: Unable to find a source package for linux

    Suggestions?

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.