Linux Minecraft:No sound device was found 没有声音?| 检查运行身份

Arch Linux 下 Minecraft 无声音的排查与解决

注:该博客由AI生成

问题现象

  • 系统其他程序声音正常
  • 仅 Minecraft 没有任何声音
  • 音频后端是 PipeWire(通过 pipewire-pulse 提供 PulseAudio 兼容)

排查过程

1. 确认音频后端

1
2
3
4
5
6
7
pactl info | grep "Server Name"
# 输出: PulseAudio (on PipeWire 1.6.6)

systemctl --user is-active pipewire pipewire-pulse pulseaudio
# pipewire: active
# pipewire-pulse: active
# pulseaudio: inactive

2. 检查音频流

1
pactl list sink-inputs short

发现 Minecraft 进程没有任何音频流注册到 PipeWire,但进程确实在运行。

3. 查看 Minecraft 日志

检查 options.txt 中的声音设备设置:

1
soundDevice:"sof-hda-dsp,  (CARD=sofhdadsp,DEV=0)"

查看 logs/latest.log

1
2
3
4
5
6
7
8
9
10
11
[16:07:50] [Render thread/ERROR] Error starting SoundSystem. Turning off sounds & music
java.lang.IllegalStateException: Failed to open OpenAL device

[16:09:29] [Render thread/INFO] OpenAL initialized on device sof-hda-dsp (CARD=sofhdadsp,DEV=0)
[16:09:29] [Render thread/INFO] Sound engine started

[16:18:30] [Render thread/INFO] OpenAL initialized on device sof-hda-dsp (CARD=sofhdadsp,DEV=31)

[16:18:31] [Render thread/INFO] Audio device was lost!
[16:18:31] [Render thread/ERROR] Error starting SoundSystem. Turning off sounds & music
java.lang.IllegalStateException: Failed to open OpenAL device

关键线索:设备号从 DEV=0 跳变为 DEV=31 后,OpenAL 再也无法打开任何设备。

4. 检查 ALSA 设备

1
2
3
4
5
6
7
ls -la /dev/snd/
# pcmC1D0p (sofhdadsp, DEV=0)
# pcmC1D31p (sofhdadsp, DEV=31) ← pipewire-alsa 虚拟设备

cat /proc/asound/cards
# 0 [NVidia ]: HDA-Intel - HDA NVidia
# 1 [sofhdadsp]: sof-hda-dsp - HP-8BAB

DEV=31 是 pipewire-alsa 注册的虚拟 PCM 设备,用于将 ALSA 请求转发到 PipeWire。

5. 发现真正的问题

1
2
cat /proc/26664/status | grep Uid
# Uid: 0 0 0 0 ← 进程以 root 运行!

Minecraft 进程(PID 26664)以 root 运行,而 PipeWire 运行在普通用户 wilbur 的 session 中。root 无法访问用户级别的 PipeWire socket,因此:

  1. 初始阶段 ALSA 物理设备(DEV=0,直接访问硬件)工作正常
  2. pipewire-alsa 重新配置后注册了虚拟设备 DEV=31,并成为 ALSA 默认设备
  3. Minecraft 尝试打开 DEV=31,OpenAL 通过 pipewire-alsa 连接 PipeWire 失败
  4. 之后所有设备都无法打开,声音系统被彻底关闭

解决方案

不要用 sudo 启动 Minecraft 或启动器。

错误的方式:

1
sudo /usr/bin/java -jar hmcl-beta-bin.jar

正确的方式:

1
/usr/bin/java -jar hmcl-beta-bin.jar

以普通用户身份运行后,Minecraft 可以正常访问用户的 PipeWire session,声音恢复正常。

总结

排查要点 说明
仅单个程序无声音 优先检查音频路由、权限、设备独占
ALSA 设备号跳变 pipewire-alsa 虚拟设备可能改变 ALSA 默认设备
进程用户身份 root vs 普通用户 —— PipeWire 是用户级服务
日志关键字 Audio device was lost / Failed to open OpenAL device

根本原因一句话:sudo 启动的图形程序无法访问当前用户的 PipeWire 音频会话。


Linux Minecraft:No sound device was found 没有声音?| 检查运行身份
http://example.com/2026/06/03/Linux-Minecraft-No-sound-device-was-found-没有声音?-检查运行身份/
作者
Wilbur
发布于
2026年6月3日
许可协议