systemd woes with jackd and its permissions (raspbian)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi list,

please help with a realtime permissions issue trying to start jackd via
my systemd service script on raspbian.

As root or as user peter (which is part of the audio group) I can start
jackd fine using either
	jackd -v -R -d alsa -r 44100 -P
or
	jackd -v -d alsa -r 44100 -P
No error message mention that realtime was (or wasn't) enabled. Is
this normal and intended?
Checking with htop, there are three jackd processes with a priority of
20 and on with -11. Does this mean that realtime is enabled?

Using mplayer as user peter I can play back audio via jack.

Now I try to start jackd automatically from a systemd service file
created as /etc/systemd/system/jackd.service with the following
contents:

	[Unit]
	Description=jackd
	After=sound.target
	[Service]
	User=peter
	ExecStart=/usr/bin/jackd -d alsa -r 44100 -P
	[Install]
	WantedBy=multi-user.target

I install that service with
	sudo systemctl enable jackd.service
and run 
	sudo systemctl daemon-reload
after having changed the above service file.

When I start that service it fails with errors in the journal:
"JACK is running in realtime mode, but you are not allowed to use
realtime scheduling."
and 
"Please check your /etc/security/limits.conf for the following line"
and so on. Messages that are not present when starting jackd as user
from the command line.
Now I am puzzled because I thought that it is enough to specify user
"peter" in the systemd service.

Well if I comment the line
	User=peter
out and start the service again, jackd runs. It is five processes
with priority 20 and one with -11.

The stupid thing now is that the normal user peter can use that jackd:
Mplayer tells me that
"connect(2) call to /tmp/jack-1000/default/jack_0 failed (err=No such
file or directory)"
So I reckon that a user can't use a jackd started by another user, or
root?

Now I removed above service and installed it as user service
~/.local/share/systemd/user/jackd.service and contents:
	[Unit]
	Description=jackd
	After=sound.target
	[Service]
	User=peter
	ExecStart=/usr/bin/jackd -d alsa -r 44100 -P
	[Install]
	WantedBy=default.target

It gets installed with
	systemctl --user enable jackd.service
and started with
	systemctl --user start jackd.service

Jackd is now started and can be used with mplayer. But the systemd
service is no longer started at boot not at login of user peter. I have
to run:
	systemctl --user start jackd.service
Also trying 
	loginctl enable-linger peter
does not help. The general question remains: How can I run a systemd user
service without that user being logged in?

Another way recommended at 
https://www.linux.org.ru/forum/admin/10795275
or
https://ask.fedoraproject.org/en/question/131584/jack-fluidsynth-as-user-systemd-unit/
is to add some lines specifying Limits.

	[Unit]
	Description=jackd
	After=sound.target
	[Service]
	User=peter
	LimitRTPRIO=infinity
	LimitMEMLOCK=infinity
	ExecStart=/usr/bin/jackd -d alsa -r 44100 -P
	[Install]
	WantedBy=multi-user.target

It does not start jackd with the same error as above.
"JACK is running in realtime mode, but you are not allowed to use
realtime scheduling."
and 
"Please check your /etc/security/limits.conf for the following line"

Now this took me four hours so far without success and I wonder what is
a functional way to use jackd via systemd on a headless computer in
2019. All comments are very welcome!

Peter
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
https://lists.linuxaudio.org/listinfo/linux-audio-user




[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux