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: khz, MattKingUSA

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

Low Latency Kernel On Ubuntu 18.04 LTS

Postby asio4allmusic » Wed May 16, 2018 4:40 pm

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
Establlshed Member
Posts: 123
Joined: Fri Mar 17, 2017 12:27 pm
Location: near Frankfurt, Germany
Contact:

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Postby wjl » Thu May 17, 2018 8:23 am

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

Postby asio4allmusic » Thu May 17, 2018 9:03 am

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
Establlshed Member
Posts: 606
Joined: Thu Sep 11, 2014 3:04 pm

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Postby asbak » Sun May 20, 2018 8:11 am

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. =)

ubuntuuser
Establlshed Member
Posts: 185
Joined: Mon Jan 02, 2017 9:46 am

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Postby ubuntuuser » Tue May 22, 2018 10:14 am

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
Establlshed Member
Posts: 185
Joined: Mon Jan 02, 2017 9:46 am

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Postby ubuntuuser » Wed Jun 06, 2018 4:55 am

There is also the Liquorix Kernel

https://liquorix.net/

millerthegorilla
Establlshed Member
Posts: 51
Joined: Wed Oct 26, 2011 11:22 am

Re: Low Latency Kernel On Ubuntu 18.04 LTS

Postby millerthegorilla » Sun Jul 29, 2018 10:50 am

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!


Return to “HOW TOs, Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 8 guests