Many xruns and message alsa backend stopped

I have a problem running ardour on eOS Loki using usb interface.
I get many xruns and then the message that the back end has failed.

Even without recording but just monitoring… I can hear it dropping out… potential xruns.
I am running at 512k buffer.

Is there a way to find out why this is happening.
ulimit is set to unlimited and I am running at performance level cpu too.

Using ardour 5 lts release (even though I have a 5.x subscription).

Is it a problem with pulse running. I think that ardour bypasses this anyway.

Well,… There is one thing you can to but it is potentially VERY DANGEROUS, and it also may help a lot or not at all.

There is a file “/etc/default/grub”, and in that file there should be this line:

GRUB_CMDLINE_LINUX_DEFAULT=“quiet”

Now you need to edit it - in a text editor, as root - and add the word “threadirqs” so it should look like this:

GRUB_CMDLINE_LINUX_DEFAULT=“quiet threadirqs”

Save the changes and reboot.
Be VERY CAREFUL not to misspell it and not to change anything else because errors in that file may cause your system not to boot at all. The best thing to do is to make a backup copy of that file before you edit anything, so in case something goes wrong you can boot with rescue CD and reverse edited file to its original.

Alternatively you can look for realtime or lowlatency kernels in your distribution’s repository.

I hope you have JACK installed. You don’t actually need it to run Ardour, but in the process of installation, JACK creates a file /etc/security/limits.d/audio.conf (check if it is there) which is necessary for audio to have realtime priority.

If you have JACK installed and still missing /etc/security/limits.d/audio.conf , just run this command:

“sudo dpkg-reconfigure -p high jackd”

and when asked, confirm that you want realtime audio.

Some distributions require few extra steps for the audio to work.
I hope some of that work for you.

2 Likes

That is likely default ulimit (max file size). It is ulimit -r -l that matters. e.g.

$ ulimit -r -l
real-time priority              (-r) 95
max locked memory       (kbytes, -l) unlimited

As for USB devices, with a default system they’re not overly reliably. You’ll be hard pressed to get them working reliably with <= 256fpp/48kHz unless you use a preempt-rt kernel.

Do use threadirqs as @vasakq mentioned and also install the rt-irq package (otherwise it won’t do anything).

All in all it may be easier to just use a pre-configured AVLinux or KXstudio distro. Those include all this setup. YMMV.

For USB soundcards, preferably use some (buffer-size * periods / samplerate combination) that is divisible by 1 ms. see https://www.linuxmusicians.com/viewtopic.php?f=47&t=10707
e.g. 512 * 3 / 48000: jackd .... -d alsa -r 48000 -p 512 -n 3.

1 Like

Thanks for you help.

rt-irq

is not in the repository.
Perhaps there is a problem below>>

my output for ulimit -r -l was below

bhante@Subhuntu:~$ ulimit -r -l
real-time priority (-r) 0
max locked memory (kbytes, -l) unlimited

Maybe called rtirq’ or rtirq-init? – https://wiki.ubuntu.com/UbuntuStudio/rtirq

Yep, your user isn’t set-up to use realtime permissions. Ardour should warn about that (Menu > Window > Log ; or the error-LED top-right should light up).

A good generic description how to set this up is: http://jackaudio.org/faq/linux_rt_config.html

Or alternatively install “jackd2” even if you don’t use it, it can generate /etc/security/limits.d/audio.conf. I don’t know eOS though.

1 Like

I ran the command line you said for jack and I still only see a file that is called audio.conf.diabled

When I was installing ardour it asked me what to do with jack. I chose the default which was not to use jack.

I cannot remember the message or the choice I chose… all I know is that jack confuses things and you don’t need it.

Okay… it is working now… like a charm…
I installed
rtirq-init
startup script for realtime-preempt enabled kernels

I changed renamed the audio.conf.disabled to audio.conf
created another file as per the instructions on http://jackaudio.org/faq/linux_rt_config.html
created file below
/etc/security/limits.d/99-realtime.conf

@realtime - rtprio 99
@realtime - memlock unlimited

created the group…

groupadd realtime

and then added myself with the user/group gui interface.

I never got a message complaining that I was not real time… I only got a standard message that the ulimits were not set to max (and I obviously changed that of course as part of my installation procedure)… That message comes up as a popup warning… and it is fixed quickly by myself and other users because it is obvious.

Should ardour warn me of all of this other realtime tweaking stuff in the same way…?? YES… BECAUSE ARDOUR IS USELESS WITHOUT IT.
On the other hand… my cpu is pretty weak and maybe only I need these tweaks…

Something is surely new with the setup of things… I didn’t have this problem before. But maybe the 18.04 takes up more processor time than 16.04.

Things are working well. Thanks for you help… I’m so glad ardour is using discourse. It is the best user support discussion app on the net. I just wish you had google sign in like my other discourse websites… (discourse.suttacentra.net and https://ubuntu-mate.community/)

The problem is I assume you installed through your distribution, if you install through the package at ardour.org it does warn you of this.

     Seablade

avlinux seems to get bad reviews for noobs like me.

What about Ubuntu studio ?

I think that someone should look into updating the ubuntu distro install program so that it does say such setbacks for real time processing. In the end… I still get xruns… just not an unusual number of them. xruns are annoying and ruin the fun.

Really? Usually I hear the opposite.

avlinux review I read said that the install of avlinux is difficult . After that it is easy.
However, I only have one computer and it is a clunker 2 core acer with only 32 gb hard drive. If you use avlinux, it is not recommended to go live on the internet because there is little security patches and upgrades for it. “use it as an appliance” they say. That is not possible. My acer is my daily and only driver. Ardour is a thing I hack around with every once in a while. (but enough to be a paying 5.x member).

However, About the less but annoying xruns… I forgot to install the low latency kernel. I installed that and did a test and things seem better now (so I think)…
So although the tweaks above helped… I was running realtime mode but with a generic kernel. :slight_smile: oops…

I did a small test and that config is better now (so I think).

eOS is pretty fast… but one day… I might switch to xfce or lxde

I had to reinstall linux (eOS) because it was too tweaked and needed a fresh install. and chose ubuntu 19.04 (just for fun and because I heard it is faster… and it is).
I downloaded 5.12 using my invoice number. Ardour was messed up with a fresh ubuntu and took forever to start and would not kill itself.
I uninstalled it and used synaptic to install it. starts up quick and closes.

Jack install script is the one that asks for realtime permission.
default was not to give it permission.
When installing 5.12 I chose not to install jack since I use usb sound card at best.
But I think that was part of the problem for the slow startup time.

Eventually I installed jack and qjackctrl hoping it would fix things

Just to let you know that I only needed to have realtime permission in limits.conf and unlimited memlocks. That seemed to be it. No other tweaking was neccessary. However, I just could not do it in Ubuntu 19.04 (bug?). This works fine in Ubuntu Mate which has claimed to be a better lean performer than xfce. Plus it always works which is nice.

The permissions things which actually does this setup is a message that says “permission for Jack to have realtime permission” So, this is the problem. It should say “permission for Ardour to have realtime permission” since the install should be independent of Jack.