[英]How do I get this systemd script to work on ArchLinux?
I have a firewire device hooked into a machine running arch linux. 我有一个连接到运行arch linux的机器上的firewire设备。
I got FFADO working, and after I execute ffado-dbus-server
I can start using the firewire device with Jack and Pulseaudio (that convolution is entirely unrelated to my issue here) 我让FFADO正常工作,在我执行
ffado-dbus-server
我可以开始使用带有Jack和Pulseaudio的firewire设备(这个卷积与我的问题完全无关)
I basically have to run 3 different steps each time I boot to get my sound working. 每次启动时我基本上都要运行3个不同的步骤以使我的声音正常工作。 I'm trying to get all of this magic to happen automatically at boot.
我试图在启动时自动发生所有这些魔法。
I read about /etc/rc.local
but it seems that no such file exists on my arch linux install. 我读到了
/etc/rc.local
但似乎我的arch linux安装上没有这样的文件。 I read about the boot process on arch linux and it seems that arch doesn't use rc.local
and instead uses systemd
我读到了关于arch linux的启动过程,似乎arch不使用
rc.local
而是使用systemd
I went through the arch wiki page on systemd and tried to create a simple ffado-dbus.service
unit file in /usr/lib/systemd/system
我浏览了systemd上的arch wiki页面并尝试在
/usr/lib/systemd/system
创建一个简单的ffado-dbus.service
单元文件
I started trying to use a unit type of dbus
, then tried oneshot
, and finally simple
我开始尝试使用单位类型的
dbus
,然后尝试oneshot
,最后simple
No matter what I do the results are pretty much consistent. 无论我做什么,结果都非常一致。 The service fails.
服务失败。
I also tried putting the service in usr/lib/systemd/user
and tried running this as systemctl --user start
but that also produced the same failure. 我也尝试将服务放在
usr/lib/systemd/user
并尝试将其作为systemctl --user start
运行,但也会产生相同的故障。
The simplest example of the unit file I have is this: 我所拥有的单元文件最简单的例子是:
[Unit]
Description=FFADO DBus startup
[Service]
Type=simple
ExecStart=/usr/sbin/ffado-dbus-server
That produces the following status: 这产生以下状态:
[pigdog@livingroom system]$ sudo systemctl status ffado-dbus -l
● ffado-dbus.service - FFADO DBus Service
Loaded: loaded (/usr/lib/systemd/system/ffado-dbus.service; static; vendor preset: disabled)
Active: failed (Result: core-dump) since Sun 2015-03-01 04:31:59 MST; 5s ago
Process: 3934 ExecStart=/usr/bin/ffado-dbus-server (code=dumped, signal=ABRT)
Main PID: 3934 (code=dumped, signal=ABRT)
Mar 01 04:31:59 livingroom ffado-dbus-server[3934]: FFADO Control DBUS service
Mar 01 04:31:59 livingroom ffado-dbus-server[3934]: Part of the FFADO project -- www.ffado.org
Mar 01 04:31:59 livingroom ffado-dbus-server[3934]: Version: 2.2.1-Unversioned directory
Mar 01 04:31:59 livingroom ffado-dbus-server[3934]: (C) 2008, Pieter Palmers
Mar 01 04:31:59 livingroom ffado-dbus-server[3934]: This program comes with ABSOLUTELY NO WARRANTY.
Mar 01 04:31:59 livingroom ffado-dbus-server[3934]: -----------------------------------------------
Mar 01 04:31:59 livingroom systemd[1]: ffado-dbus.service: main process exited, code=dumped, status=6/ABRT
Mar 01 04:31:59 livingroom systemd[1]: Unit ffado-dbus.service entered failed state.
Mar 01 04:31:59 livingroom systemd[1]: ffado-dbus.service failed.
Mar 01 04:32:00 livingroom systemd-coredump[3944]: Process 3934 (ffado-dbus-serv) of user 0 dumped core.
There is some mysterious code 6/ABRTthat happens in the main process of ffado-dbus-server
在
ffado-dbus-server
的主进程中会发生一些神秘的代码6 / ABRT
I assume this is because the "environment" that systemd
is running in doesn't contain processes or something that ffado needs to run. 我假设这是因为
systemd
运行的“环境”不包含进程或ffado需要运行的东西。 What I don't understand is how I determine what is missing, and then how do I provide this to the systemd environemnt. 我不明白的是我如何确定缺少的内容,然后如何将其提供给systemd environemnt。
Alternatively, I'd love to just make the systemd
environment match the "pigdog" user environment from which I just executed the systemctl
call. 或者,我只想让
systemd
环境与我刚刚执行systemctl
调用的“pigdog”用户环境相匹配。 I thought that's what I'd be doing by moving the ffado-dbus.service
file into /usr/lib/systemd/user
and then calling systemctl like systemctl --user
but this produces the same error. 我认为这就是我将
ffado-dbus.service
文件移动到/usr/lib/systemd/user
然后调用systemctl之类的系统,例如systemctl --user
,这会产生同样的错误。
I also tried adding the User=pigdog
directive to the [Service]
section of the unit file with no success. 我还尝试将
User=pigdog
指令添加到单元文件的[Service]
部分,但没有成功。
I can run /usr/bin/ffado-dbus-server
from bash while logged in as pigdog without issue. 我可以从bash运行
/usr/bin/ffado-dbus-server
,同时登录为pigdog而不会出现问题。 I get the following output when the script succeeds: 脚本成功时,我得到以下输出:
[pigdog@livingroom system]$ /usr/bin/ffado-dbus-server
-----------------------------------------------
FFADO Control DBUS service
Part of the FFADO project -- www.ffado.org
Version: 2.2.1-Unversioned directory
(C) 2008, Pieter Palmers
This program comes with ABSOLUTELY NO WARRANTY.
-----------------------------------------------
1425209640984446: (ffado-dbus-server.cpp)[ 270] main: Discovering devices...
00973362057: Debug (devicemanager.cpp)[ 354] discover: Starting discovery...
00973405357: Debug (devicemanager.cpp)[ 616] discover: driver found for device 0
00973405880: Debug (devicemanager.cpp)[ 653] discover: discovery of node 0 on port 0 done...
00973405944: Debug (devicemanager.cpp)[ 661] discover: Discovery finished...
00973405980: Debug (devicemanager.cpp)[1258] showDeviceInfo: ===== Device Manager =====
00973406020: Debug (Element.cpp)[ 121] show: Element DeviceManager
00973406047: Debug (devicemanager.cpp)[1266] showDeviceInfo: --- IEEE1394 Service 0 ---
00973406085: Debug (devicemanager.cpp)[1276] showDeviceInfo: --- Device 0 ---
00973406113: Debug (devicemanager.cpp)[1279] showDeviceInfo: Clock sync sources:
00973406165: Debug (devicemanager.cpp)[1288] showDeviceInfo: Type: Internal , Id: 0, Valid: 1, Active: 1, Locked 1, Slipping: 0, Description: Internal sync
00973406199: Debug (devicemanager.cpp)[1288] showDeviceInfo: Type: ADAT , Id: 1, Valid: 1, Active: 1, Locked 1, Slipping: 0, Description: ADAT optical
00973406237: Debug (devicemanager.cpp)[1288] showDeviceInfo: Type: SPDIF , Id: 2, Valid: 1, Active: 1, Locked 1, Slipping: 0, Description: SPDIF/Toslink
00973406266: Debug (devicemanager.cpp)[1288] showDeviceInfo: Type: Erratic type , Id: 3, Valid: 0, Active: 0, Locked 0, Slipping: 0, Description: SMPTE
00973406303: Debug (devicemanager.cpp)[1288] showDeviceInfo: Type: WordClock , Id: 4, Valid: 1, Active: 1, Locked 1, Slipping: 0, Description: Wordclock
00973409421: (ffado-dbus-server.cpp)[ 329] main: DBUS service running
00973409433: (ffado-dbus-server.cpp)[ 330] main: press ctrl-c to stop it & exit
00973409436: Debug (ffado-dbus-server.cpp)[ 333] main: dispatching...
When you run a startup script from a shell prompt, and it works, but the startup script fails when launched from systemd -- as is apparently in your case -- ninety nine times out of a hundred the problem is the environment. 当您从shell提示符运行启动脚本时,它可以工作,但启动脚本在从systemd启动时失败 - 显然在您的情况下 - 问题中的九十九个是环境问题。
I would investigate it as a first order of business -- whether the ffado package sets up some default shell environment variables that are needed by its startup script. 我会将其作为第一个业务顺序进行调查 - 无论ffado包是否设置了其启动脚本所需的一些默认shell环境变量。
If so, then this becomes a simple matter of setting up the same environment variables before executing the startup script, in the systemd unit file. 如果是这样,那么在systemd单元文件中执行启动脚本之前设置相同的环境变量就变得很简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.