目前,我正在 VirtualBox 中使用 Ubuntu Server 18.04(无 UI)。我想做的是在我的 VirtualBox 上播放音频文件,然后在我的 Windows 10 主机上收听它们。我在两个系统上都安装并配置了 PulseAudio。不幸的是,PulseAudio 不起作用,我无法在主机上听到我在 Virtualbox 上播放的声音。
我根据这篇文章在 Windows 10 上配置了 PulseAudiohttps://parseq.co.uk/wordpress/archives/setting-up-pulseaudio-1-0-beta-for-windows#comment-7788。
当我尝试在 Windows 中使用 CMD 运行 PulseAudio 时,出现以下错误:
D:\x\x\x\PulseAudio-1.1\bin>pulseaudio.exe -p "D:\x\x\x\PulseAudio-1.1\lib\pulse-1.1\modules" -nF "D:\x\x\x\PulseAudio-1.1\etc\pulse\default.pa"
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
E: [(null)] pulsecore/pid.c: Daemon already running.
E: [(null)] daemon/main.c: pa_pid_file_create() failed.
在我的 Ubuntu 客户机上,PulseAudio 也不起作用。我也应该更改这边的一些配置吗?还是发生了其他事情?
x:~$ pulseaudio --start
x:~$ systemctl --user status pulseaudio.socket
● pulseaudio.socket - Sound System
Loaded: loaded (/usr/lib/systemd/user/pulseaudio.socket; disabled; vendor preset: enabled)
Active: failed (Result: service-start-limit-hit) since Tue 2019-05-07 08:35:09 CEST; 2h 41min ago
Listen: /run/user/1000/pulse/native (Stream)
May 07 08:35:07 x systemd[1401]: Listening on Sound System.
May 07 08:35:09 x systemd[1401]: pulseaudio.socket: Failed with result 'service-start-limit-hit'.
x:~$ systemctl --user restart pulseaudio.service
Job for pulseaudio.service failed because the control process exited with error code.
See "systemctl --user status pulseaudio.service" and "journalctl --user -xe" for details.
x:~$ systemctl --user status pulseaudio.service
● pulseaudio.service - Sound Service
Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-05-07 11:17:25 CEST; 2min 59s ago
Process: 23012 ExecStart=/usr/bin/pulseaudio --daemonize=no (code=exited, status=1/FAILURE)
Main PID: 23012 (code=exited, status=1/FAILURE)
May 07 11:17:25 x systemd[1401]: Failed to start Sound Service.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Service hold-off time over, scheduling restart.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Scheduled restart job, restart counter is at 5.
May 07 11:17:25 x systemd[1401]: Stopped Sound Service.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Start request repeated too quickly.
May 07 11:17:25 ubuntuVmRomanPc systemd[1401]: pulseaudio.service: Failed with result 'exit-code'.
May 07 11:17:25 x systemd[1401]: Failed to start Sound Service.
x:~$ systemctl --user status pulseaudio.service
● pulseaudio.service - Sound Service
Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-05-07 11:17:25 CEST; 2min 59s ago
Process: 23012 ExecStart=/usr/bin/pulseaudio --daemonize=no (code=exited, status=1/FAILURE)
Main PID: 23012 (code=exited, status=1/FAILURE)
May 07 11:17:25 x systemd[1401]: Failed to start Sound Service.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Service hold-off time over, scheduling restart.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Scheduled restart job, restart counter is at 5.
May 07 11:17:25 x systemd[1401]: Stopped Sound Service.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Start request repeated too quickly.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Failed with result 'exit-code'.
May 07 11:17:25 x systemd[1401]: Failed to start Sound Service.
x:~$ journalctl --user -xe
--
-- Unit UNIT has failed.
--
-- The result is RESULT.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Service hold-off time over, scheduling restart.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Scheduled restart job, restart counter is at 4.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
May 07 11:17:25 x systemd[1401]: Stopped Sound Service.
-- Subject: Unit UNIT has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit UNIT has finished shutting down.
May 07 11:17:25 x systemd[1401]: Starting Sound Service...
-- Subject: Unit UNIT has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit UNIT has begun starting up.
May 07 11:17:25 x pulseaudio[23012]: E: [pulseaudio] pid.c: Daemon already running.
May 07 11:17:25 x pulseaudio[23012]: E: [pulseaudio] main.c: pa_pid_file_create() failed.
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE
May 07 11:17:25 x systemd[1401]: pulseaudio.service: Failed with result 'exit-code'.
May 07 11:17:25 x systemd[1401]: Failed to start Sound Service.
-- Subject: Unit UNIT has failed
我四处寻找解决方案,但找不到合适的解决方案。有人能帮我吗?
答案1
最后我找到了解决问题的方法。
在我的 Windows 主机系统上,我必须删除启动 PulseAudio 后创建的 PID 文件。这个文件可能很难找到,如果找不到,请使用文件资源管理器。PID 文件存储在我系统上的一个随机文件夹中。当我再次启动 PulseAudio 时,我使用以下命令,这样我就不会再遇到这个问题了:pulseaudio.exe --use-pid-file=false –D
在我再次安装 PulseAudio 后,PulseAudio 便可以在 Ubuntu 客户系统上运行。
答案2
我可以在 Windows 10 桌面上找到 PID 文件:C:\Users\MyUser.pulse\MyComputername-runtime\pid
当我删除 PID 文件时,我能够成功启动 pulseaudio。