我正在尝试使用 uptstart 脚本在启动时以实时优先级启动 jackd,但目前尚未成功。我使用的是 ubuntu server 14.04。我的 upstart 版本是 1.12.1。
我在脚本中使用的用户和组可以使用实时优先级,但当我运行我的 upstart 脚本时,这似乎无关紧要。每当我尝试运行它时,我都会在 upstart 日志中看到以下内容:
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2013 Grame.
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
Cannot create thread 1 Operation not permitted
Cannot create thread 1 Operation not permitted
Cannot create thread 1 Operation not permitted
JACK server starting in realtime mode with priority 70
Cannot lock down 82274202 byte memory area (Cannot allocate memory)
Cannot create thread 1 Operation not permitted
ERROR: messagebuffer not initialized: libffado 2.1.9999- built Oct 19 2013 16:01:07
ERROR: messagebuffer not initialized: 1408466326248438: Error (PosixThread.cpp)[ 161] Start: Cannot create realtime thread (1: Operation not permitted)
ERROR: messagebuffer not initialized: 1408466326248486: Error (PosixThread.cpp)[ 162] Start: priority: 75
firewire ERR: FFADO: Error creating virtual device
Cannot attach audio driver
JackServer::Open failed with -1
Failed to open server
如果我以普通用户身份运行它,它会正常工作。我的 upstart 脚本非常简单:
description "jackd"
start on stopped rc
stop on runlevel [06]
exec su radiola -c "jackd -R -P 70 -d firewire -r 44100 -n 3 -p 2048"
我也尝试过使用 setuid 和 setguid 节以及 start-stop-daemon,但最终得到的结果和我刚才描述的一样。有没有办法让 upstart 启动实时进程?如果没有,还有其他方法可以解决这个问题吗?
谢谢。
答案1
这个问题在 stackoverflow 上有回答:
事实证明你必须使用以下节:
limit memlock unlimited unlimited
limit rtprio 95 95