Sample Header Ad - 728x90

Playing an audio file using Procmail does not work (no audio card found)

0 votes
1 answer
32 views
I have a strange issue on my Debian server. I am receiving mails with Postfix and "Procmail" for the user notfall. After a mail was received, the script from Procmail should play an audio file. But it does not find any audio card. If I issue the command aplay -l interactively, I can see the existing audio cards: $ aplay -l **** Liste der Hardware-Geräte (PLAYBACK) **** Karte 0: PCH [HDA Intel PCH], Gerät 0: 92HD81B1X5 Analog [92HD81B1X5 Analog] Sub-Geräte: 1/1 Sub-Gerät #0: subdevice #0 Karte 0: PCH [HDA Intel PCH], Gerät 3: HDMI 0 [HDMI 0] Sub-Geräte: 1/1 Sub-Gerät #0: subdevice #0 Karte 0: PCH [HDA Intel PCH], Gerät 7: HDMI 1 [HDMI 1] Sub-Geräte: 1/1 Sub-Gerät #0: subdevice #0 Karte 0: PCH [HDA Intel PCH], Gerät 8: HDMI 2 [HDMI 2] Sub-Geräte: 1/1 Sub-Gerät #0: subdevice #0 The first one is the correct one: Karte 0: PCH [HDA Intel PCH], Gerät 0: 92HD81B1X5 Analog [92HD81B1X5 Analog] The script is as follows: $ cat alarm.sh #!/bin/bash aplay -l ffplay -nodisp -autoexit /home/notfall/beep.wav sleep 1 Whenever a new mail from ilo@pentest.internal is received, the script is executed, but I get the following errors in the procmail.log file: From ilo@pentest.internal Fri Jul 25 13:22:07 2025 Subject: =?utf-8?q?HPE=20iLO=20AlertMail=2D058=3A=20=28INFO=29=20AlertMail=20T Folder: /home/notfall/alarm.sh 2223 aplay: device_list:279: no soundcards found... ffplay version 7.1.1-1+b1 Copyright (c) 2003-2025 the FFmpeg developers built with gcc 14 (Debian 14.2.0-19) configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared libavutil 59. 39.100 / 59. 39.100 libavcodec 61. 19.101 / 61. 19.101 libavformat 61. 7.100 / 61. 7.100 libavdevice 61. 3.100 / 61. 3.100 libavfilter 10. 4.100 / 10. 4.100 libswscale 8. 3.100 / 8. 3.100 libswresample 5. 3.100 / 5. 3.100 libpostproc 58. 3.100 / 58. 3.100 Input #0, wav, from '/home/notfall/beep.wav': 0KB sq= 0B Metadata: title : we5 Duration: 00:00:01.23, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ( / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s ALSA lib confmisc.c:855:(parse_card) cannot find card '0' ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM default SDL_OpenAudio (2 channels, 44100 Hz): ALSA: Couldn't open audio device: No such file or directory ALSA lib confmisc.c:855:(parse_card) cannot find card '0' ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM default SDL_OpenAudio (1 channels, 44100 Hz): ALSA: Couldn't open audio device: No such file or directory No more combinations to try, audio open failed Failed to open file '/home/notfall/beep.wav' or configure filtergraph nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B The message aplay: device_list:279: no soundcards found... indicates that no audio cards were found. **This is the issue that I don't understand, since the script is executed by the same user.** Even more interestingly, the script works when being executed in a cronjob. The user is always logged in graphically. **Do you folks have any idea why the script can't find the audio card?** Thank you!
Asked by Michael Gierer (135 rep)
Jul 28, 2025, 11:20 AM
Last activity: Jul 28, 2025, 12:01 PM