Low Latency Kernel On Ubuntu 18.04 LTS

Post fully complete "how to" guides and tutorials here. This is a great place to get feedback on stuff you might put in the wiki.

Moderators: MattKingUSA, khz

Post Reply
asio4allmusic
Posts: 2
Joined: Sat Jan 13, 2018 9:23 am

Low Latency Kernel On Ubuntu 18.04 LTS

Post by asio4allmusic »

Hi,
i'm new on this website so if i'm gonna break some rules tell me please :D
Anyway, i'm about to install the new version of ubuntu 18.04 lts and i want to install low latency kernel too and a audio driver for my native instruments komplete audio 6 to run reaper (natively without wine).

I don't want to install ubuntu studio because of two reasons:
1) i want to learn about drivers,kernels and stuff on linux
2) i want to keep things very clean and easy so only os,lowlatency kernel,drivers & reaper stop

Can you help me out ? maybe with some simply tutorial ?

Ty a lot <3
User avatar
wjl
Established Member
Posts: 224
Joined: Fri Mar 17, 2017 12:27 pm
Location: near Frankfurt, Germany
Has thanked: 48 times
Been thanked: 26 times
Contact:

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by wjl »

Hi asio4allmusic,

welcome on the LinuxMusicians forum. You've found the right place, and also asked the right questions, which I'll briefly try to answer here.
asio4allmusic wrote:...i'm about to install the new version of ubuntu 18.04 lts
A good choice for a beginner with Linux IMHO. My wife runs that, I have the older 16.04 at work, and use plain Debian on my machine at home.

For music production, I did however also configure the additional repositories from KXStudio ( see http://kxstudio.linuxaudio.org/ for more info ), which I always recommend for Debian and/or Ubuntu musicians. With the installation of their metapackages, you'll get tons of free software, and tools like Carla or Cadence exist only there.
asio4allmusic wrote:i want to learn about drivers,kernels and stuff on linux
The best resources I know if you want to learn are the wonderful manual of our fellow musician Glen McArthur who made AVLinux ( see http://www.bandshed.net/avlinux/ - his manual is at http://bandshed.net/pdf/AVL2018UserManual.pdf ). The pages starting at 60, or even 72 should answer some questions about system setup. Another good resource is LibreMusicProduction, like for instance in http://libremusicproduction.com/article ... arted-jack where they explain how to setup Jack, and why you might want to have Cadence for this.
asio4allmusic wrote:i want to keep things very clean and easy so only os,lowlatency kernel,drivers & reaper stop
As for drivers, you probably don't need them. You have the Komplete Audio interface? I don't know much about that, but chances are that if it doesn't need drivers for Macs (because of their CoreOS), you will probably also have that plug & play experience on Linux. Just see if it is registered as a class compliant USB device, and if the system settings in Ubuntu see it as an audio device. If yes, then you can go on with the low latency kernel, Jack, and so on.

Hope this helps for your first steps. I haven't tried Reaper except on Windows, but I hear that it should run just fine by now. It might help to read Glen's thoughts about 32 and 64 bits, and to check Carla to integrate Windows VSTs in case you want them. I personally stay even more native to the system, and prefer LV2 (over VSTs), and Ardour (over any existing emulated or ported software).

Good luck, and keep asking questions.

Cheers,
Wolfgang
more about me on my blog
asio4allmusic
Posts: 2
Joined: Sat Jan 13, 2018 9:23 am

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by asio4allmusic »

Hi wolfgang,
thank you a lot for your reply it was very useful !

Speaking about my audio interface yes it is usb compliant and yes it is plug&play on ubuntu so i'm super lucky. 8)

I will read the manuals you gave me and no, i will not use windows vst on reaper...
and to check Carla to integrate Windows VSTs in case you want them
...but it doesnt support a lot of linux vst too... so i will anyway use carla for the moment hoping in future releases ! :roll:

Best Regards,
Nicola
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by asbak »

Hi there

The learning curve (to really get to the point where you understand things and your system is mostly working well) is quite steep, so be prepared to do a lot of reading & experimentation.

Also, if you really want to learn about kernels, configuration etc you probably need a spare drive (drives are cheap) so you can practice things on there and if you break the OS, it doesn't matter and you can start over.

There are a lot of compromises between having a system set up the easy way (ie via repos, pre baked distros, packages etc) and having your system work reliably and the way you need it to work.

The more you rely on distros and pre-baked stuff the more you become a hostage to it (it's a bit like being trapped in a walled garden from commercial software vendors) and you'll soon realise that when things don't work that you need to work, you cannot really do much about it until whoever maintains packages & distros fix the particular issue. In such cases you're better off knowing how to fix it yourself, but then you need to be more self-reliant and this takes much more effort & time to learn.

System libraries (as provided by the OS vendors) are often old and missing functionality which some packages require.

Core audio libraries (like jack) are provided with things like DBus enabled which often screws up and can be very confusing to troubleshoot for newcomers.

There are endless issues which, until you become familiar with them, is going to lead to problems down the road. So understand what you are getting into (it's a rocky road) and good luck. =)
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
ubuntuuser
Established Member
Posts: 315
Joined: Mon Jan 02, 2017 9:46 am
Has thanked: 1 time
Been thanked: 5 times

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by ubuntuuser »

asio4allmusic wrote:Hi,
i'm new on this website so if i'm gonna break some rules tell me please :D
Anyway, i'm about to install the new version of ubuntu 18.04 lts and i want to install low latency kernel too and a audio driver for my native instruments komplete audio 6 to run reaper (natively without wine).

I don't want to install ubuntu studio because of two reasons:
1) i want to learn about drivers,kernels and stuff on linux
2) i want to keep things very clean and easy so only os,lowlatency kernel,drivers & reaper stop

Can you help me out ? maybe with some simply tutorial ?

Ty a lot <3
There are realtime (rt) and lowlatency ubuntu kernels at http://simosnet.com/debian/packages/Kon ... tu/kernel/

For Ubuntu 18.04 rt kernel

Install headers first

linux-headers-4.14.18-rt15-klue-rt_amd64.deb

then the kernel image

linux-image-4.14.18-rt15-klue-rt_amd64.deb

Might have to uninstall irqbalance sudo dpkg --purge irqbalance so that the kernel image installs.
ubuntuuser
Established Member
Posts: 315
Joined: Mon Jan 02, 2017 9:46 am
Has thanked: 1 time
Been thanked: 5 times

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by ubuntuuser »

There is also the Liquorix Kernel

https://liquorix.net/
millerthegorilla
Established Member
Posts: 72
Joined: Wed Oct 26, 2011 11:22 am

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by millerthegorilla »

I would highly recommend not installing a kernel from some unknown source, and building it yourself, if you want a realtime kernel.

The low latency kernel can be installed from the apt. Simply type apt-get install linux-lowlatency.
The building of a kernel is not difficult, unless you want to modify the kernel configuration options. This can be fun to experiment with, and in general doesn't risk any harm, the kernel will go into panic if there is some issue that means it is wrong for your machine. But in general you can copy over the configuration file from your installed o/s and, because it is generic - for all machines - it has the kernel config that will match your machine. Then it is only a matter of selecting the correct rt_preempt option to get the realtime kernel.
Because I'm lazy and forgetful, I tend to use the following set of instructions to build it.

https://askubuntu.com/questions/72964/h ... ime-kernel

Because you are using a generic kernel configuration, your build process will take a few hours, perhaps. What I do to speed things up, is to copy over the config file and then instead of running the command, 'make menuconfig' to edit the configuration by hand, I plugin the usb hardware, micro-sd cards etc, and anything else that loads a kernel module into the running kernel that I am currently using, and then run the command 'make localmodconfig'. This generates a kernel configuration file that contains all of the modules selected that exist in your running kernel. I then run 'make menuconfig' and select all the usb device drivers for sound cards and other hardware that I might use. I also, when I need to, check the net section to make sure that the firewall modules that I need are loaded. I copy these from a generic kernel configuration.

When editing the kernel config, search the different options online and inside the make menuconfig graphical editor be aware that you can press / to search and ? for help on some module or other. IF the help info for the particular module is not enough, then search online. If you are uncertain, then you can (and should in most cases) choose to compile some module as just that, a module, rather than compile it directly into the kernel image. Then, if it is incompatible it will not be loaded at boot time. If you are certain that some module works with your hardware, then you can choose to compile into the kernel which simply speeds up the boot time a little.
You will find that the position of some module within the tk menu editor is listed in the help info for that module. If you find yourself searching for a module that you cannot seem to find, then check in the help that its dependencies are selected, as otherwise it may not show up in the menu. The menu simply sets a text configuration file menu.config from memory, so you can always search and edit that if you really want to, but it is not sensible as you cannot see which dependencies might be missing.
The make localmodconfig technique saves a great deal of time when compiling the kernel. On an i7 2009 iMac it took well under an hour, perhaps even less than 30 minutes.

You can obtain processor information from the command 'cat /proc/cpuinfo' and adjust certain parameters or edit your CFLAGS for compilation, but I often don't bother. I used to examine an online database and check all the kernel config options manually, but it is a bit of a waste of time. Serious kernel compilation is for specialised situations like realtime critical apps such as the control of engineering lasers or other sensitively calibrated equipment or for onboard embedded systems etc.

The benefit of the instructions that I have linked to above are that the compilation process spits out deb files for the kernel and the headers. You can then keep them and install them for that machine if you reinstall.
Once ubuntu is installed though, and you have a kernel that you are happy with (and in most cases the linux low latency kernel is sufficiently good to work well), then you can install the kxstudio repositories to get a wealth of well maintained plugins and applications.

http://kxstudio.linuxaudio.org/Repositories

Follow the instructions, making certain that you install the gcc repos if necessary, and then tab complete the command 'sudo apt-get install kxstudio-meta-audio-' to see plugins and apps etc or just tab complete 'sudo apt-get install kxstudio' to see the other funky stuff available. Make certain to install cadence and Katia as a foundation, ardour as a daw and guitar if you like guitar fx and install kxstudio-meta-audio-plugins-all to obtain a huge amount of free lv2s and vsts etc. With ardour, make certain to read the manual - the availability of external sends and inserts makes it really powerful.

Any usb sound card, as long as it is cc mode compatible will work fine with ubuntu. Once plugged in, type 'ls /proc/asound/cards' to see that the card is listed and to obtain its name, but it should automatically be listed in cadence, though you might need its name if you use qjackctl.
I would recommend installing kxstudio-default-settings, as otherwise you will need to manually edit some files, such as /etc/security/limits.d/audio.conf and add yourself to the audio group.

http://jackaudio.org/faq/linux_rt_config.html - they use the 'realtime' group instead of audio group in this link.

The package kxstudio-menu is worth installing as well, if it works. It will add submenus and neatly organise installed packages. Alternatively, try installing ubuntustudio-menu for a similar configuration. If you are using gnome3 then perhaps don't worry, but I would recommend considering xfce or lxde as a desktop manager since these have lower memory requirements and often have less jitter (interference with the sound card).
Finally, having recently used avlinux for the first time, I notice that the maintainer is adding some kernel configuration commands to the boot line - you can try adding threadirqs and/or transparent_hugepage=never to increase efficacy. threadirqs will allow you to achieve realtime on a standard kernel, to some degree, and transparent_hugepages=never decreases jitter, I imagine. I currently don't use either, and get good results.

The only other thing that I do, is turn of unnecessary services that consume memory or increase jitter. Systemctl can be used to turn off things like avahi-daemon etc and cups, upowerd (if its not a laptop) and internet time daemon ntpd if it exists, and the settings app usually has a startup section in which you can disable things like unnecessary panel applications. You can even write a bash script to turn off all the guff before you start recording or doing anything else that is time critical.

At the minimum, install ubuntu, install the low latency kernel using apt, and then install the kxstudio repos, and you'll be fine.
Have fun!
lilakmonoke
Established Member
Posts: 59
Joined: Sun Feb 10, 2013 9:47 am

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by lilakmonoke »

i was running kxstudio + xubuntu 18.04 with a generic kernel and had all kinds of xruns, midi dropouts etc. i do all my sequencing from pure data patches so midi timing is critical. i just installed the liquorix kernel and it seems it solved all these problems. ill do some more low latency testing and will report back.

its really easy to install btw. just two lines of code, see end of this page: https://liquorix.net/

so i can get down to 2 x 256 samples buffer and 5.3 ms block latency even at heavy load with zero xruns. if you look at the cpu load its evenly distributed over the I5 four cores and reacts really fast to load changes. this is quite amazing! next test is with 96khz sample rate ...

even at 96khz and 2 x 512 samples buffer NO PROBLEM, 2 xruns after running a few videos in parallel. ... and it does sound double as good as 48 khz ;-) so this kernel is highly recommended by me so far especially if you have a multicore cpu. its good enough for gaming so it will power a studio DAW even better.

to give you an idea of my system:
lilak@lilak-desktop:~$ inxi -b
System: Host: lilak-desktop Kernel: 4.20.0-5.2-liquorix-amd64 x86_64
bits: 64
Desktop: Xfce 4.12.3 Distro: Ubuntu 18.04.1 LTS
Machine: Device: desktop Mobo: ASRock model: Z87 Pro4 serial: N/A
UEFI: American Megatrends v: P2.30 date: 07/11/2014
CPU: Quad core Intel Core i5-4440 (-MCP-) speed/max: 1487/3101 MHz
Graphics: Card: NVIDIA GM107 [GeForce GTX 750 Ti]
Display Server: x11 (X.Org 1.19.6 )
drivers: fbdev,nouveau (unloaded: modesetting,vesa)
Resolution: 1920x1080@0.00hz
OpenGL: renderer: llvmpipe (LLVM 7.0, 256 bits)
version: 3.3 Mesa 18.2.2
Network: Card: Intel Ethernet Connection I217-V driver: e1000e
Drives: HDD Total Size: 120.0GB (87.8% used)
Info: Processes: 233 Uptime: 1:51 Memory: 2380.2/7911.4MB
Client: Shell (bash) inxi: 2.3.56
jonetsu
Established Member
Posts: 2036
Joined: Sat Jun 11, 2016 12:05 am
Has thanked: 10 times
Been thanked: 22 times

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by jonetsu »

lilakmonoke wrote:its really easy to install btw. just two lines of code, see end of this page: https://liquorix.net/
I recently installed Xubuntu 18.04 and by now have moved about 85% of the audio production to this new system. One of the first things I did is to install the low latency kernel from the Ubuntu archives. I use 256x4 to record acoustic guitar with headphone monitoring, otherwise I use 512x8. Although I do not experience xruns (i5-3570 CPU @ 3.40GHz, 16GB RAM) using Bitwig and wine-staging/linvst so far, I might nevertheless try the liquorix kernel since it seems easy to install. Thanks for mentioning it, as it seems to have a few optimizations here and there.
User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Post by bluebell »

I tried the Liquorix kernel and it's the same as always: the Ubuntu lowlatency kernel works best with Qtractor sessions where I need buffer sizes above 256. At least on my machines.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

Post Reply