back

Realtime Kernels for Ubuntu

Introduction

A realtime linux-rt kernel (not linux-lowlatency, and not a tuned linux-generic) are a must to do realtime audio processing at ridiculously low latencies in linux (<3ms).

Realtime audio processing at ridiculously low latencies is necessary to play synthesized music in real time, rather then use a sequencer or do recordings. It also helps for the latter two.

Ubuntu Studio have abandoned real time kernels, mainly because rt kernels are difficult to maintain properly. However, that's also unfortunate; full rt_preempt is simply the only real unique opportunity that linux audio has to offer compared to Mac and Windows, and they just threw it out the window for their own covenience. It would be a much better trade-off to offer Ubuntu Studio for LTS releases only, but include your realtime kernel. If you're doing audio, stability and performance are the primary concern. LTS is a good match for both.

Primarily for my own production use, I set up a real time kernel repository. It consists of a reasonably close version of a vanilla kernel patched with rt_preempt and configured like the Ubuntu kernel. I use these both for high-reliability audio performance and also for my every day primary kernel and they work great, usually with a couple limitations.

Unofficial Kernel Repository! Be nice, don't pester the Ubuntu folks

These kernels are prepared carefully, but they are not affiliated with Ubuntu. DO NOT contact the good folks at Ubuntu, Canonical or Ubuntu Studio for support when using these kernels. Reproduce the problem with an official kernel, then it's okay to ask for help. If in doubt, get a seperate partition with a minimal system to use these kernels on, and use the official Ubuntu kernels day to day. It's a good idea to have a special "production" live performance system anyway!

SECURITY ADVISORY

These kernels do not have the usual Ubuntu patches applied and may require disabling security features of Ubuntu to run properly. DO NOT USE THESE ON SERVER MACHINES ON THE INTERNET UNLESS YOU KNOW WHAT YOU ARE DOING.

Release Schedule

New versions of these kernels will be made available a couple weeks after the first point release of a new Ubuntu version

Architecture Support

Only 64-bit Intel compatible CPUs are supported

Installation

  1. Import the key into the keyring

    sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com 57ED9602
    
  2. Add the repository

    # Ubuntu 12.04
    sudo sh -c 'echo deb [arch=amd64] http://deb.capocasa.net/rt precise universe > /etc/apt/sources.list.d/linux-rt-cmc.list'
    
    # Ubuntu 14.04
    sudo sh -c 'echo deb [arch=amd64] http://deb.capocasa.net/rt trusty universe > /etc/apt/sources.list.d/linux-rt-cmc.list'
    

    Only LTS releases are supported.

  3. Update sources and install

    sudo apt-get update
    sudo apt-get install `apt-cache search linux- | grep '\-rt[0-9]*\s' | cut -f1 -d\ `
    
  4. Reboot

    sudo reboot
    # ... and you're good do go.
    

    If you don't want the realtime kernel to load by default, modify your grub settings.

If startup no longer works

It is possible that your machine will no longer start properly or freeze randomly after installing these kernels if it conflicts with other software or hardware you have installed. See Configuration for known issues.

If this happens, reboot your machine and select "Advanced Options For Ubuntu" in the GRUB boot menu. Select the topmost entry that contains the word generic. This is your normal Ubuntu kernel that should always work.

Once you have booted with the generic kernel, you can either uninstall these kernels or see if you can get them to work by uninstalling potentially conflicting software or removing or disabling conflicting hardware. Try taking a cell phone picture of the error message (it normally says "kernel oops" or "kernel panic" and google it to see what may be causing the conflict. If you figure it out, use apt-get remove to uninstall it and contact me so I can mention it in the configuration section.

Uninstallation

    sudo apt-get remove `apt-cache search linux- | grep '\-rt[0-9]*\s' | cut -f1 -d\ `
    sudo rm /etc/apt/sources.list.d/linux-rt-cmc.list
    sudo apt-get update

Configuration

Some kernels require some special Ubuntu configuration to run properly.

12.04

14.04:

Hardware specific configuration

On my Lenovo y560p, it is necessary to disable an interrupt to get rid of some bug-induced system load.

What's next?