You are not logged in.

#1 2020-05-16 15:59:21

mkheaven
Member
Registered: 2018-01-17
Posts: 15

ALSA randomly loosing USB sound card

Looks like I'm far from being alone having problems with recent updates, but I haven't found any way in that my problem is similar to any surrounding posts.

Basically, everything works. Then, at random periods, sound stops working. It's a USB headset. Unplug, replug, and it works again for 5 seconds or 20 minutes, or an hour.

Why I blame ALSA:

$ diff ./when_playing_and_no_sound/aplay-lL.txt ./when_playing_and_sound_ok/aplay-lL.txt
176c176
<   Subdevices: 1/1
---
>   Subdevices: 0/1

dmesg is spamming with:

retire_capture_urb: 4994 callbacks suppressed

journalctl -b shows these errors:

pulseaudio[843]: E: [alsa-sink-USB Audio] alsa-sink.c: Failed to set hardware parameters: Обрыв канала
usb 1-12: cannot submit urb 0, error -2: endpoint not enabled

* "Обрыв канала" means broken channel

and keeps spamming them hundreds of times a second, my logs are already gigabytes...

speaker-test doesn't play sound, fails with:
(it gives the same output and no sound even when sound IS working)

$ speaker-test

speaker-test 1.2.2

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Channels count (1) not available for playbacks: Invalid argument
Setting of hwparams failed: Invalid argument

I tried:
- switching to fallback kernel, but it didn't help. LTS failed to boot somehow.
- plugging to other usb ports didn't help.

Any suggestions?
Thanks in advance!

Last edited by mkheaven (2020-05-16 16:03:02)

Offline

#2 2020-05-17 20:53:11

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: ALSA randomly loosing USB sound card

pulseaudio[843]: E: [alsa-sink-USB Audio] alsa-sink.c: Failed to set hardware parameters: Обрыв канала

That suggest you're running pulseaudio for userland , not alsa but let's verify .

please post

$ pacman -Qs pulse

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2020-05-18 15:46:35

mkheaven
Member
Registered: 2018-01-17
Posts: 15

Re: ALSA randomly loosing USB sound card

Thanks for reply, Lone_Wolf!

Yes, I was, at first:

$ pacman -Qs pulse
local/lib32-libpulse 13.0-1
    A featureful, general-purpose sound server (32-bit client libraries)
local/libcanberra-pulse 0.30+2+gc0620e4-3
    PulseAudio plugin for libcanberra
local/libpulse 13.0-3
    A featureful, general-purpose sound server (client library)
local/pavucontrol 1:4.0-1
    PulseAudio Volume Control
local/pulseaudio 13.0-3
    A featureful, general-purpose sound server

But now I have it turned off with

pulseaudio -k

to narrow down the issue and VLC is set to output to ALSA. I thought it helped first, because it was working for a couple of hours. But then it started failing exactly as it was with pulseaudio.
From VLC console when it fails: (keeps spamming while video is playing)

ALSA lib pcm_direct.c:1271:(snd1_pcm_direct_initialize_slave) unable to install hw params
ALSA lib pcm_dmix.c:1101:(snd_pcm_dmix_open) unable to initialize slave
[0000561752480d40] alsa audio output error: cannot open ALSA device "sysdefault:CARD=SHG7980": Broken pipe
[0000561752480d40] main audio output error: module not functional
[00007f3a1d28e740] main decoder error: failed to create audio output

And when I selected Front speakers from USB device options, it spams:

[00007f9edd0ee5e0] main decoder error: failed to create audio output
[0000561c4086d3e0] alsa audio output error: cannot commit hardware parameters: Broken pipe
[0000561c4086d3e0] main audio output error: module not functional

Checked

lsusb

. Device is present and didn't go anywhere.

Here is this device from

aplay -Ll
card 2: SHG7980 [Philips SHG7980], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

So I tried to play anything with it from alsa when failed: (works fine before failure)

cat /dev/urandom | aplay -c 2 -f S16_LE -D hw:2,0
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
Warning: rate is not accurate (requested = 8000Hz, got = 44100Hz)
         please, try the plug plugin
aplay: set_params:1407: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (125011 125012)
PERIOD_SIZE: 5513
PERIOD_BYTES: 22052
PERIODS: (3 4)
BUFFER_TIME: 500000
BUFFER_SIZE: 22050
BUFFER_BYTES: 88200
TICK_TIME: 0

If that doesn't help, I think my next step will be compiling the kernel with DEBUG and getting more info from kern.log, right?

Offline

#4 2020-05-21 11:53:48

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: ALSA randomly loosing USB sound card

Sorry for delay in replying, had very little time when I saw your answer and forgot to get back to it until now.

Pulseaudio changes alsa config files to make it work for them, stopping pulseaudio may not be enough to switch to a pure alsa setup.
However , apart from userland alsa also provides kernel support and the problem could very well be in those parts.

Could you post full aplay -Ll output from a point where everything works and another where the card has disappeared ?
A journal / dmesg that covers the same period would also be helpful.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2020-05-22 19:15:06

mkheaven
Member
Registered: 2018-01-17
Posts: 15

Re: ALSA randomly loosing USB sound card

No problem, it's great to have any help smile

Somehow I can't reproduce the issue now. Worked for the whole day today. Either it fixed itself, or I'll have to wait for it.

Didn't know about that. Anyway, I switched back to pulseaudio (just updated and reboted), still works.

Well, here's full output anyway:

surround21
    2.1 Surround output to Front and Subwoofer speakers
surround40
    4.0 Surround output to Front and Rear speakers
surround41
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50
    5.0 Surround output to Front, Center and Rear speakers
surround51
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
null
    Discard all samples (playback) or generate zero samples (capture)
samplerate
    Rate Converter Plugin Using Samplerate Library
speexrate
    Rate Converter Plugin Using Speex Resampler
jack
    JACK Audio Connection Kit
oss
    Open Sound System
pipewire
    PipeWire Sound Server
pulse
    PulseAudio Sound Server
speex
    Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
sysdefault:CARD=PCH
    HDA Intel PCH, ALC1220 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1220 Analog
    Front speakers
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1220 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1220 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1220 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1220 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1220 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1220 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1220 Digital
    IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=PCH,DEV=0
    HDA Intel PCH, HDMI 0
    HDMI Audio Output
hdmi:CARD=PCH,DEV=1
    HDA Intel PCH, HDMI 1
    HDMI Audio Output
hdmi:CARD=PCH,DEV=2
    HDA Intel PCH, HDMI 2
    HDMI Audio Output
hdmi:CARD=PCH,DEV=3
    HDA Intel PCH, HDMI 3
    HDMI Audio Output
hdmi:CARD=PCH,DEV=4
    HDA Intel PCH, HDMI 4
    HDMI Audio Output
usbstream:CARD=PCH
    HDA Intel PCH
    USB Stream Output
hdmi:CARD=NVidia,DEV=0
    HDA NVidia, HDMI 0
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
    HDA NVidia, HDMI 1
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
    HDA NVidia, HDMI 2
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
    HDA NVidia, HDMI 3
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=4
    HDA NVidia, HDMI 4
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=5
    HDA NVidia, HDMI 5
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=6
    HDA NVidia, HDMI 6
    HDMI Audio Output
usbstream:CARD=NVidia
    HDA NVidia
    USB Stream Output
sysdefault:CARD=SHG7980
    Philips SHG7980, USB Audio
    Default Audio Device
front:CARD=SHG7980,DEV=0
    Philips SHG7980, USB Audio
    Front speakers
surround21:CARD=SHG7980,DEV=0
    Philips SHG7980, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=SHG7980,DEV=0
    Philips SHG7980, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=SHG7980,DEV=0
    Philips SHG7980, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SHG7980,DEV=0
    Philips SHG7980, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SHG7980,DEV=0
    Philips SHG7980, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SHG7980,DEV=0
    Philips SHG7980, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=SHG7980,DEV=0
    Philips SHG7980, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
usbstream:CARD=SHG7980
    Philips SHG7980
    USB Stream Output
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC1220 Digital [ALC1220 Digital]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 12: HDMI 6 [HDMI 6]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: SHG7980 [Philips SHG7980], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

This is when all works.
And I posted the only difference when it fails in the opening post. It's just 1/1 subdevices in the line before last.

journal / dmesg were both just the same messages as I posted, spammed actually more than thousand times per second.

Yesterday I was connecting another speakers and mic, experimenting, changing devices. Nothing deep. But maybe this somehow helped... Will wait a couple of days and mark solved if it won't come back.

Offline

#6 2020-05-24 19:12:07

mkheaven
Member
Registered: 2018-01-17
Posts: 15

Re: ALSA randomly loosing USB sound card

Update: Nope, it didn't fix itself. Just happens relatively rarely now. But still the same way.

I can't connect anything to this change in periods. I updated the kernel, but it was only yesterday evening.

Any suggestions?

Offline

#7 2020-05-24 19:37:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: ALSA randomly loosing USB sound card

Do you use a power saving daemon or so? If so try to disable usb autosuspend for the device in question.

If that isn't it and it really only happened on recent updates try to identify the kernel that lead to a regression.

Last edited by V1del (2020-05-24 19:38:49)

Offline

Board footer

Powered by FluxBB