Posts: 52
Joined: Tue Oct 15, 2019 3:56 pm

pulseaudio freezes Buster

Wed Nov 06, 2019 7:54 pm

Ever since I bought Raspberry 4 my life turned into a hell of a torment and real hell! With old Raspberries, I was a little tormented with the “mysterious problem” kswapd0, which everyone knew but rarely talked about, but it was a kindergarten compared to Buster's problems! The Buster should be called “Executioner” or “Spanish Boot”, “Torture Room”!
Today, Buster began to torture me again: I connected my favorite old DAC Native Instruments Audio 2 DJ to Raspberry and suddenly it crashes the computer! I know that there is a problem of freezing with Chromium, but so that alsa and pulseaudio lead to such problems ...
I just wanted to enjoy the sound of working perfectly on other computers with Linux DACs. I habitually turned off the built-in sound in config.txt ... And Raspberry seriously hung in a couple of moments!
After I physically disconnect the power from Raspberry and turn it on again (otherwise nothing can be done - the computer is slow), Raspberry quickly loads up to the password request (I have to ask for the password). After entering the password, the mouse freezes, but after thirty seconds the GUI starts working normally. And so on until the moment when I do not type pulseaudio -k in the terminal.
I strongly suspect that the problem is in pulseaudio. Because the simple pulseaudio k command causes Baster to have an epilepsy attack (the mouse disappears, the keyboard slowly prints trash, and Raspberry “freezes”).
Curiously, the DAC is detected in the system. So, I am in despair, I no longer have strength, I breathe a little and look like a zombie ...
I am doing the following steps.
First, simple commands and the answers to all these commands seem to be correct.

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 001 Device 003: ID 046d:c05a Logitech, Inc. M90/M100 Optical Mouse
Bus 001 Device 005: ID 17cc:041c Native Instruments Audio 2 DJ
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

aplay -lL
Playback/recording through the PulseAudio sound server
Discard all samples (playback) or generate zero samples (capture)
JACK Audio Connection Kit
PulseAudio Sound Server
Audio 2 DJ, Audio 2 DJ
Default Audio Device
Audio 2 DJ, Audio 2 DJ
Direct sample mixing device
Audio 2 DJ, Audio 2 DJ
Direct sample snooping device
Audio 2 DJ, Audio 2 DJ
Direct hardware device without any conversions
Audio 2 DJ, Audio 2 DJ
Hardware device with all software conversions
Audio 2 DJ
USB Stream Output
**** List of PLAYBACK Hardware Devices ****
card 0: Audio2DJ [Audio 2 DJ], device 0: Audio 2 DJ [Audio 2 DJ]
Subdevices: 2/2
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1

pacmd list-cards
1 card(s) available.
index: 0
name: <alsa_card.usb-Native_Instruments_Audio_2_DJ_SN-f9g4wsnx-00>
driver: <module-alsa-card.c>
owner module: 6
alsa.card = "0"
alsa.card_name = "Audio 2 DJ"
alsa.long_card_name = "Native Instruments Audio 2 DJ (usb-0000:01:00.0-1.2)"
alsa.driver_name = "snd_usb_caiaq"
device.bus_path = "platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.2:1.0"
sysfs.path = "/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/sound/card0" = "usb-Native_Instruments_Audio_2_DJ_SN-f9g4wsnx-00"
device.bus = "usb" = "17cc" = "Native Instruments" = "041c" = "Audio 2 DJ"
device.serial = "Native_Instruments_Audio_2_DJ_SN-f9g4wsnx"
device.string = "0"
device.description = "Audio 2 DJ"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-usb"
output:stereo-fallback: Stereo Output (priority 5100, available: unknown)
off: Off (priority 0, available: unknown)
active profile: <off>
analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)

[ 8.059220] usbcore: registered new interface driver snd-usb-caiaq
dmesg | grep snd
0 [Audio2DJ ]: snd-usb-caiaq - Audio 2 DJ
Native Instruments Audio 2 DJ (usb-0000:01:00.0-1.2)

cat /proc/asound/cards
alsactl init
description: caiaq USB audio
author: Daniel Mack <[email protected].de>
srcversion: CF634B869625AAFD3282DA9
depends: snd-pcm,snd-rawmidi,snd
intree: Y
name: snd_usb_caiaq
vermagic: 4.19.75-v7l+ SMP mod_unload modversions ARMv7 p2v8
parm: index:Index value for the caiaq sound device (array of int)
parm: id:ID string for the caiaq soundcard. (array of charp)
parm: enable:Enable the caiaq soundcard. (array of bool)
modinfo snd-usb-caiaq

On another old-school computer with Jessie there are no problems with the DAC; it plays and sings sweetly! Chinese FIIO DAC also works (with some special settings)
Which direction should I go? Please tell me!

PS As far as I understand, this is an old problem with dummy output when pulseaudio outputs sound to a void.
I agree to already rearrange the old programs from Jessie into a painful Buster, if only the DAC would work.
And sorry for my bad english.

Posts: 52
Joined: Tue Oct 15, 2019 3:56 pm

Re: pulseaudio freezes Buster

Thu Nov 07, 2019 3:43 pm

I'm starting to understand what's going on with Buster. So, I made a sound, but through crutches and rakes, through hour-long communication with the Russian-speaking geek community. If someone has the same problems, I hope my notes can be useful.
The problem, of course, is alsa and pulseaudio: versions of the programs for Buster can be called unstable or it is more correct to call them “spoiled”. On the Web, many complain about problems with the DAC sound in Baster.
In fact, there are several problems - at default settings, alsa “hallucinates”, and pulseaudio adds brakes (the mouse and GUI freeze for a while).
Pulseaudio cannot determine the DAC through its interface, therefore it writes dummy output by default, of course there is no sound.
This is the problem of Debian (and Ubuntu, of course), and the old one. She is still relevant.
For an example, look here ... n-debian-9 ... 175595299/

Several solutions, all of them are not yet perfect. Judging by the messages on the Debian forums, pulseaudio is unstable. I got sound output now using the following settings.
1. First you need to get rid of the "dummy output" problem. To do this, it is necessary to ensure that
appeared audio interface sink (pacmd list-sinks command)

To do this, write the following lines in the /etc/pulse/ file.

load-module module-alsa-sink device=hw:1,0
set-default-sink 1

(this is my setting, I left the raspberry sound card turned on, so I use hw: 1,0)
So that the DAC “rises” automatically and loads the configuration, create a file
/etc/udev/rules.d/91-Audio2DJ .rules with such entries

SUBSYSTEM=="sound", ACTION!="remove", ATTR{id}=="Audio2DJ", ENV{PULSE_PROFILE_SET}="native-instruments-traktor-audio2.conf"

Here is the native-instruments-traktor-audio2.conf configuration file that comes with pulseaudio
Reboot or reboot heartbeat and sudo udevadm control —reload-rules
It is better to write reboot in the terminal =)
After a thoughtful pause (alas, this is another bug, it slows down pulseaudio when loading, but I am slowly looking for a solution, although the simplest solution was simply to “roll back” to the previous version - Buster is a very bad and unstable OS!) the desired sink appears

2 sink(s) available.
* index: 0
name: <alsa_output.hw_1_0>
driver: <module-alsa-sink.c>
state: RUNNING
sample spec: s24be 2ch 44100Hz
channel map: front-left,front-right
alsa.resolution_bits = "24"
alsa.card_name = "Audio 2 DJ"
alsa.long_card_name = "Native Instruments Audio 2 DJ (usb-0000:01:00.0-1.3)"
alsa.driver_name = "snd_usb_caiaq"
device.bus_path = "platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0"
sysfs.path = "/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/sound/card1" = "usb-Native_Instruments_Audio_2_DJ_SN-f9g4wsnx-00"
device.bus = "usb"
device.icon_name = "audio-card-usb"
index: 1
name: <alsa_output.platform-soc_audio.stereo-fallback>
driver: <module-alsa-card.c>
suspend cause: IDLE
priority: 9000
sample spec: s16le 2ch 44100Hz = "bcm2835 ALSA" = "bcm2835 ALSA"

Then we “redirect” the stream through the command line or pavucontrol to the DAC

This will allow you to "turn on" the sound and begin further experiments on working with external DACs. But this is an unstable solution and the standard “volume control” of Raspbian will not work without additional settings (I use the Awesome graphical shell with my volume control). As I study the problem, if the problem of external DACs is interesting, I will lay out the solutions.

Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23877
Joined: Sat Jul 30, 2011 7:41 pm

Re: pulseaudio freezes Buster

Thu Nov 07, 2019 5:04 pm

Pulseaudio is indeed a bit rubbish, which is why we do not install it as standard.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

Posts: 52
Joined: Tue Oct 15, 2019 3:56 pm

Re: pulseaudio freezes Buster

Thu Nov 07, 2019 7:01 pm

For the sake of experiment, I rolled back to the old pulseaudio (I took it from Jessie) and immediately got rid of the mouse and keyboard hanging (or rather they remained, but almost imperceptible). However, many programs are tied to the new pulseaudio in Debian and it just won’t be possible to refuse it. In principle, with the exception of annoying OS hangs, the system works quite satisfactorily. But most importantly - I got a sweet and gentle sound, albeit somewhat detailed (which not everyone likes). However, the embellished sound of the same DACs from Chinese manufacturers IBasso & FIIO is less pleasant to me than the dry German sound. And this is the same Cirrus Logic (Crystal)!
I’ve been listening to music for several hours, I don’t feel any inconvenience.
But for now, the following unresolved issues remain: VLC and Kodi
The first program actively interacts with the sound subsystem and in my configuration will obviously cause freezes. You may need to abandon the default audio output in the DAC
Yes, I think the pulseaudio hallucinations are somehow related to the features of Raspbian. Because nowhere in the forums have I read that pulseaudio caused such catastrophic freezes (failure of the mouse, keyboard, etc.)
It is necessary to study, of course, how to optimize the operation of the sound subsystem.
I figured out the volume control, now it works perfectly - I use PNMixer
And alas, it is not possible to directly connect the DAC to alsa without special crutches. But you could still reduce the delay time of the sound, if you get rid of pulseaudio

User avatar
Posts: 5069
Joined: Sun Jul 22, 2012 4:14 pm

Re: pulseaudio freezes Buster

Thu Nov 07, 2019 7:07 pm

renice123 wrote:
Thu Nov 07, 2019 7:01 pm
Yes, I think the pulseaudio hallucinations are somehow related to the features of Raspbian. Because nowhere in the forums have I read that pulseaudio caused such catastrophic freezes (failure of the mouse, keyboard, etc.)
That's because no one uses it! As James said Rasbian doesn't install it by default.
So since you installed it it would seem your problems are mostly of your own making.

Why do you need it ? It's mostly an overly complicated solution for a non-existent problem.

Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Posts: 52
Joined: Tue Oct 15, 2019 3:56 pm

Re: pulseaudio freezes Buster

Thu Nov 07, 2019 8:13 pm

Unfortunately, pulseaudio has been considered a must-have package for the Linux world for many years.
We can refuse it, demolish it, replace it with other sound subsystems, but today pulseaudio is installed on almost all distributions.
I use several sound cards, I need my Raspberries to work the way I want - that is, with teensy controllers (which control sound, graphics, work instead of the keyboard), with DACs and ADCs and more. To do this with alsa without crutches will not work. For all its drawbacks, pulseaudio provides some important features.
I am studying the pulseaudio problem now and see that it excites many people. This is a real problem for many. Even here, the forum constantly raises questions about the operation of pulseaudio. So someone needs this? =)
PS I am reading a large article on how to optimize pulseaudio, and I see that this server is not hopeless garbage. But clearly configured not in the best way.

Posts: 52
Joined: Tue Oct 15, 2019 3:56 pm

Re: pulseaudio freezes Buster

Sat Nov 09, 2019 9:31 am

As a result, however, the result is sad. I thought that in Raspberry 4 usb ports do not work well, but everything turned out differently. Most likely in Baster ALSA is broken. Perhaps the core is compiled with hallucinations.
This applies to additional modules like snd-usb-caiaq
It seemed so incredible that I refused to believe.
This morning I put Volumio (latest version) on Raspberry version 3 and everything played like a clock. I could not believe my ears, but it is. Jesse will also have to work (at least everything works on my second “big” computer).
Buster was unreliable, as Debian wrote on the forums?
If someone also had similar problems, these are Buster’s mistakes (perhaps version 4 for Raspberries?), I don’t want to think so, because this is my second and favorite home computer.
Symptoms are as follows: an external sound card has been playing for a while. Most often this happens when watching videos on YouTube (if you switch channels). In this case, alsa shows that an external sound card is connected. Buster made a sound. Sometimes the video continues to show, but there is no sound. Sometimes the message “sound error, restart your computer” appears.
In addition, mplayer hangs the sound card
However, mplayer may lose some sound files. VLC works with sound, but also unreliable.
Is there a reliable version? put the previous version of Debian? Or, for example, using crutches to overwrite alsa files from Volumio on Buster? How many changes are there in the Buster core?
And put a stable reliable OS
PS I already went through the forum and noticed that the problems with resolution until 2014 are very similar. That is, this is the old problem of Raspbian. What changes are made to alsa? And why does modern Volumio jump up to where Raspbian shows itself as a weak kid with sore muscles?
I will explore the possibility of transferring Alsa from Volumio to Buster.
This is very sad news for me, because I love Raspberry and wanted to abandon the "huge noisy computers"

Return to “Troubleshooting”