服务无法启动或连接到 pulseaudio

服务无法启动或连接到 pulseaudio

我安装了 Ubuntu Server 23.04,然后手动安装了kodipulseaudio我还使用该kodi-standalone服务在启动时自动启动 kodi。

问题是,该服务无法启动或使用 pulseaudio,但如果我通过 ssh ( sudo -iu kodi, then pulseaudio --start or -D) 启动它,然后手动 kodi ( kodi --standalone) 就可以工作。

该服务如下所示:

[Unit]
Description=Kodi standalone (X11)
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
Wants=network-online.target polkit.service upower.service
[email protected]

[Service]
User=kodi
Group=kodi
#EnvironmentFile=-/etc/conf.d/kodi-standalone
PAMName=login
TTYPath=/dev/tty1
ExecStart=kodi --standalone
# OR
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
Restart=on-abort
StandardInput=tty
StandardOutput=journal

[Install]
Alias=display-manager.service

如果我通过 ssh 和 sudo 以 kodi 用户身份登录,则会出现 pactl 信息:

Server String: /var/run/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 14
Tile Size: 65472
User Name: pulse
Host Name: dockerbox.local
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.pci-0000_00_1f.3.hdmi-surround
Default Source: alsa_output.pci-0000_00_1f.3.hdmi-surround.monitor

我读到文件/etc/X11/xinit/xinitrc.d/pulseaudio应该启动 pulseaudio,但我缺少文件和文件夹。如果我添加puleaudio -D或,start-pulseaudio-x11/etc/X11/xinit/xinitrc也不起作用。

相关内容