systemd 禁用 pulseaudio 系统模式

systemd 禁用 pulseaudio 系统模式

在对 VMWare 在 Ubuntu 启动期间断开音频设备的问题进行故障排除时(18.04.1 LTS Ubuntu 桌面版),我将问题归结为systemd跑步脉冲音频在登录屏幕出现之前处于系统模式。脉冲音频登录后就可以在用户模式下正常运行,这正是我需要的。

我的问题是如何禁用脉冲音频(它是 sound.target 的一部分)systemd,在用户登录屏幕之前。

答案1

首先尝试停止并禁用 pulseaudio

systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service

或者

sudo systemctl stop pulseaudio
sudo systemctl disable  pulseaudio

并最终

sudo systemctl mask pulseaudio

以防止其他服务再次启动 pulseaudio。

看一眼

man pulse-daemon.conf

此人描述了 PulseAudio 守护进程的配置文件。

   The  PulseAudio sound server reads configuration directives from a con‐
   figuration file on startup. If the per-user  file  ~/.config/pulse/dae‐
   mon.conf  exists,  it  is used, otherwise the system configuration file
   /etc/pulse/daemon.conf is used. In addition to those main  files,  con‐
   figuration  directives  can  also  be  put  in  files under directories
   ~/.config/pulse/daemon.conf.d/  and  /etc/pulse/daemon.conf.d/.   Those
   files  have  to  have  the .conf file name extension, but otherwise the
   file names can be chosen freely. The files under daemon.conf.d are pro‐
   cessed  in alphabetical order. In case the same option is set in multi‐
   ple files, the last file to set an option overrides earlier files.  The
   main daemon.conf file is processed first, so options set in files under
   daemon.conf.d override the main file.

其中一个设置是

   daemonize=  Daemonize after startup. Takes a boolean value, defaults to
               no. The --daemonize command line option takes precedence.

打开/etc/pulse/daemon.conf并设置

daemonize = no

打开本地配置文件 ~/.config/pulse/client.conf

取消注释以下行

autospawn = no

相关内容