Linux Professional Audio Pt 2: Setting Up Fedora 3


So you read Linux Professional Audio Pt 1: What is Linux & Which Version is Best? and understand all about Linux distributions. There are a lot of them, even some that are specially designed for audio like KXStudio and Ubuntu Studio.

I want my computer to be used for many things, and find Fedora to be the best version of Linux for me. If you want to go with another distro you still might want to browse this article as some of the information might be relevant for your distribution too.

Installation

fedora_logoI am not going to go into this here as it’s covered in this installation guide for Fedora 24 workstation, with another detailed official full detailed guide on installing Fedora 24. I am currently using Fedora 24, but Fedora 25 is around the corner. Everything in this article should be valid for both versions, if I find out otherwise I will update accordingly.

You can easily dual boot it with Windows if you like, but Windows will hopefully just be a bad memory for you soon. Once you have Fedora installed successfully lets get onto the important business of setting it up right!

Don’t fear the terminal!

fedora-terminal-fearMaybe you have never used a terminal and entered commands into a computer before, well now is the time to sort your life out and become a real computer user!

Open the terminal by pressing the Windows Key on your machine and start to type the word ‘terminal’, as you type you will see the selection of programs that are available start to appear before you, as soon as the Terminal program is first in the list and highlighted, press enter and be transported to the magical world of Mr Robot and War Games (for the older readers.)

Install the RPM Fusion repositories

rpm-fusionOn Windows you have to hunt the web to find new software (and viruses), on Linux all the software you need lives in special places called repositories. Fedora comes with it’s own official one built in, but you should add these right away to get the very best software that does not come ‘out of the box’ with Fedora.

In the terminal copy and paste this in followed by Enter. NOTE in the terminal the short-cut for paste is Ctrl-Shift-V.

su -c 'dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'

Update the system to the latest version of everything

The ISO image you used to install Fedora was out of date as soon as it is was released, things move fast in Linux world! The first thing to type is:

sudo dnf -y --refresh upgrade

and go and get a cup of tea while it does its job.

Let’s understand from the beginning what we are doing:

  • sudo tells the computer that you are a ‘super user’, this basically means you can do anything you want on the computer. It’s part of Linux’s powerful security and beyond the scope of this article.
  • dnf is Fedora’s command line packet manager. On Ubuntu and Mint it’s apt-get. It’s used for downloading and installing stuff, which is exactly what you are doing now.
  • -y automatically answers yes any time you might have been prompted for a response
  • --refresh sets metadata as expired before running the command, this just seems to be good practice and the official advice on what to do.
  • upgrade is the command to run an update, in fact you can type update if you want instead, but for some strange reason they changed it recently to upgrade to confuse people 🙂

Make the desktop environment a little more familiar

Now, if you come from Windows you probably like expand and minimize buttons on your windows, so enter:

gsettings set org.gnome.desktop.wm.preferences button-layout 'appmenu:minimize,maximize,close'

I think the screen saver comes on far too soon and is annoying, so delay that onset with:

gsettings set org.gnome.desktop.session idle-delay 900

Do you like your files sorting with the directories on top? I do, if you do to:

gsettings set org.gnome.nautilus.preferences sort-directories-first true

Upgrade font rendering quality

Because the copyright Nazis hate Linux they want it to have crap font quality, there is a patent for subpixel rendering. If you have a display that is higher resolution than 1920×1080 then celebrate and skip this section! You don’t need subpixel rendering, your screen is too awesome.

Fedora is VERY keen to not breach any patents. Ubuntu and others don’t care so much. Unfortunately Fedora users need to jump through a few hoops to get things sorted. If you want high quality fonts, then do this:

sudo dnf -y install freetype-freeworld
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting slight
gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing rgba
echo "Xft.lcdfilter: lcddefault" | sudo tee ~/.Xresources

You should see much better font quality on reboot.

You just installed the ‘naughty’ version of the same font renderer you were using before, but now it has subpixel rendering turned on. It comes from the trusted 3rd party repository you enabled earlier rather than officially from Fedora.

Install essential applications

As I mentioned earlier, Fedora misses out on lots of essential stuff to avoid the copyright trolls, but we hate those guys so we type:

sudo dnf -y install ffmpeg-libs fuse-exfat gnome-tweak-tool

This gives us the multimedia codecs we want, the microsoft file system to use certain SD cards (the ones used in the majority of cameras), and an essential tool to change the desktop apperance.

I also add the following, these are more of an option:

sudo dnf -y install keepassx vlc chromium

This gives you Chromium, the free version of Google Chrome, KeepassX, the best password manager, and VLC player, all you need to watch films and listen to any music file format you can imagine.

Install audio applications

This is a massive subject that we will cover soon. Which are the best audio applications for Linux?! What plugins can you use? Which hardware is compatible?

Things have improved massively for Linux audio recently, now there is a huge selection of mature professional audio tools at your disposal. The most well known (sort of) free DAW on Linux is probably Ardour. This recently hit version 5 with some big improvements. I say ‘sort of free’ as you can download it from your distribution’s repository, but I strongly recommend you instead buy it from the home site to support the developers.

Electronic music makers will probably gravitate to the commercial Bitwig with its Ableton Live like features, or the free LMMS or Qtractor. They will also be thrilled to know that all the u-he plugins are now available for Linux. These include some of the best on the market. Even though they are still officially beta, they have been worked on since Nov 2014 and are perfectly stable. After reading the forum recently, I am pretty sure they will be officially supported very soon.

Technical problems that still cause headaches for Linux audio

While everything has been all smiles and sunshine until now, unfortunately there is still a dark side to Linux audio. This is mainly due to Linux audio still being a very small market and the fragmented nature of all the distributions. You might be one of the lucky ones and just plug in your audio interface, boot up your DAW and start making music. For many others there will be some very technical issues that need solving to get things working. This is because it’s quite likely nobody has ever used your exact interface with the exact same software on the exact same computer as you before!

The first hurdle you may encounter is that of real-time permissions for the audio driver. Basically, Linux cares a LOT more about security than it does about audio performance. Security settings on a computer are not something people coming from Mac or PC have ever had to deal with, so it can be a bit intimidating. The good news is, you don’t really have to understand this stuff IF you can just get someone to tell you what to do for your specific situation. For Fedora, after a lot of tedious research, I can tell you exactly what to do!

Setting up Fedora audio for real-time priority and increased max locked memory

Check jack is installed, if not, install it

There is a special bit of audio software called jack on Linux that we will talk about in the future. You may or may not need it, but installing it can help you sort out the real issues if you use the other audio driver ALSA too. Depending what software you installed you may have it installed and set up correctly already. Type:

groups

I get the following as my machine is now setup how you want yours to be. NOTE my username is david, you will need to note yours for the next step.

david wheel jackuser

Do you see jackuser there? If so, skip to the next section, otherwise:

sudo dnf install jack-audio-connection-kit qjackctl
sudo usermod -a -G jackuser (your username)
groups

Now do you see jackuser there? Congratulations.

Edit the 95-jack.conf file to enable realtime permissions and change the limit for the maximum amount of locked memory

Go to the terminal and type ulimit -a , you will see something like the following. Note the parts in bold.

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31111
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31111
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

Fedora has a bug that means when we change the settings to enable the kernel permissions we WON’T see that change reflected in the command line. This might have caused you to go mental as you could not have ever known this, so extreme thanks to timbyr on this Ardour forum thread for pointing this out!

We need to edit the following file as a ‘super user’ (remember, the user who has total control of the machine). The best way to edit a system text file as a super user is to use a command line text editor such as nano (or vi if you are brave, that is pre-installed), so if you don’t have nano, install it:

sudo dnf install nano

and edit the text file:

sudo nano /etc/security/limits.d/95-jack.conf

and make sure it has these bold values replacing the original ones (these overwrite the settings we just displayed a moment ago):

@jackuser - rtprio 98 corresponds to real-time priority (-r)
@jackuser - memlock unlimited corresponds to max locked memory (kbytes, -l)

After a reboot, with the bug, we type ulimit -a and will not see the changes. As a bug workaround, just to see if our editing of 95-jack.conf worked, type su - username and enter your password. Now type ulimit -a and your changes should be visible! The bug is still happening in Fedora 25 (Sun 19th Mar 17.)

The main test will be when you load up your DAW and see if you get an error report saying no real time kernel access and/or something like “WARNING: Your system has a limit for maximum amount of locked memory!”

Now your machine should be ready to rock!

If you have spotted any errors, have anything to add, or just want to say hello, then please use the comments below!

Facebooktwittergoogle_pluslinkedin

Leave a comment

Your email address will not be published. Required fields are marked *

3 thoughts on “Linux Professional Audio Pt 2: Setting Up Fedora

  • Davor

    Thank you so much for writing this great article. Linux musicians can certainly appreciate it. However, people should understand that this is what happens when you want to make it work in Fedora distribution. I use Debian and it’s much easier to set it up for audio.

    • David Post author

      Cheers 🙂 I have not used Debian, but I hear it’s excellent. Since I wrote this article I have been asked why I did not recommend AV Linux http://www.bandshed.net/avlinux/ .It’s based around Debian testing and is all configured for audio out of the box. The developer seems to be really active at the moment too, popping up all over the place helping people out.

      Is it not the case that even on Debian you need to enable real time kernel permissions? A good follow up article to this would be my attempt at the definitive setting up RT permissions article on *all* desktops, the world needs that! There is bad out of date info everywhere. I could make many virtual machines, would take ages. I made a script to do it on Fedora recently:

      #!/bin/bash
      sudo usermod -a -G jackuser YOURUSERNAME
      printf "# Default limits for users of jack-audio-connection-kit\n\n@jackuser - rtprio 98\n@jackuser - memlock unlimited\n\n@pulse-rt - rtprio 20\n@pulse-rt - nice -20" | sudo tee /etc/security/limits.d/95-jack.conf

      I have a lot of new Linux articles planned. I might do a full review of my new sound interface, a Scarlett 6i6 2nd gen, working on Linux in Ardour. So far, it’s been perfect.