BeagleBone Black aplay using USB audio adapter causes crash

Question: I can’t get aplay to work reliably with a USB audio adapter. It works most of the time, but every once in a while it crashes and hangs, I can’t play again. The only fix seems to be to cycle the power on the BeagleBone Black.

Any help on how to debug this? I know linux but have never debugged someone else’s kernel crashes.

If I play some files in a loop like this, it eventually crashes and aplay hangs. It is hard to repeat but it is repeatable

for ((i=0; i<1; i++))
aplay -Ddefault:Device /opt/sounds/wav/yipe.wav
aplay -Ddefault:Device /opt/sounds/wav/fart_z.wav
aplay -Ddefault:Device /opt/sounds/wav/scream2.wav

Except, in that code, you’re not really looping at all. You’re just playing 3 sound files one after the other through aplay. i increments then exits. So how many times are you really looping when this script crashes your system ?

regardless, you can always run the script from strace, while piping the output to a file. You’ll need to pipe strace to a file for two reasons.

  1. Lots of data being dumped
  2. When your script crashes the kernel, you wont have a record after a restart,

Anyway I suspect you’re exceeding the Linux stack size, and in this case with debian. stack size is as much memory as is available.

Ooops, yes it dies sometimes on 1 cycle through.

Usually I set it to 100

BTW, I usually set the for loop to 100, not 1. Sometimes it crashes doing it just once however.

wav Files are huge, even if its only a fart;), depending on number of
channels and sampling rate. Its a raw format. The reading speed from
your Memory (sd or mmc) might simply be to slow. Convert the files to
another format and have a look at mp123, nvlc, mplayer, .... Some of
them work even with lossless formats. I propose: give mp3 and mp123 a

I upgraded to BeagleBone Black 8.4 and the problem went away. After a week of testing, I can’t get the error any more. I don’t see any fixes in the 8.4 release notes. But I’ll call this fixed unless I see it again.