You are not logged in.

#1 2015-05-05 02:25:06

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

[Solved] Sound not working through ALSA

I seem to be having an issue with my laptop's sound failing to work if I leave it on for more than half an hour.

After leaving my computer and coming back I will find that mpd will no longer be playing music and none of my applications can produce sounds.

I attempted to use speaker-test to diagnose this and got the following output:

speaker-test 1.0.28

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Playback open error: -16,Device or resource busy

At another point I ran speaker-test and got this output:

speaker-test 1.0.28

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

The results of aplay -l are shown below:

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC283 Analog [ALC283 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Does anyone have the slightest idea what could be going on? If any additional information is needed to ascertain the problem I will gladly provide it.

Last edited by TheNineBaller (2015-05-29 17:52:21)

Offline

#2 2015-05-05 05:41:40

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Sound not working through ALSA

See what's locking the soundcard:

fuser -fv /dev/snd/* /dev/dsp*

See link in my sig, for tips.

Offline

#3 2015-05-05 23:47:09

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

When I attempted to assess what is accessing the sound, I found nothing was accessing it.

Investigating your tips further I ran the command cat /proc/asound/card0/pcm0p/sub0/hw_params. This yielded the following output:

closed

So seemingly my sound card has been closed in hardware. I am unsure why this would happen and I will restart my computer and wait till I get the device or resource busy error again and try to figure out which application is fiddling with the sound card.

In the meantime does anyone have any ideas what could be happening?

Offline

#4 2015-05-06 01:12:56

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

So I seemed to be stuck. I realized I was using the wrong commands to test it so I was getting errors.

Now the sound simply stops working and I don't get any errors at all. It simply gives no output out of the speakers. I have tried using headphones as well with no luck.

When I run fuser -fv /dev/snd/* it gives no output telling me that no processes are using the devices.

Any ideas? I am truly stumped here.

Offline

#5 2015-05-06 05:25:09

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Sound not working through ALSA

You have 1.0.28 - why not 1.0.29 as in current alsa-utils?

Are you actually using Arch?

Offline

#6 2015-05-06 15:08:22

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

These problems only started happening recently so I assumed that it was a problem with a recent update to ALSA and downgraded my package.

Since then I realized that had nothing to do with it and updated my packages. I am now on 1.0.29 and still having the same issue.

So the version of ALSA does not appear to have any effect on this issue.

Offline

#7 2015-05-25 19:54:44

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

After the problem disappearing for a short while I have figured some things out.

1. The problem only happens when my external HDMI monitor is plugged in. This happens even if I am not playing sound through it
2. The problem only happens when sound isn't played for a long period of time, however once the problem starts only rebooting it seems to fix it.

Is there any reason why the presence of an external HDMI monitor should affect ALSA's ability to play sound?

Offline

#8 2015-05-26 12:41:26

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

Re: [Solved] Sound not working through ALSA

Sounds like your default sound device is changed automagically when you plug / unplug the hdmi monitor.
This can result in sounds being send to a device that doesn't give audible output.

please post aplay -l and  aplay -L output with & without HDMI plugged in.

Last edited by Lone_Wolf (2015-05-26 12:43:48)


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

#9 2015-05-26 14:11:47

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

Here are the results of those commands

Without Monitor:

aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC283 Analog [ALC283 Analog]
  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
aplay -L

null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default:CARD=PCH
    HDA Intel PCH, ALC283 Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, ALC283 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    Front speakers
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=PCH,DEV=0
    HDA Intel PCH, HDMI 0
    HDMI Audio Output

With external monitor connected and enabled:

aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC283 Analog [ALC283 Analog]
  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
aplay -L

null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default:CARD=PCH
    HDA Intel PCH, ALC283 Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, ALC283 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    Front speakers
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC283 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=PCH,DEV=0
    HDA Intel PCH, HDMI 0
    HDMI Audio Output

After performing these commands I can see that there is absolutely no difference between the results with and without the monitor connected.

Offline

#10 2015-05-27 12:10:29

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

Re: [Solved] Sound not working through ALSA

Ok, then something else is causing the change.

Do the problems occur both in console and in X ?

What messages do dmesg / journal show when you plug / unplug the HDMI ?

Do you use custom alsa configuration files ?


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

#11 2015-05-27 20:18:44

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

So I have a great deal of difficulty troubleshooting this since it seems inconsistent but it still happens.

I know the problem occurs in X but I do not know about in the console. The problem only occurs in long periods of time using X.

For example it has just occurred now. I left my laptop on with the external HDMI monitor connected and changed the input of the HDMI TV in order to watch something else for thirty minutes. The audio for the laptop at the time was set to come out of the TV's Speakers. Upon returning to my laptop and waking it from suspend exactly thirty minutes later the audio no longer works. It doesn't work even if I switch the audio output back to the laptop speakers.

Looking through dmesg logs nothing appears to show up in the logs upon connecting/disconnecting the HDMI TV. However after the audio problems when I try to switch back to the laptop speakers this appears:

[May27 16:07] azx_single_send_cmd: 53 callbacks suppressed
[  +3.062184] snd_hda_intel 0000:00:1b.0: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.
[May27 16:08] azx_single_send_cmd: 314 callbacks suppressed
[  +0.780513] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +0.299988] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +0.300360] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +0.300281] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +0.300487] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +0.299747] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +0.300566] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +0.300016] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +0.300375] sound hdaudioC0D2: HDMI: invalid ELD buf size -1
[  +2.155118] azx_single_send_cmd: 338 callbacks suppressed

I do use a custom /etc/asound.conf and a custom ~/.asoundrc. I use .asoundrc to switch the audio output between my laptop speakers and the HDMI TV speakers.

# /etc/asound.conf

# Enables high quality resampling
defaults.pcm.rate_converter "speexrate_medium"

# Enables dmix
pcm.dsp {
    type plug
    slave.pcm "dmix"
}
defaults.pcm.dmix_max_periods -1
defaults.dmix.period_time 0
defaults.dmix.periods 4
# ~/.asoundrc
pcm.!default {
    type hw
    card 0
    device 3
}
#hdmi

Offline

#12 2015-05-28 13:31:18

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

Re: [Solved] Sound not working through ALSA

Some questions for clarity :

both analog and hmdi use the snd_hda_intel module (use lspci -k ) ?
Your laptop uses onboard sound ?

When you change sound output, do you stop/start or restart alsa ?

pacman -Qs pulse output ?


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

#13 2015-05-28 14:09:05

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Sound not working through ALSA

Lone_Wolf wrote:

stop/start or restart alsa

ALSA is a library, not a service - your question is misleading.

Offline

#14 2015-05-28 14:21:11

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

Re: [Solved] Sound not working through ALSA

Alsa also runs a daemon ....

Ok, i'll rephrase :

If you switch sound cards, do you stop / start / restart the alsa sound daemon (can be done though aslactl ) ?


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

#15 2015-05-29 04:04:22

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

Yes my laptop uses onboard sound. I do not actually switch sound cards themselves I just switch which device audio is being output to.

As of now I do not stop/start/restart the alsa daemon when I switch from the laptops speakers to the TV speakers. However, once the problem occurs using alsactl to restart the daemon seems to have no effect.

Output of lspci -k

00:00.0 Host bridge: Intel Corporation Atom Processor Z36xxx/Z37xxx Series SoC Transaction Register (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: iosf_mbi_pci
	Kernel modules: iosf_mbi
00:02.0 VGA compatible controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Graphics & Display (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: i915
	Kernel modules: i915
00:13.0 SATA controller: Intel Corporation Device 0f23 (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: ahci
	Kernel modules: ahci
00:14.0 USB controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series USB xHCI (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: xhci_hcd
	Kernel modules: xhci_pci
00:1a.0 Encryption controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Trusted Execution Engine (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: mei_txe
	Kernel modules: mei_txe
00:1b.0 Audio device: Intel Corporation Atom Processor Z36xxx/Z37xxx Series High Definition Audio Controller (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel
00:1c.0 PCI bridge: Intel Corporation Device 0f48 (rev 0e)
	Kernel driver in use: pcieport
	Kernel modules: shpchp
00:1c.1 PCI bridge: Intel Corporation Device 0f4a (rev 0e)
	Kernel driver in use: pcieport
	Kernel modules: shpchp
00:1c.2 PCI bridge: Intel Corporation Device 0f4c (rev 0e)
	Kernel driver in use: pcieport
	Kernel modules: shpchp
00:1f.0 ISA bridge: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Power Control Unit (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: lpc_ich
	Kernel modules: lpc_ich
00:1f.3 SMBus: Intel Corporation Device 0f12 (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel modules: i2c_i801
02:00.0 Network controller: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter (rev 01)
	Subsystem: Lite-On Communications Inc Device 0642
	Kernel driver in use: ath9k
	Kernel modules: ath9k
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: r8169
	Kernel modules: r8169

I do not have pulse installed but here is the output of pacman -Qs pulse anyways

local/libao 1.2.0-1
    Cross-platform audio output library and plugins
local/libpulse 6.0-2
    A featureful, general-purpose sound server (client library)

Offline

#16 2015-05-29 04:53:17

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

I appear to have found a workaround.

I discovered that if I remove and reload the snd_hda_intel module the problem seems to fix itself. So I rewrote the script I use in order to switch sound output between the laptop's speakers and the TV's speakers so that it reloads the snd_hda_intel module every time in order to ensure this works.

This workaround is rather unpleasant as now I need to mess with modules which requires superuser access. I don't really want to enter my password every time I want to use my TV. Is there any way to prevent this problem from happening in the first place or to at least prevent me from having to enter my password for the script?

Offline

#17 2015-05-29 16:29:34

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

Re: [Solved] Sound not working through ALSA

I do not have pulse installed but here is the output of pacman -Qs pulse anyways

Thanks, i've seen to many cases where pulseaudio managed to wreck a perfectly working alsa setup.
I wanted to be sure pulseaudio was not doing that to you.

00:1b.0 Audio device: Intel Corporation Atom Processor Z36xxx/Z37xxx Series High Definition Audio Controller (rev 0e)
	Subsystem: Acer Incorporated [ALI] Device 0860
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel

It appears both hdmi & analog audio are provided by the same hardware.

I discovered that if I remove and reload the snd_hda_intel module the problem seems to fix itself.

Those 2 combined suggests that some settings are only done on initialising the sound hardware and differ depending on which card is set as default.

Are you running latest firmware for your laptop ?
Does the firmware have any sound related settings ?

Maybe it's not needed to remove / reload the snd_hda_intel module, try alsactl init <card> (if it works, it will prob also require root rights).

For running things with different rights sudo & etc/sudoers (check wiki) are very handy.

For your case i see 2 options :
-   add an entry to sudoers to give your user permissison to run <some command> without password
This will allow sudo <some command>   from any commandline, script , .desktop file etc.
I think that's overkill and somewhat of a security risk for your case.

- put the switching script somewhere your user has read & execute rights for, but no write access.
add an entry in sudoers to give your user permission to run just the switching script with root rights.


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

#18 2015-05-29 17:50:56

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: [Solved] Sound not working through ALSA

I have now modified the script so that it is satisfactory. I appreciate all the help in solving my problem but I still am rather confused as to the origin of my problem in the first place?

Either way my issue is solved thanks for your help Lone_wolf and brebs.

Offline

#19 2015-05-29 18:24:29

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

Re: [Solved] Sound not working through ALSA

From what you posted it seems that the intel chipset in your laptop (may have been customized by Acer) doesn't support switching between audio outputs without re-initialising (atleast on linux + alsa) .

I'm inclined to put the blame for that with Acer and/or Intel .


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

Board footer

Powered by FluxBB