创建timidity.service
文件和相关符号链接以便在系统重启时自动启动服务后,我重新启动系统并输入以下输入:
sudo systemctl status timidity
输出:
× timidity.service - TiMidity++ Daemon
Loaded: loaded (/lib/systemd/system/timidity.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2024-10-07 16:34:46 CEST; 50s ago
Process: 635 ExecStart=/usr/bin/timidity -iA Os (code=exited, status=1/FAILURE)
Main PID: 635 (code=exited, status=1/FAILURE)
CPU: 31ms
ott 07 16:34:46 netcom-Vostro-15-3510 systemd[1]: Started TiMidity++ Daemon.
ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: jack_client_new: deprecated
ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: Cannot connect to server socket err = No such file or directory
ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: Cannot connect to server request channel
ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: jack server is not running or cannot be started
ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: Couldn't open output device
ott 07 16:34:46 netcom-Vostro-15-3510 systemd[1]: timidity.service: Main process exited, code=exited, status=1/FAILURE
ott 07 16:34:46 netcom-Vostro-15-3510 systemd[1]: timidity.service: Failed with result 'exit-code'.
我的用户名与该群组相关联audio
。
符号链接:
/usr/lib/systemd/system/multi-user.target.wants/timidity.service
服务:
/usr/lib/systemd/system/timidity.service
包含:
[Unit]
Description=TiMidity++ Daemon
After=sound.target
Requires=sound.target
[Service]
ExecStart=/usr/bin/timidity -iA Os
Type=simple
[Install]
WantedBy=multi-user.target
我还尝试将“timidity.service”文件更改为以下内容:
[Unit]
Description=TiMidity++ Daemon
After=pulseaudio.service
Requires=pulseaudio.service
[Service]
ExecStart=/usr/bin/timidity -iA Os
Type=simple
[Install]
WantedBy=multi-user.target
但再次重启系统后,错误仍然相同。
尝试在系统已启动的情况下从终端手动启动服务,服务正确启动。
我做错什么了?
解决方案如下:
服务:
包含:
系统重启时自动启动服务:
创建符号链接:
为了使自动服务启动不能通过命令禁用
sudo systemctl disable timidity
,请运行此命令而不是上面的命令:创建符号链接:
该文件夹
sound.target.wants
已存在于刚才提到的路径内。该解决方案适用于多用户,并且用户不需要成为
audio
组的一部分。此解决方案在 100% 的系统重启中有效。