我不得不硬重启运行 Ubuntu Server 20.04 的 Raspberry Pi(拔掉电源),从那时起我就无法mocp
再运行控制台音乐播放器了。程序运行 OSS 和 ALSA 驱动程序的初始化,然后失败并显示消息FATAL_ERROR: No valid sound driver!
我已尝试清除软件包(通过apt-get purge mocp
)并重新安装它,但错误消息仍然存在。谷歌搜索这个问题会出现一些非常古老的线程(这里和这里)在 MOC 自己的讨论板上,建议这是 ALSA 问题或声卡问题,但我不确定这一点,因为当我运行alsamixer
它时,我可以做一些事情,比如改变它的音量。另外,如果运行其他使用音频(如 mpg123)的程序,音频就可以了。
提取的详细错误日志mocp -F
如下所示,抱歉,如果有点冗长。有谁知道可能是什么原因造成的?
非常感谢!
Aug 31 15:34:23.139072: main.c:1191 main(): This is Music On Console (version 2.6-alpha3)
Aug 31 15:34:23.139216: main.c:1195 main(): Configured: '--build=arm-linux-gnueabihf' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=${prefix}/lib/arm-linux-gnueabihf' '--runstatedir=/run' '--disable-maintainer-mode' '--disable-dependency-tracking' 'build_alias=arm-linux-gnueabihf' 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/moc-NiZ4Xl/moc-2.6.0~svn-r2994=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/moc-NiZ4Xl/moc-2.6.0~svn-r2994=. -fstack-protector-strong -Wformat -Werror=format-security'
Aug 31 15:34:23.139240: main.c:1205 main(): Running on: Linux 5.4.0-1015-raspi armv7l
Aug 31 15:34:23.140180: main.c:1157 log_command_line(): mocp -F
Aug 31 15:34:23.140265: main.c:1171 log_popt_command_line(): mocp --foreground
Aug 31 15:34:23.159074: decoder.c:700 load_plugins(): Loaded 11 decoders: aac flac modplug mp3 musepack opus sidplay2 sndfile speex vorbis wavpack
Aug 31 15:34:23.159160: server.c:360 server_init(): Starting MOC Server
Aug 31 15:34:23.159210: log.c:233 log_init_stream(): Writing log to: stdout
Aug 31 15:34:23.159384: server.c:300 log_process_stack_size(): Process's stack size: 8388608
Aug 31 15:34:23.159402: server.c:317 log_pthread_stack_size(): PThread's stack size: 8388608
Trying JACK...
Aug 31 15:34:23.160789: jack.c:121 error_cb(): ERROR: JACK: Cannot connect to server socket err = No such file or directory
Aug 31 15:34:23.160809: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.160847: jack.c:121 error_cb(): ERROR: JACK: Cannot connect to server request channel
Aug 31 15:34:23.160861: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.163010: jack.c:121 error_cb(): ERROR: JACK: jack server is not running or cannot be started
Aug 31 15:34:23.163028: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.163298: jack.c:121 error_cb(): ERROR: JACK: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Aug 31 15:34:23.163317: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.163332: jack.c:121 error_cb(): ERROR: JACK: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Aug 31 15:34:23.163344: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.163369: jack.c:148 moc_jack_init(): ERROR: jack_client_open() failed, status = 0x11
Aug 31 15:34:23.163381: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.163393: jack.c:150 moc_jack_init(): ERROR: Unable to connect to JACK server
Aug 31 15:34:23.163404: server.c:672 add_event_all(): No events have been added because there are no clients
Trying ALSA...
Aug 31 15:34:23.163423: alsa.c:477 alsa_init(): Initialising ALSA device: default
Aug 31 15:34:23.165678: alsa.c:365 alsa_init_mixer_channel(): ERROR: Can't find mixer PCM
Aug 31 15:34:23.165710: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.165733: alsa.c:365 alsa_init_mixer_channel(): ERROR: Can't find mixer Master
Aug 31 15:34:23.165751: server.c:672 add_event_all(): No events have been added because there are no clients
Trying OSS...
Aug 31 15:34:23.165829: oss.c:206 oss_init(): ERROR: Can't open mixer device /dev/mixer: No such file or directory
Aug 31 15:34:23.165851: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.165899: oss.c:71 open_dev(): ERROR: Can't open /dev/dsp: No such file or directory
Aug 31 15:34:23.165918: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.165939: oss.c:87 set_capabilities(): ERROR: Can't open the device.
Aug 31 15:34:23.165956: server.c:672 add_event_all(): No events have been added because there are no clients
Aug 31 15:34:23.166034: audio.c:926 find_working_driver(): FATAL ERROR: No valid sound driver!
答案1
我mocp
在 RPi 上运行时也遇到问题。
有几个问题:
- 我的用户不在该
audio
组中,因此我必须使用 sudo 来运行amixer
。将我的用户添加到该组解决了该问题。 - 在我的配置(
~/.moc/config
来自 的副本/usr/share/doc/moc/examples/config.example
)中,ALSA 设置为PCM
和Master
。 - 运行时
sudo
,我的用户文件夹中的此设置文件被忽略 - 使用时
-C
或--config
配置文件“不安全”,因为我以 sudo 身份运行并且配置文件属于我的用户而不是 root。 - 当我跑时
amixer
它显示Simple mixer control 'Headphone',0
- 一旦我在 moc 配置中将 ALSA 设置设置为使用
Headphone
而不是Master
orPCM
,它就开始工作