并不是说我需要以aplayroot 身份,但它遇到了我,我想知道为什么它不应该工作。
# aplay /home/bibek/apert.wav
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by
uid 1000! (This could e g happen if you try to connect to a non-root
PulseAudio as a root user, over the native protocol. Don't do that.)
ALSA lib pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave
aplay: main:722: audio open error: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我可以看到它给了我合理数量的细节,但我仍然不明白。
小智 5
你的 root shell 来自su对吗?环境变量$XDG_RUNTIME_DIR是从您的用户 shell 继承的。您可以export XDG_RUNTIME_DIR=""先运行aplay以清除它,也可以使用sudo -i代替su来获得干净的环境。