Tuning Ubuntu Studio for HTPC

credit: https://wiki.linuxaudio.org/wiki/system_configuration#installing_a_real-time_kernel

  • Checking /etc/fstab mounting drive should using noatime. 
  • Ubuntu Studio already set vm.wappiness = 10. But if you have more than 4 GB ram you could run HTPC linux without swap.
  • add user to audio group. Use $USER return current user or just type username.

sudo useradd -G audio $USER

  • limits.conf/audio.conf. It is advisable to set up your /etc/security/limits.conf file properly, for example:

@audio – rtprio 90 # maximum realtime priority
@audio – memlock unlimited # maximum locked-in-memory address space (KB)

  •  Using realtimeConfigQuickScan script for checking system

You need to install git first

sudo apt install git

Install script and run script

git clone git://github.com/raboof/realtimeconfigquickscan.git
cd realtimeconfigquickscan
perl ./realTimeConfigQuickScan.pl

  • If script warn about CPU governer and said CPU are not run in performance mode. As some might found that cpufreq don’t have driver for their CPU. Just disable CPU energy saving and Turbo mode in Bios would be more easy solution. you could install cpufrequtils and run cpufreq-info to check if driver is available or not. You could check CPU speed by using command

more /proc/cpuinfo | grep MHz

After setting change, every cores in CPU should run at same speed whether load are high or low.

  • In Ubuntu there’re no out of the box realtime kernel, we have to built it ourselves. If you just using Linux for HTPC and didn’t record video or audio, you don’t need realtime kernel. To install necessary packages run

sudo apt-get install kernel-package fakeroot build-essential libssl-dev

mkdir -p ~/tmp/linux-rt
cd ~/tmp/linux-rt
wget -c https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.11.8.tar.xz
wget -c https://www.kernel.org/pub/linux/kernel/projects/rt/4.11/patch-4.11.8-rt4.patch.xz

Extract the kernel sources and patch them with the RT patchset:

tar xJvf linux-4.11.8.tar.xz
cd linux-4.11.8
xzcat ../patch-4.11.8-rt4.patch.xz | patch -p1


cp /boot/config-`uname -r` .config

This will copy the config of the kernel you’re currently using. You might want to consider using a config of a kernel already optimized for audio work, like the Ubuntu -lowlatency kernel config. The next step is to create a new config with full preemption enabled from the copied config:

make oldconfig

make -j `nproc` LOCALVERSION= deb-pkg


I don’t recommend booting neither realtime or lowlatency kernel for audio playback. When playback with ALSA mode in deadbeef and audacious, I found that its sound a little widen, and less dynamic compare to generic kernel. And I cannot hear differences between realtime and lowlatency kernel. Unless, you could hear differences between generic and lowlatency, there are no need for compiling realtime kernel, imo.

Details of my system are Ubuntu Studio 16.04 LTS, kernel version 4.11.8, and ESI Juli@ + External DAC



Leave a Reply

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