How To: Fix X.org Black Screen with Nvidia drivers and Linux Kernel 3.10+

I’m running Arch Linux with a Nvidia graphics card, and after doing a system update back in March 2014 any kernel past 3.10.x would cause X / Xorg to fail to start; instead there’d be a black screen and the fans on the graphics card would spin up to full speed so my machine sounded like a hovercraft. I initially got around this by running the linux-lts (Long Term Support) kernel, until that too exhibited the exact same issue and I was forced to boot the system from USB, chroot into it and switch out the nvidia driver for nouveau (the open-open source, 2D accelerated nvidia driver).

However, as I happen to quite like accelerated 3D graphics and occasionally playing games, I’ve been digging around for a fix for this for ages – and it turns out that the fix (which is now added to the Arch Nvidia wiki page) is to add the following kernel parameter to your bootloader’s kernel line:

If you’re using GRUB, when menu shows up just move the selection to Arch or your Linux distro exhibiting the issue, then hit the e key to edit the line, and change the linux kernel loading line from, for example:

To include the rcutree kernel parameter, something like this:

At which point you can hit F10 (again, assuming you’re using GRUB) to boot using your newly added kernel parameters. Don’t worry if your kernel loading line identifies your partition by UUID value instead of plain ‘ol /dev/sdx – that’s fine and mine does too (I changed it to /dev/blah to make the line shorter) – just add the parameter and try your luck – hopefully your distro will now boot into X without issue, and you can stop swearing and cursing like a drunken sailor. Or perhaps that was just me.

Further reading about the issue on the nvidia development website: https://devtalk.nvidia.com/default/topic/567297/linux/linux-3-10-driver-crash/4/.

Cheers!

P.S. If you need to chroot into your Arch system to change the drivers also, then here’s a quick run-down of the process. Make a bootable USB from the Arch ISO (I could only get this to work by using the dd command from another Linux distro – Rufus and UNetBootin would make a USB I couldn’t boot from – google or search this site for “dd iso usb” for instructions), then, when you’ve booted into the live USB/CD-ROM or what-not, run the following commands (the “<---- optional" lines are optional, don't actually enter that into your files, obviously!):

With any luck you'll have now transitioned the drivers successfully and have a fully working system - fingers crossed, good luck!

How-To: Install the Liquorix kernel in LMDE

Just because all GNU/Linux distros come with a kernel, it doesn’t mean that it’s the best kernel to use. This was made quite clear to me recently when I discovered that whenever I safely removed a USB drive from my machine it caused a kernel panic in the present LMDE kernel (2.6.39.2) which promptly hung the machine. I figured out I could work around the issue by unmounting USB drives through gparted, but that’s pretty weak sauce, so I decided to cut to the root of the problem and change kernels.

In the past I’ve spent a long time picking specific kernel options, building the kernel, and then it hasn’t worked at all – so this time I wanted something I was pretty sure would work, and I didn’t want to spend forever on it, so what are the options?

Zen and the art of kernel maintenance

The official Linux kernel lives at kernel.org, and is the reference design if you will for all existing kernels. The new stuff generally gets added to the mainline kernel, and then other kernels add or remove bits and pieces to become their own kernels such as the Ubuntu kernels or the Debian kernels or what have you.

The process of adding or removing bits and pieces is pretty much open ended, and if you don’t know exactly what you’re doing you can spend a long time reading and experimenting, so I’ve opted to pick something pre-customised from the Zen kernels:

From the zen kernel about page:

The Zen Kernel is a the result of a collaborative effort of kernel hackers to provide the best Linux kernel possible for every day systems. We include code that is not included in the mainline kernel in an attempt to create an all-around better kernel for desktops (although it can be compiled otherwise). This is done by including new features, supporting latest hardware, and including various code and optimizations to better suit desktops. Zen is a 100% community oriented project so, as a result, everybody can contribute to the project.

Who mods the modders?

Liquor up front, poker in the rearA chap going by the handle of Damentz, who seems to have the black art of kernel crafting down to a tittle, takes that zen-kernel source and (I think) tweaks it some more to produce the Liquorix kernel.

What does he do exactly? I’ve absolutely no idea – maybe it’s in the forums somewhere, but I think the main thing he does is make it compatible with Debian, and provide a repository so we can grab and use his pre-built pre-modded zen kernel on Debian or any Debian-compatible distro such as LMDE. He’s also nice enough to build both 32-bit and 64-bit kernels so the repo should provide whichever version is appropriate for your system at install time.

Installing the liquorix kernel

Note: It’s a really good idea to make sure you have the dkms package is installed at this point so that any proprietary third-party kernel modules like graphics card drivers (nvidia/ati official drivers), virtualbox modules etc. get rebuilt as part of the kernel install.

1.) Add the liquorix repository to your apt sources file at /etc/apt/sources.list:

2.) Update your system package list:

3.) Get and install the liquorix repository key to authenticate the packages:

4.) Install the liquorix kernel and header sources (you’ll want the sources so that DKMS can automatically rebuild kernel modules for you as required when you update the kernel) – it’s probably best to do this through synaptic/package manager so you can see what’s there:

Liquorix packages

Apart from the keys for package authentication, you really just need the linux-image-liquorix-amd64 and linux-headers-liquorix-amd64 meta-packages (or suitable 32-bit versions) which will then drag in the most recent version of the kernel, whatever that happens to be at the time.

While the packages are installing it’s best to keep an eye on the output to ensure that your dkms modules successfully rebuild – but as long as you’ve opted to install the kernel headers package along with the kernel there shouldn’t be a problem – it’s just nice to be confident that when you reboot you’re not going to be booting into a black screen with a flashing white cursor…

Liquorix DKMS module rebuild successful
Liquorix DKMS module rebuild successful

What now?

Reboot and choose your new kernel from the grub boot menu! (it’ll be the new default). Once you’re up and running you can always run uname -r or uname -a to confirm your kernel version, then take that bad-boy for a spin…

Liquorix uname -r

I only installed mine this morning, but the first thing I did was mount and then unmount a USB drives – and what happened? It kernel panicked. Turns out that the bug seems to be quite widespread among distros (Debian Bug 631187), but you can work around it by manually unmounting using umount (or by using gparted, as I found).

Still, it’s a new, multimedia/gaming optimised kernel (3 series, no less!) – which has its faults, but it seems a lot of kernels at the moment do, and it looks like I’d have to go back to 2.6.38.something to find a kernel which hasn’t had this bug introduced.

I’ve read good things about zen kernels in the past, so I’m glad to finally run one. Once I’ve had a chance to play around with it and that unmount wrinkle’s ironed out I’m sure it’ll be a nice, responsive kernel. And if it isn’t, then I’ll write another post that calls it names =P

Cheers!

Update 21/09/2011: I’ve read on the Liquorix forums that DKMS is not a great package, and although it might do useful things, it does them in bad, non-standard ways, so they highly recommend you uninstall DKMS entirely, and install things like graphics drivers and wifi drivers from the manufacturer’s sites directly (using sgfxi) because if DKMS screws it up, it can get pretty scrappy to fix.