jackaudio / jack2

jack2 codebase
GNU General Public License v2.0
2.19k stars 374 forks source link

Issues with realtime audio; troubles getting it to work #567

Closed Jacalz closed 1 year ago

Jacalz commented 4 years ago

I have been trying to get jack2 working over the last months and for some reason, I just can't seem to get the realtime support to work on Solus at the moment. I am wuite sure that I had it working a couple months back because Ardour won't work with broken realtime support (when it is enabled) in jack2 and it is why I am asking for help here. I obviously did use Ardour a few months back, but it won't work when I try to use it now. Might be due to alsa updates, I don't remember correctly.

I have followed the documentation over at https://jackaudio.org/faq/linux_rt_config.html and I do have the audio.conf file created and the user is part of the audio group, but starting jack2 gives me this output:

16:08:37.524 Statistics reset.
16:08:37.525 ALSA connection change.
16:08:37.537 JACK is starting...
16:08:37.537 /usr/bin/jackd -dalsa -dhw:0 -r48000 -p256 -n2 -Xseq
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
16:08:37.778 ALSA connection graph change.
jackdmp 1.9.14
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2019 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
Cannot lock down 82280346 byte memory area (Cannot allocate memory)
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|256|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 256 frames (5.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
16:08:37.843 JACK was started with PID=12959.
port created: Midi-Through:midi/playback_1
port created: Midi-Through:midi/capture_1
Cannot use real-time scheduling (RR/10) (1: Operation not permitted)
AcquireSelfRealTime error
16:08:37.854 ALSA connection graph change.
16:08:40.007 JACK connection change.
16:08:40.028 Server configuration saved to "/home/jacob/.jackdrc".
16:08:40.029 Statistics reset.
16:08:40.037 Client activated.
16:08:40.038 Patchbay deactivated.
16:08:40.046 JACK connection graph change.
Cannot lock down 82280346 byte memory area (Cannot allocate memory)

Information about the jack2 implementation can be found here where I am working on trying to replace jack1 with jack2.

elaOnMars commented 4 years ago

Hi, have you also added your user to the realtime group with

usermod -a -G realtime yourUsername ?

lucianoiam commented 4 years ago

This script might also help https://github.com/raboof/realtimeconfigquickscan

Jacalz commented 4 years ago

Hi, have you also added your user to the realtime group with

usermod -a -G realtime yourUsername ?

I created the realtime group and added me to it, but no change in realtime.

Jacalz commented 4 years ago

This is the output of realtime quickscan:

== GUI-enabled checks ==
Checking if you are root... no - good
Checking filesystem 'noatime' parameter... 5.6.4 kernel - good
(relatime is default since 2.6.30)
Checking CPU Governors... CPU 0: 'powersave' CPU 1: 'powersave' CPU 2: 'powersave' CPU 3: 'powersave' CPU 4: 'powersave' CPU 5: 'powersave' CPU 6: 'powersave' CPU 7: 'powersave'  - not good
Set CPU Governors to 'performance' with 'cpupower frequency-set -g performance' or 'cpufreq-set -c <cpunr> -g performance' (Debian/Ubuntu)
See also: http://linuxmusicians.com/viewtopic.php?f=27&t=844
Checking swappiness... 10 - good
Checking for resource-intensive background processes... none found - good
Checking checking sysctl inotify max_user_watches... >= 524288 - good
Checking access to the high precision event timer... not readable - not good
/dev/hpet found, but not readable.
make /dev/hpet readable by the 'audio' group
For more information, see http://wiki.linuxaudio.org/wiki/system_configuration#hardware_timers
Checking access to the real-time clock... not readable - not good
/dev/rtc found, but not readable.
make /dev/rtc readable by the 'audio' group
For more information, see http://wiki.linuxaudio.org/wiki/system_configuration#hardware_timers
Checking whether you're in the 'audio' group... yes - good
Checking for multiple 'audio' groups... no - good
chrt: failed to set pid 0's policy: Operation not permitted
Checking the ability to prioritize processes with chrt... no - not good
Could not assign a 80 rtprio SCHED_FIFO value. Set up limits.conf.
For more information, see http://wiki.linuxaudio.org/wiki/system_configuration#limitsconfaudioconf
Checking kernel support for high resolution timers... Could not find kernel configuration - undetermined
Kernel with Real-Time Preemption... Could not find kernel configuration - undetermined
Checking if kernel system timer is high-resolution... Could not find kernel configuration - undetermined
Checking kernel support for tickless timer... Could not find kernel configuration - undetermined
== Other checks ==
Checking filesystem types... ok.
** Set $SOUND_CARD_IRQ to the IRQ of your soundcard to enable more checks.
   Find your sound card's IRQ by looking at '/proc/interrupts' and lspci.
Jacalz commented 4 years ago

it looks like my kernel has https://jackaudio.org/faq/linux_group_sched.html enabled and that might be the reason that it is wreaking havoc for my realtime audio. The wiki has not been updated since 2013, but I think this could be the cause.

elaOnMars commented 4 years ago

I created the realtime group and added me to it, but no change in realtime.

Look here: https://github.com/jackaudio/jack2/issues/537#issuecomment-605700028 If your distro has a package "realtime-privileges" you could install it to add the realtime group.

it looks like my kernel has RT_GROUP_SCHED enabled and that might be the reason that it is wreaking havoc for my realtime audio.

Hopefully. Let us know if that was the reason.

The wiki has not been updated since 2013.

You are invited to update it ;-)

Jacalz commented 4 years ago

Sorry for taking such a long time. Will get back with information when I have tested it. It has been a lot to do in the past weeks.

Jacalz commented 4 years ago

It looks like the file mentioned in the RT_GROUP_SCHED docs isn't even available on Solus. I still can't figure out why realtime isn't working. I would be very happy if someone had any ideas or if someone could help me with solving this.

elaOnMars commented 4 years ago

Do you have the following in /etc/security/limits.d/99-realtime-privileges.conf?

@realtime - rtprio 98
@realtime - memlock unlimited
elaOnMars commented 4 years ago

Are the permissions okay? crw-rw---- 1 root realtime 10, 228 29. Mai 00:03 /dev/hpet

Jacalz commented 4 years ago

Thanks for the response @elaOnMars.

We are not using the realtime group but instead just audio like suggested in https://jackaudio.org/faq/linux_rt_config.html. The file /etc/security/limits.d/audio.conf contains the following:

@audio   -  rtprio     95
@audio   -  memlock    unlimited

The permissions on the /etc/security/limits.d/audio.conf file is as follows:

-rw-r--r-- 1 root root 58 May 30 16:50 audio.conf

Could it be the config file that needs to have permissions for the audio group and/or other permission settings for read and write?

The permissions of /dev/hpet is as follows:

crw-rw---- 1 root audio 10, 228 May 30 16:19 /dev/hpet
Jacalz commented 4 years ago

I tried to give the audio group access to /etc/security/limits.d/audio.conf, but it didn't seem to be of much use.

sudo chgrp audio audio.conf
elaOnMars commented 4 years ago

The permissions on the /etc/security/limits.d/audio.conf file is as follows:

-rw-r--r-- 1 root root 58 May 30 16:50 audio.conf

That should be okay. But I don't care, if Jack2 is sompiled in that way that it checks for the "realtime" user....

The permissions of /dev/hpet is as follows:

crw-rw---- 1 root audio 10, 228 May 30 16:19 /dev/hpet

This is the same as on my system.

elaOnMars commented 4 years ago

Could not find kernel configuration - undetermined Kernel with Real-Time Preemption... Could not find kernel configuration - undetermined Checking if kernel system timer is high-resolution... Could not find kernel configuration - > undetermined Checking kernel support for tickless timer... Could not find kernel configuration - undetermined

I have the "normal" Linux Kernel installed. uname -a shows me the following: Linux 5.6.15-arch1-1 #1 SMP PREEMPT

elaOnMars commented 4 years ago

You kernel is probably not capable of this. Maybe Debian's, Suse's or Arch's kernel are packaged in a different manner. Maybe your kernel package is missing something which other's do have? I don't know anyting about kerneling. :/

Try this: https://wiki.linuxaudio.org/wiki/system_configuration

I've used this documentation to set up my system.

elaOnMars commented 4 years ago

or this: https://rt.wiki.kernel.org/index.php/Frequently_Asked_Questions

Jacalz commented 1 year ago

No longer using Solus and have since switched to Pipewire. Closing...